Hello,

I'm running the june 9th - jBoss-2.2.2-Tomcat-3.2.2 build
I developped a BMP EntityBean , and the following occurs :

The war and the jar files get deployed , i can call the ejbCreate
without a problem and the
data gets inserted into the database, but any call to the
ejbFindByPrimaryKey or to the findAll
gives me an ObjectNotFoundException
the relevant files have been added below, can anybody tell me what could
me the reason ?
thanks

Werner

 [2001-06-22 23:23:35,558] DEBUG Auto deploy root - Bound VtsTestBean to
vts/test
 [2001-06-22 23:23:35,588] INFO Auto deploy root - Deployed application:
file:/C:/jBoss-2.2.2/jboss/tmp/deploy/Default/vts.jar/
 [2001-06-22 23:23:35,598] INFO Auto deploy root - J2EE application:
file:/C:/jBoss-2.2.2/jboss/deploy/vts.jar is deployed.
 [2001-06-22 23:24:05,391] DEBUG Thread-17 Log4jService - In TestForm
constructor
 [2001-06-22 23:24:05,391] DEBUG Thread-17 Log4jService - In TestForm
reset
 [2001-06-22 23:24:05,481] DEBUG Thread-17 Log4jService - Entering
TestAction perform
 [2001-06-22 23:24:05,601] DEBUG Thread-17 Log4jService - obtained home
to VtsTestBean
 [2001-06-22 23:24:05,651] DEBUG Thread-17 Log4jService - created
vtsTestBean
 [2001-06-22 23:24:23,577] DEBUG Thread-16 Log4jService - In TestForm
reset
 [2001-06-22 23:24:23,577] DEBUG Thread-16 Log4jService - Entering
TestAction perform
 [2001-06-22 23:24:23,627] DEBUG Thread-16 Log4jService - obtained home
to VtsTestBean
 [2001-06-22 23:24:23,647] ERROR Thread-16 root - TRANSACTION ROLLBACK
EXCEPTION:null; nested exception is:
 javax.ejb.EJBException
 [2001-06-22 23:24:23,647] ERROR Thread-16 root -
javax.ejb.ObjectNotFoundException: Failed to find VtsTestBean in
database
 [2001-06-22 23:24:23,647] ERROR Thread-16 root -  at
com.mazda.ejb.test.VtsTestBean.ejbFindByPrimaryKey(VtsTestBean.java:113)

 [2001-06-22 23:24:23,647] ERROR Thread-16 root -  at
java.lang.reflect.Method.invoke(Native Method)
 [2001-06-22 23:24:23,647] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.BMPPersistenceManager.callFinderMethod(BMPPersistenceManager.java:458)

 [2001-06-22 23:24:23,657] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.BMPPersistenceManager.findEntity(BMPPersistenceManager.java:211)

 [2001-06-22 23:24:23,657] ERROR Thread-16 root -  at
org.jboss.ejb.EntityContainer.find(EntityContainer.java:419)
 [2001-06-22 23:24:23,657] ERROR Thread-16 root -  at
java.lang.reflect.Method.invoke(Native Method)
 [2001-06-22 23:24:23,657] ERROR Thread-16 root -  at
org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:639)

 [2001-06-22 23:24:23,657] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:160)

 [2001-06-22 23:24:23,667] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:87)

 [2001-06-22 23:24:23,667] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)

 [2001-06-22 23:24:23,667] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:263)

 [2001-06-22 23:24:23,667] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)

 [2001-06-22 23:24:23,667] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:164)

 [2001-06-22 23:24:23,677] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)

 [2001-06-22 23:24:23,677] ERROR Thread-16 root -  at
org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316)
 [2001-06-22 23:24:23,687] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:369)

 [2001-06-22 23:24:23,687] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:423)

 [2001-06-22 23:24:23,687] ERROR Thread-16 root -  at
org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:212)

 [2001-06-22 23:24:23,687] ERROR Thread-16 root -  at
$Proxy5.findByPrimaryKey(Unknown Source)
 [2001-06-22 23:24:23,697] ERROR Thread-16 root -  at
com.mazda.struts.TestAction.perform(TestAction.java:72)
 [2001-06-22 23:24:23,707] ERROR Thread-16 root -  at
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1726)

 [2001-06-22 23:24:23,707] ERROR Thread-16 root -  at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1536)
 [2001-06-22 23:24:23,707] ERROR Thread-16 root -  at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
 [2001-06-22 23:24:23,707] ERROR Thread-16 root -  at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
 [2001-06-22 23:24:23,707] ERROR Thread-16 root -  at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 [2001-06-22 23:24:23,717] ERROR Thread-16 root -  at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)

 [2001-06-22 23:24:23,717] ERROR Thread-16 root -  at
org.apache.tomcat.core.Handler.service(Handler.java:287)
 [2001-06-22 23:24:23,717] ERROR Thread-16 root -  at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
 [2001-06-22 23:24:23,717] ERROR Thread-16 root -  at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)

 [2001-06-22 23:24:23,717] ERROR Thread-16 root -  at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
 [2001-06-22 23:24:23,727] ERROR Thread-16 root -  at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)

 [2001-06-22 23:24:23,727] ERROR Thread-16 root -  at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)

 [2001-06-22 23:24:23,727] ERROR Thread-16 root -  at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)

 [2001-06-22 23:24:23,727] ERROR Thread-16 root -  at
java.lang.Thread.run(Unknown Source)
 [2001-06-22 23:24:23,737] ERROR Thread-16 root -
javax.transaction.TransactionRolledbackException: null; nested exception
is:
 javax.ejb.EJBException
 [2001-06-22 23:24:23,747] ERROR Thread-16 root - javax.ejb.EJBException

 [2001-06-22 23:24:23,747] ERROR Thread-16 root -  <<no stack trace
available>>

ejb-jar.xml
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!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>
            <ejb-name>VtsTestBean</ejb-name>
            <home>com.mazda.ejb.test.VtsTestHome</home>
            <remote>com.mazda.ejb.test.VtsTest</remote>
            <ejb-class>com.mazda.ejb.test.VtsTestBean</ejb-class>
            <persistence-type>Bean</persistence-type>

<prim-key-class>com.mazda.ejb.test.VtsTestPK</prim-key-class>
            <reentrant>False</reentrant>
            <resource-ref>
               <description>description</description>
               <res-ref-name>jdbc/VtsDb</res-ref-name>
               <res-type>javax.sql.DataSource</res-type>
               <res-auth>Container</res-auth>
            </resource-ref>
         </entity>
      </enterprise-beans>
      <assembly-descriptor>
         <container-transaction>
            <method>
               <ejb-name>VtsTestBean</ejb-name>
               <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
         </container-transaction>
      </assembly-descriptor>
   </ejb-jar>

jaws.xml
---------
<?xml version="1.0" encoding="Cp1252"?>

<jaws>
     <datasource>java:/SQLDS</datasource>
     <type-mapping>Hypersonic SQL</type-mapping>
     <type-mappings>
        <type-mapping>
            <name>Hypersonic SQL</name>
            <mapping>
                <java-type>java.lang.Byte</java-type>
                <jdbc-type>SMALLINT</jdbc-type>
                <sql-type>SMALLINT</sql-type>
            </mapping>
            <mapping>
                <java-type>java.util.Date</java-type>
                <jdbc-type>DATE</jdbc-type>
                <sql-type>DATE</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Boolean</java-type>
                <jdbc-type>BIT</jdbc-type>
                <sql-type>BIT</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Integer</java-type>
                <jdbc-type>INTEGER</jdbc-type>
                <sql-type>INTEGER</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Object</java-type>
                <jdbc-type>JAVA_OBJECT</jdbc-type>
                <sql-type>OBJECT</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Short</java-type>
                <jdbc-type>SMALLINT</jdbc-type>
                <sql-type>SMALLINT</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Character</java-type>
                <jdbc-type>CHAR</jdbc-type>
                <sql-type>CHAR</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.String</java-type>
                <jdbc-type>VARCHAR</jdbc-type>
                <sql-type>VARCHAR(256)</sql-type>
            </mapping>
            <mapping>
                <java-type>java.sql.Timestamp</java-type>
                <jdbc-type>TIMESTAMP</jdbc-type>
                <sql-type>TIMESTAMP</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Float</java-type>
                <jdbc-type>REAL</jdbc-type>
                <sql-type>REAL</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Long</java-type>
                <jdbc-type>BIGINT</jdbc-type>
                <sql-type>BIGINT</sql-type>
            </mapping>
            <mapping>
                <java-type>java.lang.Double</java-type>
                <jdbc-type>DOUBLE</jdbc-type>
                <sql-type>DOUBLE</sql-type>
            </mapping>
        </type-mapping>
     </type-mappings>
    <enterprise-beans>
 <entity>
 <ejb-name>VtsTestBean</ejb-name>
 <table-name>VTSTESTBEAN</table-name>
 <create-table>true</create-table>
 <remove-table>false</remove-table>
 <tuned-updates>true</tuned-updates>
 <read-only>false</read-only>
 <time-out>100</time-out>
 </entity>
    </enterprise-beans>
   </jaws>


jboss.xml
----------
<?xml version="1.0" encoding="Cp1252"?>

<jboss>
     <secure>false</secure>
     <container-configurations />
     <resource-managers />
     <enterprise-beans>
       <entity>
  <ejb-name>VtsTestBean</ejb-name>
  <jndi-name>vts/test</jndi-name>
  <configuration-name></configuration-name>
       </entity>
     </enterprise-beans>
   </jboss>

VtsTestBean.java
------------------
/* Generated by Together */

package com.mazda.ejb.test;

import javax.ejb.*;
import java.rmi.RemoteException;
import java.sql.*;

import org.apache.log4j.*;
import com.mazda.util.*;
import java.util.*;

/**
 * @ejbHome <{com.mazda.ejb.test.VtsTestHome}>
 * @ejbRemote <{com.mazda.ejb.test.VtsTest}>
 * @ejbPrimaryKey <{com.mazda.ejb.test.VtsTestPK}>
 * @ejbTransactionAttribute Required*/
public class VtsTestBean implements EntityBean {
    private EntityContext ctx;
    public int id;
    public String name;
    public String value;
    private static Category cat = LoggingUtil.getLog4JavaCategory();

    public void setEntityContext(EntityContext context) throws
RemoteException, EJBException {
        ctx = context;
    }

    public void unsetEntityContext() throws RemoteException,
EJBException {
        ctx = null;
    }

    public void ejbActivate() throws RemoteException, EJBException {
    }

    public void ejbPassivate() throws RemoteException, EJBException {
    }

    public void ejbRemove() throws RemoteException, EJBException {
   Connection con = null;
            ResultSet rs = null;
   try {
             con = DataSourceUtil.getConnection();
                PreparedStatement stmt = con.prepareStatement("DELETE
FROM VTSTESTBEAN WHERE id = ? ");
                stmt.setInt(1,id);
                if (stmt.executeUpdate() != 1){
                    throw new EJBException("ejbRemove ");
                }
                stmt.close();

            } catch(Exception e) {
                throw new EJBException(e);
            } finally {
                    DataSourceUtil.dropConnection(con);
            }
    }

    public void ejbStore() throws RemoteException, EJBException {
   Connection con = null;
            ResultSet rs = null;
   try {
             con = DataSourceUtil.getConnection();
                PreparedStatement stmt = con.prepareStatement("UPDATE
VTSTESTBEAN set value = ? WHERE id = ? AND name = ? ");
                stmt.setString(1,value);
                stmt.setInt(2,id);
                stmt.setString(3,name);
                if (stmt.executeUpdate() != 1){
                    throw new EJBException("ejbStore ");
                }
                stmt.close();

            } catch(Exception e) {
                throw new EJBException(e);
            } finally {
                    DataSourceUtil.dropConnection(con);
            }
    }

    public void ejbLoad() throws RemoteException, EJBException {
   VtsTestPK pk = (VtsTestPK)ctx.getPrimaryKey();
   Connection con = null;
            ResultSet rs = null;
   try {
             con = DataSourceUtil.getConnection();
                PreparedStatement stmt = con.prepareStatement("SELECT
id, name, value FROM VTSTESTBEAN WHERE id = ? AND name = ? ");
                stmt.setInt(1,pk.id);
                stmt.setString(2,pk.name);
                rs = stmt.executeQuery();
                if (rs.next()){
                    this.id = rs.getInt(1);
                    this.name = rs.getString(2);
                    this.value = rs.getString(3);
                } else {
                    throw new ObjectNotFoundException("Failed to find
VtsTestBean in database ");
                }
                stmt.close();

            } catch(Exception e) {
                throw new EJBException(e);
            } finally {
                    DataSourceUtil.dropConnection(con);
            }
    }

    public VtsTestPK ejbFindByPrimaryKey(VtsTestPK pk) throws
FinderException, EJBException{
            // Write your code here
            cat.debug("in ejbFindByPrimaryKey");
   Connection con = null;
   try {
             con = DataSourceUtil.getConnection();
                PreparedStatement stmt = con.prepareStatement("SELECT id
FROM VTSTESTBEAN WHERE id = ? AND name = ? ");
                stmt.setInt(1,pk.id);
                stmt.setString(2,pk.name);
                cat.debug("id = " + pk.id + " name = " + name);
                if (stmt.executeUpdate() != 1){
                    throw new ObjectNotFoundException("Failed to find
VtsTestBean in database ");
                }
                stmt.close();
            } catch(Exception e) {
                throw new EJBException(e);
            } finally {
                    DataSourceUtil.dropConnection(con);
            }
            return pk;
        }

    public int getId(){ return id; }

    public void setId(int param){ this.id = param; }

    public String getName(){ return name; }

    public void setName(String param){ this.name = param; }

    public String getValue(){ return value; }

    public void setValue(String param){ this.value = param; }

    public VtsTestPK ejbCreate(int param, String name, String value)
throws CreateException, EJBException, RemoteException, SQLException {
            // Write your code here
            this.id = param;
            this.name = name;
            this.value = value;
            Connection con = null;
   try {
             con = DataSourceUtil.getConnection();
                PreparedStatement stmt = con.prepareStatement("INSERT
INTO VTSTESTBEAN(id, name, value) VALUES (?,?,?)");
                stmt.setInt(1,param);
                stmt.setString(2,name);
                stmt.setString(3,value);
                if (stmt.executeUpdate() != 1){
                    throw new CreateException("Failed to create
VtsTestBean into database");
                }
                stmt.close();
                VtsTestPK vtsTestPk = new VtsTestPK(param, name);
                return vtsTestPk;
            } catch(SQLException e) {
                throw new EJBException(e);
            } finally {
                    DataSourceUtil.dropConnection(con);
            }
        }

    public void ejbPostCreate(int param, String name, String value)
throws CreateException, EJBException, RemoteException, SQLException {
            // Write your code here
        }

    public Collection ejbFindAll() throws EJBException, FinderException
{
   Connection con = null;
            ResultSet rs = null;
            Vector result = null;
   try {
             con = DataSourceUtil.getConnection();
                PreparedStatement stmt = con.prepareStatement("SELECT
id, name FROM VTSTESTBEAN ");
                rs = stmt.executeQuery();
                if (rs.next()){
                    this.id = rs.getInt(1);
                    this.name = rs.getString(2);
                    //this.value = rs.getString(3);
                    VtsTestPK pk = new VtsTestPK(id, name);
                    result.add(pk);
                } else {
                    throw new ObjectNotFoundException("Failed to find
VtsTestBean in database ");
                }
                stmt.close();

            } catch(Exception e) {
                throw new EJBException(e);
            } finally {
                    DataSourceUtil.dropConnection(con);
            }
            return result;
        }
}

VtstTest.java
-------------
package com.mazda.ejb.test;

import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import javax.ejb.EJBException;

public interface VtsTest extends EJBObject {
    int getId() throws RemoteException, EJBException;

    void setId(int param) throws RemoteException, EJBException;

    String getName() throws RemoteException, EJBException;

    void setName(String param) throws RemoteException, EJBException;

    String getValue() throws RemoteException, EJBException;

    void setValue(String param) throws RemoteException, EJBException;
}

VtsTestHome.java
-------------------
package com.mazda.ejb.test;

import javax.ejb.EJBHome;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import java.rmi.RemoteException;
import java.sql.SQLException;
import javax.ejb.FinderException;
import java.util.Collection;

public interface VtsTestHome extends EJBHome {
    VtsTest findByPrimaryKey(VtsTestPK pk) throws FinderException,
RemoteException, EJBException;

VtsTest create(int param, String name, String value) throws
CreateException, EJBException, RemoteException, SQLException;

    Collection findAll() throws EJBException, RemoteException,
FinderException;

    /** @link dependency */
    /*#VtsTestBean lnkEntity1Bean;*/
}

VtsTestPK.java
----------------
package com.mazda.ejb.test;

import java.io.Serializable;

public class VtsTestPK implements Serializable {
    public int id;
    public String name;

    public VtsTestPK() {
    }

    public VtsTestPK(int id, String name) {
        this.id = id;
        this.name = name;
    }

    public int hashCode() {
        return ((name + id).hashCode());
    }

    public boolean equals(Object other) {
        VtsTestPK otherPk = (VtsTestPK)other;
        return ((this.name.equals(otherPk.name)) && (this.id ==
otherPk.id));
    }

}

--
-----------------------------------------------------------------------
crypto : One who covertly supports a certain doctrine, group, or party.
<mailto: [EMAIL PROTECTED]>  <http://www.shiftat.com>
-----------------------------------------------------------------------



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to