3 Replies Latest reply on Mar 20, 2002 11:43 AM by shailesh_dangi

    One another time "jdbc not bound" problem

    moshchenikov

      Hi,
      I've just have some headache
      Could you tell me what's wrong

      I have folloing in

      ejb-jar.xml
      <ejb-jar>
      .....
      </enterprise-beans>

      Version 2
      <display-name>Customer2</display-name>
      <ejb-name>Customer2</ejb-name>
      net.sidy.bmp_properly.ejb.CustomerHome
      net.sidy.bmp_properly.ejb.Customer
      <ejb-class>net.sidy.bmp_properly.ejb.CustomerBeanVersion2</ejb-class>
      <persistence-type>Bean</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <env-entry>
      <env-entry-name>debug</env-entry-name>
      <env-entry-type>java.lang.Integer</env-entry-type>
      <env-entry-value>2</env-entry-value>
      </env-entry>
      <resource-ref>
      My DataSource
      <res-ref-name>jdbc/myds</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      </enterprise-beans>
      ....
      <ejb-jar>

      jboss.xml

      <enterprise-beans>

      <ejb-name>Customer2</ejb-name>
      <resource-ref>
      <resource-name>myds</resource-name>
      <res-ref-name>jdbc/myds</res-ref-name>
      </resource-ref>

      </enterprise-beans>
      <resource-managers>
      <resource-manager res-class="javax.sql.DataSource">
      <res-name>myds</res-name>
      <res-jndi-name>java:/DefaultDS</res-jndi-name>
      </resource-manager>
      </resource-managers>


      and finally when i call

      initialctx.lookup("java:comp/env/jdbc/myds")
      or
      initialctx.lookup("java:/comp/env/jdbc/myds")

      in the server log i've got

      javax.naming.NameNotFoundException: jdbc not bound

      jboss 2.4.4 + Tomcat 4.0.1
      jdk1.3.1

      Thanks

        • 1. Re: One another time "jdbc not bound" problem
          moshchenikov

          Sorry for my foolish question
          I've just missed the rules of context visibility

          • 2. Re: One another time "jdbc not bound" problem
            kamal110

            Hi Moshchenikov,

            I am new to JBoss and facing similar problem

            jboss 3.0 beta

            trying to lookup DefaultDS with

            initialctx.lookup("java:comp/env/jdbc/DefaultDS")
            javax.naming.NameNotFoundException: comp not bound

            initialctx.lookup("java:/DefaultDS")
            javax.naming.NameNotFoundException: DefaultDS not bound

            initialctx.lookup("DefaultDS")
            javax.naming.NameNotFoundException: DefaultDS not bound

            initialctx.lookup("jdbc/DefaultDS")
            javax.naming.NameNotFoundException: jdbc not bound

            I am totally confused over this context visibility.

            Although Server log indicates the DefaultDS is bound

            [org.jboss.resource.security.ManyToOnePrincipalMapping.DefaultDS] PrincipalMapping properties set to: {UserName=sa}
            2002-03-20 16:02:06,156 INFO [org.jboss.resource.adapter.jdbc.local.JDBCManagedConnectionFactory.DefaultDS] Bound connection factory for resource adapter 'jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction ResourceAdapter' to JNDI name 'java:/DefaultDS'
            2002-03-20 16:02:06,265 INFO [org.jboss.resource.ConnectionFactoryLoader.DefaultDS] Started

            Your comments will be of great help for me,

            Thanks
            Kamal

            • 3. Re: One another time "jdbc not bound" problem
              shailesh_dangi

              The database resources have to accessed in the same VM as JBoss is running.