2 Replies Latest reply on Jul 1, 2002 3:07 PM by Wallace Zou

    lookup datasource

    Wallace Zou Newbie

      I tried to setup a datasource for my mySql server. Everything looks OK in the Jboss server console, but when I use a test client to lookup my datasource, there is a exception of time out.

      Version: WINDOWS2000SP2 + JBoss 3.0 + MySql + JDBC driver mm.mysql.jdbc-1.2c

      SETUP Datasource:
      I just simply modify exsit samply file mysql-service to match my system situation. I changed connnection URL. Then I copy this file to %JBOSS_DIST%\server\default\deploy. I can clearly see that the console print out :
      17:42:17,640 WARN [ServiceController] jboss.jca:service=LocalTxDS,name=MySqlDS
      does not implement any Service methods
      17:42:17,640 INFO [LocalTxConnectionManager] Creating
      17:42:17,796 INFO [LocalTxConnectionManager] Created
      17:42:18,000 INFO [LocalTxConnectionManager] Starting
      17:42:18,781 INFO [MySqlDS] Bound connection factory for resource adapter 'JBos
      s LocalTransaction JDBC Wrapper' to JNDI name 'java:/MySqlDS'
      17:42:18,781 INFO [LocalTxConnectionManager] Started

      Client looks up:

      I write a very very simply client to run to check if I could find this datasource:
      import javax.naming.InitialContext;

      * This is a simple client for the "CD" EJB; it lists (to standard output) all
      * the "CD" instances in the system. The "main" method allows this class to be
      * run from the command line.
      public class JTest

      public static void main(String[] args)
      InitialContext jndiContext = new InitialContext();

      Object ref = jndiContext.lookup("java:/MySqlDS");
      catch(Exception e)


      I got a exception in running:
      javax.naming.CommunicationException: Receive timed out [Root exception is java.n
      et.SocketTimeoutException: Receive timed out]

      Although I want to make sure my client has no problem, I tried to lookup queue/DLQ, it's OK, I can find it.

      Where is wrong? Any suggestions are welcome and I am appreciated that.


        • 1. Re: lookup datasource
          Chris McCafferty Newbie

          This is because you can't access the "java" namespace outside the container. It seems to be 'special' in JNDI.

          Beans or any code that you deploy _inside_ the container can quite happily lookup the namespace 'java:/'. So for example a lookup of 'java:/DefaultDS' might work fine for a session bean inside JBoss. But the same lookup will fail for an external client, running on its own outside JBoss.

          Your external client can always lookup 'global' names like "topic/testTopic" (which resolves to a JMS topic), but has no access to 'java:/' names.

          Hope that helps.



          p.s. Check out this, if you have JBoss 3.0
          Basically it gets JBoss to tell you about the namespace it's managing. See the distinction between Java and Global. It's pretty useful for tracking down typos in your JNDI strings!

          • 2. Re: lookup datasource
            Wallace Zou Newbie

            Thanks! Your information is quite match my situation. I Used a client out of container to list all available namings and contexts, I can't find any java:/ items.