aspose file tools*
The moose likes Tomcat and the fly likes Name jdbc is not bound in this Context :Error  TomCat 6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Name jdbc is not bound in this Context :Error  TomCat 6" Watch "Name jdbc is not bound in this Context :Error  TomCat 6" New topic
Author

Name jdbc is not bound in this Context :Error TomCat 6

Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
When I deploy my war file an start the server I get the following error:

Name jdbc is not bound in this Context.

my datasource is jdbc/EnterpriseAppDS

I have updated the following files:




in my appserver-applicationContext.xml

<bean id="enterpriseDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean" scope="singleton">
<property name="jndiName" value="jdbc/EnterpriseAppDS"/>
</bean>

in my web.xml

<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/EnterpriseAppDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


conf\context.xml
<Resource name="jdbc/EnterpriseAppDS"
auth="Container"
type="javax.sql.DataSource"
driverClassName="org.postgresql.Driver"
url="jdbcostgresql://mongus.com/mongus_com"
username="scott"
password="tiger"
validationQuery="select now()"
maxWait="1000"
removeAbandoned="true"
maxActive="8"
maxIdle="4"
removeAbandonedTimeout="60"
logAbandoned="true"/>


As its spring on the tc-server-6.0.20.C. Is there anyother file I should update.

The stack trace is :

org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'entityManager
Factory' defined in file [E:\_DEVELOPMENT\ide\springIde\32Bit\tc-server-6.0.20.C\webapps\mo-moses-0.1
.0-SNAPSHOT\WEB-INF\classes\META-INF\spring\applicationContext.xml]: Cannot resolve reference to bean
'enterpriseDataSource' while setting bean property 'dataSource'; nested exception is org.springframe
work.beans.factory.BeanCreationException: Error creating bean with name 'enterpriseDataSource' define
d in URL [file:/E:/_DEVELOPMENT/ide/springIde/32Bit/tc-server-6.0.20.C/webapps/mo-moses-0.1.0-SNAPSHO
T/WEB-INF/classes/META-INF/spring/appserver-applicationContext.xml]: Invocation of init method failed
; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(Bea
nDefinitionValueResolver.java:328)
at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecess
ary(BeanDefinitionValueResolver.java:106)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyProperty
Values(AbstractAutowireCapableBeanFactory.java:130 5)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(
AbstractAutowireCapableBeanFactory.java:1067)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(
AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(Ab
stractAutowireCapableBeanFactory.java:450)

Thanks for any help


Also I have three context.xml in my tomcat server, any ide what the other two are for:

tc-server-6.0.20.C/webapps/host-manager/META-INF/context.xml
tc-server-6.0.20.C/webapps/manager/META-INF/context.xml
tc-server-6.0.20.C/conf/context.xml
Tony Evans
Ranch Hand

Joined: Jun 29, 2002
Posts: 579
I did not put the sqljdbc-1.0.jar in my \tc-server-6.0.20.C\lib
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Name jdbc is not bound in this Context :Error TomCat 6