6 Replies Latest reply on Sep 12, 2005 3:25 PM by darranl

    DS

    a13519

      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)
      {
      try
      {
      InitialContext jndiContext = new InitialContext();

      Object ref = jndiContext.lookup("java:/MySqlDS");
      System.out.println(ref);
      }
      catch(Exception e)
      {
      System.out.println(e.toString());
      }
      }

      }
      --------------------------------------------------------

      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.

      Thanks,
      a13519

        • 1. Re: DS
          davidjencks

          It seems to me that the timeout error might indicate other problems, but if you are running your client in a separate vm as you appear to be, you cannot access anything in the java: namespace. You should test your datasource from within jboss, either from a session bean or an mbean.

          • 2. Re: DS
            aberezin

            I am seeing the same problem with win2k, jboss-4.03rc1 with a very simple jndi lookup from within a client in the same vm as the server.

            • 3. Re: DS
              darranl

              Don't dig up old posts and just add a ME TOO style comment at the end.

              Start a new thread showing YOUR code samples and the exceptions YOU are getting.

              • 4. Re: DS

                May be you have to add the following lines into your main infront of the InitialContext:

                System.setProperty(NamingFactory, "org.jnp.interfaces.NamingContextFactory");
                System.setProperty(ProviderUrl, "localhost:1099");

                • 5. Re: DS

                  Sorry, I forgot the constants:
                  public static final String NamingFactory = "java.naming.factory.initial";
                  public static final String ProviderUrl = "java.naming.provider.url";

                  • 6. Re: DS
                    darranl

                    Please STOP, the original question is three years old.

                    The user was attempting to access a datasource from outside the JVM which is not allowed if the datasource is bound to the 'java:' namespace. The user was also given the correct answer three years ago!

                    If you read the original question you would see the user can connect to JNDI as they can lookup a queue without any problems.