Scott,
It sounds like the InstantDB datasource is still being defined, but since you
have removed the driver, it cannot load.

I think that in JBoss 2.2.1 you have to delete the jboss-auto.jcml file in order
to avoid having previously defined mbeans from reappearing on you.  That was
changed in later versions.  You might want to use 2.2.2.

You also say that CMP still works.  How is that possible when the startup hangs?

In order to make the Context.lookup() call like you are, I think that you need
to change:

<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=mySQLDB">
to
<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=jdbc/mySQLDB">

To verify the JNDI name,

     Browse http://localhost:8082/

     Click on: service=JNDIView

     Click on the list button.

Your bean will have an entry for it's java:comp namespace.

Make sure that it has the entry:

  +- env (class: org.jnp.interfaces.NamingContext)
  |   +- jdbc (class: org.jnp.interfaces.NamingContext)
  |   |   +- mySQLDB[link -> java:/jdbc/mySQLDB] (class: javax.naming.LinkRef)

If not, either:

1) fix your deployment descriptors, you are missing:

      <resource-ref>
       <res-ref-name>jdbc/mySQLDB</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
      </resource-ref>
     in your ejb-jar.xml file and:

      <resource-managers>
        <resource-manager res-class="javax.sql.DataSource">
          <res-name>jdbc/mySQLDB</res-name>
          <res-jndi-name>java:/jdbc/mySQLDB</res-jndi-name>
        </resource-manager>
      </resource-managers>
     in your jboss.xml file.

2) Or, change your code to:

     DataSource ds = (DataSource)jndiCntx.lookup("java:jdbc/mySQLDB");
Good luck!





"Scott Salisbury" <[EMAIL PROTECTED]> on 07/11/2001 11:56:40 AM

To:   Tim Haley/SAR/Global@Global
cc:

Subject:  Re: Re: [JBoss-user] MySQL, BMP, Table not found




Thanks Tim!

I appreciate your help.   Here is what my jboss.jcml JDBC section now looks
like, after following your suggestion.

<!-- JDBC -->
 <mbean code="org.jboss.jdbc.JdbcProvider"
name="DefaultDomain:service=JdbcProvider">
    <attribute name="Drivers">org.gjt.mm.mysql.Driver</attribute>
 </mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=mySQLDB">
   <attribute
name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>

   <attribute name="PoolName">mySQLDS</attribute>
   <attribute name="URL">jdbc:mysql://165.121.243.05/test</attribute>
   <attribute name="JDBCUser" />
   <attribute name="Password" />
   </mbean>

The problem is that when I start JBOSS now, it hangs when the following appears
on the log....

[InstantDB] Starting
[InstantDB] XA Connection pool InstantDB bound to java:/InstantDB

It does not continue after this point.Is there somewhere besides jboss.jcml that
I must look?

my CMP beans continue to work but my BMP bean test is now giving the following
message...

[ShipBean] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
       javax.ejb.EJBException
[ShipBean] javax.naming.NameNotFoundException: jdbc not bound
[ShipBean]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:474)
[ShipBean]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:482)
[ShipBean]      at org.jnp.server.NamingServer.getObject(NamingServer.java:488)
[ShipBean]      at org.jnp.server.NamingServer.lookup(NamingServer.java:254)
[ShipBean]      at org.jnp.server.NamingServer.lookup(NamingServer.java:257)

I must still be missing something.  Here is the java code that I am using

Connection con = null;
       PreparedStatement ps = null;
       try {
         con = this.getConnection();
         ps = con.prepareStatement(
          "insert into Ship (id, name, capacity, tonnage) " +
          "values (?,?,?,?)");
         ps.setInt(1, id);
         ps.setString(2, name);
         ps.setInt(3, capacity);
         ps.setDouble(4, tonnage);
.......
// here is the connection method....maybe the problem is here....
private Connection getConnection() throws SQLException {
     try {
       Context jndiCntx = new InitialContext();
       DataSource ds =
           (DataSource)jndiCntx.lookup("java:comp/env/jdbc/mySQLDB");
       return ds.getConnection();
     }
     catch (NamingException ne) {
       throw new EJBException(ne);
     }
   }

Thanks again for your help!

Thanks Tim!

I appreciate your help.   Here is what my jboss.jcml JDBC section now looks like, after following your suggestion.

<!-- JDBC -->
 <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
    <attribute name="Drivers">org.gjt.mm.mysql.Driver</attribute>
 </mbean>
<mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=mySQLDB">
   <attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
   <attribute name="PoolName">mySQLDS</attribute>
   <attribute name="URL">jdbc:mysql://165.121.243.05/test</attribute>
   <attribute name="JDBCUser" />
   <attribute name="Password" />
   </mbean>

The problem is that when I start JBOSS now, it hangs when the following appears on the log....

[InstantDB] Starting
[InstantDB] XA Connection pool InstantDB bound to java:/InstantDB
It does not continue after this point.Is there somewhere besides jboss.jcml that I must look?

my CMP beans continue to work but my BMP bean test is now giving the following message...

[ShipBean] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
       javax.ejb.EJBException
[ShipBean] javax.naming.NameNotFoundException: jdbc not bound
[ShipBean]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:474)
[ShipBean]      at org.jnp.server.NamingServer.getBinding(NamingServer.java:482)
[ShipBean]      at org.jnp.server.NamingServer.getObject(NamingServer.java:488)
[ShipBean]      at org.jnp.server.NamingServer.lookup(NamingServer.java:254)
[ShipBean]      at org.jnp.server.NamingServer.lookup(NamingServer.java:257)

I must still be missing something.  Here is the java code that I am using

Connection con = null;
       PreparedStatement ps = null;
       try {
         con = this.getConnection();
         ps = con.prepareStatement(
          "insert into Ship (id, name, capacity, tonnage) " +
          "values (?,?,?,?)");
         ps.setInt(1, id);
         ps.setString(2, name);
         ps.setInt(3, capacity);
         ps.setDouble(4, tonnage);
.......
// here is the connection method....maybe the problem is here....
private Connection getConnection() throws SQLException {
     try {
       Context jndiCntx = new InitialContext();
       DataSource ds =
           (DataSource)jndiCntx.lookup("java:comp/env/jdbc/mySQLDB");
       return ds.getConnection();
     }
     catch (NamingException ne) {
       throw new EJBException(ne);
     }
   }

Thanks again for your help!

Reply via email to