Results 1 to 10 of 10

Thread: javax.naming.NameNotFoundException: Name jdbc is not bound i

  1. #1
    Join Date
    Aug 2005
    Posts
    11

    Default javax.naming.NameNotFoundException: Name jdbc is not bound i

    Hi

    I have deployed my application on tomcat 5.0.28 and the IDE is eclipse 3.1 with myeclipse plugin. when I try to start the tomcat server, I get the following error:
    2005-08-26 17:20:33,069 ERROR [org.springframework.web.context.ContextLoader] - <Context initialization failed>
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'exDataSource' defined in resource [/WEB-INF/webserver-config.xml] of ServletContext: Initialization of bean failed; nested exception is javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

    I have configured the datasource in webserver-config.xml as:
    <bean id="exDataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName">
    <value>jdbc/DbUser</value>
    </property>
    </bean>

    I am using spring framework, ant and oracle. Please let me know, what the problem could be?

    Thanks
    Sri

  2. #2
    Join Date
    Aug 2006
    Location
    Omaha, NE
    Posts
    37

    Default

    I have this same issue.

    Did you ever figure out a solution?

    Thanks,
    --Todd

  3. #3

    Default Re: javax.naming.NameNotFoundException: Name jdbc is not bound i

    probably you have to set the jdbc/mySQL or other driver into following place

    go to tomcat administration tools, click tomcat server, then click service(Catalina), then expand your application context, there you see "data sources", on the right pane from drop down choose the create new data source
    enter the requested information.
    validation query may be SELECT=1;

    Try this as I am using this and my application running fine.

    Cheers
    Rishi

  4. #4
    Join Date
    Feb 2007
    Posts
    6

    Default

    Use "java:comp/env/jdbc/DbUser" instead of just "jdbc/DbUser" for datasource config:

    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName" value="java:comp/env/jdbc/DbUser" />
    </bean>

  5. #5
    Join Date
    Aug 2007
    Posts
    14

    Default

    I'm having the same problem, only I am using the java:comp/env notation in the spring app context config file. I'm convinced it's a spring problem because I can use the same JNDI datasource in a hibernate/JPA app without any problems. I am on the verge of dropping spring entirely because of stuff like this.

    I have the following config in my app context:

    Code:
    	
    <bean id="myDS" class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="java:comp/env/jdbc/MyDS"/>
    	</bean>
    
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="datasource" ref="myDS"/>
    		<property name="hibernateProperties">
    			<value>
    				hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
    				hibernate.hbm2ddl.auto=update
    			</value>
    		</property>
    	</bean>

  6. #6
    Join Date
    Apr 2006
    Posts
    1

    Default

    To me, this is the correct syntax : java:/MyDS

  7. #7
    Join Date
    Aug 2007
    Posts
    14

    Default is working

    Yeah, I forgot to post I got this working awhile back... problem was I didn't have resource link properly set up for my webapp context.

  8. #8

    Default HI Amcarri,

    Would you be able to help me what specific resource settings were set up for your webapp context. That woudl help me to do the same settings as I also have same defined appcontext fole but unluckily few of teh settings have been missing. May beyour pointers could help me .

  9. #9
    Join Date
    Feb 2010
    Posts
    1

    Default Check the spring logs

    I had a similar problem. To find the error, I configured an appender in my log4j.properties file to "org.springframework" and put the logging level to "debug." Once I did that, I saw the root exception. In my case, I had miss-configured my resource ref in my context.xml leading to a ClassNotFoundException

  10. #10
    Join Date
    Feb 2010
    Location
    India
    Posts
    14

    Default

    Quote Originally Posted by malusman View Post
    Use "java:comp/env/jdbc/DbUser" instead of just "jdbc/DbUser" for datasource config:

    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName" value="java:comp/env/jdbc/DbUser" />
    </bean>
    It is working for me. Now I am getting classpath issue.

    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'

    I am wondering, I have the driver jar in both tomcat lib and webapp lib. let me check.

Similar Threads

  1. Replies: 2
    Last Post: Aug 31st, 2005, 01:41 PM
  2. stale Oracle processes
    By compostellas in forum Data
    Replies: 7
    Last Post: Jun 27th, 2005, 12:14 PM
  3. Replies: 3
    Last Post: May 16th, 2005, 07:04 AM
  4. NameNotFoundException: ejb not bound
    By alesj in forum EJB
    Replies: 2
    Last Post: Oct 19th, 2004, 11:55 AM
  5. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •