Announcement Announcement Module
Collapse
No announcement yet.
javax.naming.NameNotFoundException: Name jdbc is not bound i Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    I have this same issue.

    Did you ever figure out a solution?

    Thanks,

    Comment


    • #3
      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

      Comment


      • #4
        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>

        Comment


        • #5
          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>

          Comment


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

            Comment


            • #7
              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.

              Comment


              • #8
                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 .

                Comment


                • #9
                  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

                  Comment


                  • #10
                    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.

                    Comment

                    Working...
                    X