4 Replies Latest reply on Aug 23, 2002 3:15 PM by Manan

    Jboss 3.0 Tomcat 4.03 Naming Context problem

    Michael Newbie

      Does anybody know why I'm getting the following run error
      when trying to connect to MySql database.
      run.clientDBTest:
      [java] Start of TestDBMySqlClient
      [java] Here
      [java] javax.naming.NameNotFoundException: MySqlDS not bound
      [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.jav
      [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
      [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
      [java] at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:445)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
      [java] at javax.naming.InitialContext.lookup(InitialContext.java:350)
      [java] at test.client.TestDBMySqlClient.main(TestDBMySqlClient.java:23)
      ----------------------------------------------------------

      Please see below simple client
      Connection con = null;

      try {
      System.out.println("Start of TestDBMySqlClient");

      System.out.println("Here");
      DataSource ds = (DataSource) new InitialContext().lookup("java:/MySqlDS");
      System.out.println("Here2");
      con = ds.getConnection();
      Statement stmt = con.createStatement();
      StringBuffer sb = new StringBuffer();
      sb.append("Select * from Employee");
      ResultSet rs = stmt.executeQuery(sb.toString());
      while (rs.next())
      {
      String lname = rs.getString("LastName");
      String fname = rs.getString("FirstName");
      System.out.println("Record retieved " + fname + " " + lname);
      }

      } catch( Exception e ){
      e.printStackTrace();
      }
      finally {
      try {
      con.close();
      }
      catch(Exception ex) {}
      }
      ------------------------------------------------------
      below is console message starting MySql and hsql
      08:34:42,141 WARN [ServiceController] jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper does not implement any Servi
      ce methods
      08:34:42,141 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=hsqldbDS does not implement any Service methods
      08:34:42,141 INFO [LocalTxConnectionManager] Creating
      08:34:42,361 INFO [LocalTxConnectionManager] Created
      08:34:42,361 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=MySqlDS does not implement any Service methods
      08:34:42,361 INFO [LocalTxConnectionManager] Creating
      08:34:42,381 INFO [LocalTxConnectionManager] Created
      08:34:42,581 INFO [LocalTxConnectionManager] Starting
      08:34:43,302 INFO [DefaultDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/Defau
      ltDS'
      08:34:43,533 INFO [LocalTxConnectionManager] Started
      08:34:43,533 INFO [LocalTxConnectionManager] Starting
      08:34:43,583 INFO [JaasSecurityManagerService] Created securityMgr=org.jboss.security.plugins.JaasSecurityManager@1ba94d
      08:34:43,583 INFO [JaasSecurityManagerService] setCachePolicy, c=org.jboss.util.TimedCachePolicy@82751
      08:34:43,583 INFO [JaasSecurityManagerService] Added MySqlDbRealm, org.jboss.security.plugins.SecurityDomainContext@4d5bc9 to map
      08:34:44,093 INFO [MySqlDS] Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/MySqlDS
      '
      08:34:44,093 INFO [LocalTxConnectionManager] Started
      ----------------------
      Thanks,
      Unfortunately I'm having a hard time attaching mysql-service.xml file
      But, I'll do it a next thread if needed.

        • 1. Re: Jboss 3.0 Tomcat 4.03 Naming Context problem
          David Jencks Master

          the java:/ context is accessible only inside the jboss vm. Either your client is in a different vm or you have set up bad jndi.properties for it so it makes lookups through rmi, which also makes the java:/ context inaccesible. JBoss datasources are in-vm only under all circumstances.

          • 2. Re: Jboss 3.0 Tomcat 4.03 Naming Context problem
            Michael Newbie

            Thanks,
            It would be nice to be able to do an external JNDI
            naming lookup from an external VM for this purpose.

            • 3. Re: Jboss 3.0 Tomcat 4.03 Naming Context problem
              David Jencks Master

              I disagree, I don't think it would be nice for anyone, just extremely misleading. If you need a datasource in a vm, deploy a mini-jboss with the tm and jca framework, and deploy it there.

              • 4. Re: Jboss 3.0 Tomcat 4.03 Naming Context problem
                Manan Newbie

                Jboss 3.0 Tomcat 4.03 Naming Context problem - I am facing the same problem.

                In java:namspace, I see my jdbc/DB name but not in global JNDI namespace.

                What steps I need to make sure that its working in the same JVM.

                Any pointers will be of great help to me.

                in JBoss.xml, the following code has been defined.

                <resource-managers>
                <resource-manager>
                <res-name>DB</res-name>
                <res-jndi-name>java:/DB</res-jndi-name>
                </resource-manager>
                </resource-managers>

                in ejb-jar.xml,the following code has been defined.



                <resource-ref>
                No Description
                <res-ref-name>jdbc/DB</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
                </resource-ref>

                I am getting tow types of errors:
                1. No resource manager found for jdbc/DB
                2. jdbc/DB not bound

                Any pointers will be of great help?

                Thanxs.