Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    javax.naming.NameNotFoundException: Name java:comp is not bound in this Context

    Hi Isomorphic,

    I was trying to create a jdni Data Source, the purpose is to move all the db connection settings outside the application and configure it on tomcat.

    DS was not able to connect.

    Error: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context


    ##############
    Tomcat - server.xml
    ##############

    Code:
    <Resource name="jdbc/jndiTest"
                     auth="Container"
                     type="javax.sql.DataSource"
                     driverClassName="oracle.jdbc.driver.OracleDriver"
                     url="jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:mySid"
                     username="oracuser"
                     password="oracuser"
                     initialSize="5"                 
                     maxActive="50" />
    ###################
    server.properties
    ###################

    Code:
    sql.OraDB.driver.name: java:/comp/env/jdbc/jndiTest
    sql.OraDB.database.type: oracle
    sql.OraDB.interface.type: jndi

    regards,
    /john
    Last edited by jbferrer2012; 27 Aug 2012, 03:43.

    #2
    This means your JNDI name is wrong. Most likely Tomcat does not want you to use the java: prefix or java:comp/env since its implicit.

    If you still can't fix it, remember you need to post the complete server log for the failing request, not just the exception.

    Comment


      #3
      Hi,

      I was able to fix the issue by moving my configuration in sever.xml inside the <Host></Host> tag and included <Context docBase="AppName" path="/AppName" reloadable="true">

      Code:
      <Context docBase="AppName" path="/AppName" reloadable="true">
      <Resource name="jdbc/jndiTest"
                       auth="Container"
                       type="javax.sql.DataSource"
                       driverClassName="oracle.jdbc.OracleDriver"
                       url="jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:mySid"
                       username="oracuser"
                       password="oracuser"
                       initialSize="5"
                       maxActive="50" />
      </Context>

      Comment

      Working...
      X