Hello,
 
I am using the O'Reilly book to familiarize with EJB.  I am using JBOSS 2.2.1 with Tomcat 3.2.1.  I am able to get CMP beans to work using MySQL without a problem however when I try to insert a row using BMP I get the following message..
 
Table not found: TEST.SHIP in statement [insert into test.Ship (id, name, capacity, tonnage) values (4,'UtopiaBMP',4500,8939.0)]

The table is there.  I am using MySQL but I have a feeling that JBOSS is trying to write to InstantDB or Hypersonic.  I have included configuration files below.
I have reviewed the archives but still can't figure it out.  What have I missed? 
 
 
 
 
[ShipBean] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
        javax.ejb.EJBException
[ShipBean] java.sql.SQLException: Table not found: TEST.SHIP in statement [insert into test.Ship (id, name, capacity, tonnage) values (4,'UtopiaBMP',4500,8939.
0)]
[ShipBean]      at org.hsql.Trace.getError(Trace.java:124)
[ShipBean]      at org.hsql.Result.<init>(Result.java:70)
[ShipBean]      at org.hsql.jdbcConnection.executeHSQL(jdbcConnection.java:644)
[ShipBean]      at org.hsql.jdbcConnection.execute(jdbcConnection.java:540)
[ShipBean]      at org.hsql.jdbcStatement.fetchResult(jdbcStatement.java:499)
[ShipBean]      at org.hsql.jdbcStatement.executeUpdate(jdbcStatement.java:52)
[ShipBean]      at org.hsql.jdbcPreparedStatement.executeUpdate(jdbcPreparedStatement.java:114)
[ShipBean]      at org.opentools.minerva.jdbc.PreparedStatementInPool.executeUpdate(PreparedStatementInPool.java:82)
[ShipBean]      at com.titan.shipbmp.ShipBean.ejbCreate(ShipBean.java:48)
[ShipBean]      at java.lang.reflect.Method.invoke(Native Method)
[ShipBean]      at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:121)
[ShipBean]      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:441)
[ShipBean]      at java.lang.reflect.Method.invoke(Native Method)
[ShipBean]      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:639)
[ShipBean]      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:160)
[ShipBean]      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:87)
 
JNDI Code within the bean
  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);
      }
    }
 
JDBC section of jboss.jcml
 
  <!-- JDBC -->
  <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
    <attribute name="Drivers">org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver,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>
 
ejb-jar.xml
 
<?xml version="1.0"?>
 
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">
 
<ejb-jar>
 <enterprise-beans>
   <entity>
      <description>
            This bean represents a cruise ship.
      </description>
      <ejb-name>ShipBean</ejb-name>
      <home>com.titan.shipbmp.ShipHome</home>
      <remote>com.titan.shipbmp.Ship</remote>
      <ejb-class>com.titan.shipbmp.ShipBean</ejb-class>
      <persistence-type>Bean</persistence-type>
      <prim-key-class>com.titan.shipbmp.ShipPK</prim-key-class>
      <reentrant>False</reentrant>
 
      <resource-ref>
           <description>DataSource for the Titan database</description>
           <res-ref-name>jdbc/mySQLDB</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
   </resource-ref>
 
  </entity>
 </enterprise-beans>
 
 <assembly-descriptor>
   <security-role>
      <description>
         This role represents everyone who is allowed full access
         to the Ship bean.
      </description>
     <role-name>everyone</role-name>
   </security-role>
 
   <method-permission>
     <role-name>everyone</role-name>
     <method>
         <ejb-name>ShipBean</ejb-name>
         <method-name>*</method-name>
     </method>
   </method-permission>
 
   <container-transaction>
     <method>
        <ejb-name>ShipBean</ejb-name>
        <method-name>*</method-name>
     </method>
     <trans-attribute>Required</trans-attribute>
   </container-transaction>
 </assembly-descriptor>
</ejb-jar>
 
jboss.xml
 
<entity>
      <ejb-name>ShipBean</ejb-name>
      <resource-ref>
            <res-ref-name>jdbc:/mySQLDB</res-ref-name>
            <resource-name>java:/mySQLDB</resource-name>
      </resource-ref>
</entity>
 

 

Reply via email to