2 Replies Latest reply on Jun 24, 2002 10:20 AM by mroosendaal

    JNDI DataSource lookup fails

      Hi,

      I'm trying to configure a Connectionpool in JBoss for MySQL so i can retrieve a DataSource in a Class. The problem is that the JNDI lookup fails even when the server.log says:
      Binding object 'org.jboss.resource.adapter.jdbc.local.LocalDataSource@7f8922' into JNDI at 'java:/MySqlDS'
      Bound connection factory for resource adapter 'JBoss LocalTransaction JDBC Wrapper' to JNDI name 'java:/MySqlDS'

      I look it up with the following code:
      Context ctx = new InitialContext();
      Object ref3 = ctx.lookup("java:/MySqlDS");
      which ends in a NameNotFoundException. I tried several other Strings for the lookup but no luck. I used the 2.0.11 mysql Driver and the mysql-service.xml with thses changes:
      MySqlDbRealm
      <depends optional-attribute-name ="ManagedConnectionFactoryName">
      <!--embedded mbean-->

      MySqlDS


      <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/test</config-property>
      <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
      <config-property name="UserName" type="java.lang.String">root</config-property>
      <config-property name="Password" type="java.lang.String"></config-property>



      i also edited the login-config.xml accordingly.

      I have no idea where to look next and i hope someone can help me.

      Thanks,
      Maartem

        • 1. Re: JNDI DataSource lookup fails
          davidjencks

          1. Check jndiview on port 8082 to make sure the log is telling the truth and there is something at java:/MySqlDS.

          2. Check that jndi lookup thinks it is in the same vm as jboss. This could fail if you actually are calling from a different vm (which you can't do for anything in java:/) or if there are jndi.properties available somewhere that specify an ip address or perhaps some other things that make jndi calls be serialized.

          • 2. Re: JNDI DataSource lookup fails

            It's looking in the same VM because i deployed an entitybean in the deploy-directory and the jndi lookup works just fine.

            I looked on port 8082 and the is a MySqlDS present but when i look into things i get several 'Type Not Supported:' messages for. i can see the following
            jboss.jca
            service=CachedConnectionManager
            service=LocalTxCM,name=MySqlDS
            service=LocalTxCM,name=hsqldbDS
            service=LocalTxDS,name=MySqlDS
            service=LocalTxDS,name=hsqldbDS
            service=LocalTxPool,name=MySqlDS
            service=LocalTxPool,name=hsqldbDS
            service=RARDeployer
            service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper
            service=RARDeployment,name=JMS Adapter
            service=RARDeployment,name=Minerva JDBC XATransaction ResourceAdapter
            service=XaTxCM,name=jmsra
            service=XaTxDS,name=jmsra

            but when i look into items concerning MySqlDS i get the type not supported error. Here's one in specific (ManagedConnectionFactoryProperties for jboss.jca:service=LocalTxDS,name=MySqlDS)
            org.w3c.dom.Element
            RW
            Type Not Supported: [ <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/test</config-property> <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property> <!--set these only if you want only default logins, not through JAAS --> <config-property name="UserName" type="java.lang.String">root</config-property> <config-property name="Password" type="java.lang.String" /> ]

            I can't see it anymore.

            Hope you have some more ideas.

            Thanks,
            Maarten