1 Reply Latest reply on Jan 11, 2004 1:38 PM by Stjepan Brbot

    java.lang.ClassNotFoundException: org.jboss.resource.adapter

    masroor Newbie

      Hello there.
      Unfortunately, the last days, I am running problems with a mySQL DataSource. I'm trying to use a DataSource from Bean Code:

      InitialContext ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup("java:/mySQLDS");
      return ds;

      "java:mySQLDS" and "java:comp/env/mySQLDS" does'nt function too.

      The complete Exception is:
      java.lang.ClassNotFoundException: org.jboss.resource.adapter.jdbc.WrapperDataSource (no security manager: RMI class loader disabled)

      The mySQL is configured well:
      <local-tx-datasource>
      <jndi-name>mySQLDS</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/db</connection-url>
      <driver-class>org.gjt.mm.mysql.Driver</driver-class>
      <user-name>user</user-name>
      pass
      </local-tx-datasource>

      Thanks for help in advance.
      Masroor

        • 1. Re: java.lang.ClassNotFoundException: org.jboss.resource.ada
          Stjepan Brbot Newbie

           

          "masroor" wrote:

          InitialContext ctx = new InitialContext();
          DataSource ds = (DataSource) ctx.lookup("java:/mySQLDS");
          return ds;

          Probably you know that this code you can use only if your client is using local interface. It does not work if you want to access it through remote interface!

          If your mysql-ds.xml file looks like:
          <?xml version="1.0" encoding="UTF-8"?>
          <datasources>
           <local-tx-datasource>
           <jndi-name>MySqlDS</jndi-name>
           <connection-url>jdbc:mysql://brby:3306/jbossdb</connection-url>
           <driver-class>com.mysql.jdbc.Driver</driver-class>
           <user-name>sbrbot</user-name>
           <password>...</password>
           </local-tx-datasource>
          </datasources>

          then your datasource is registered in JBoss JNDI tree as java:/MySqlDS not any other variant.

          BTW, use com.mysql.jdbc.Driver, MM's driver is obsolete!