TRANSACTION ROLLBACK EXCEPTION:null

Discussions

EJB programming & troubleshooting: TRANSACTION ROLLBACK EXCEPTION:null

  1. TRANSACTION ROLLBACK EXCEPTION:null (3 messages)

    Hi all,
    I am trying to use Composite primary key in CMP Beans With JBoss And Tomcat .When I call create method it gives me the following exception............

    Kindly suggest the reasons and solutions.

    server output.........
    [PIDETAIL] TRANSACTION ROLLBACK EXCEPTION:null
    Embedded Exception
    null; nested exception is:
            javax.ejb.EJBException: null
    Embedded Exception
    null
    [PIDETAIL] java.lang.NullPointerException
    [PIDETAIL] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEn
    tityCommand.java:111)
    [PIDETAIL] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersisten
    ceManager.java:128)
    [PIDETAIL] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManag
    er.java:231)
    [PIDETAIL] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:616)
    [PIDETAIL] at java.lang.reflect.Method.invoke(Native Method)
    [PIDETAIL] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContaine
    r.java:843)
    [PIDETAIL] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySync
    hronizationInterceptor.java:231)
    [PIDETAIL] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInt
    erceptor.java:154)
    [PIDETAIL] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor
    .java:108)
    [PIDETAIL] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)

    [PIDETAIL] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.
    java:307)
    [PIDETAIL] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
    [PIDETAIL] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.jav
    a:103)
    [PIDETAIL] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
    [PIDETAIL] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
    [PIDETAIL] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContai
    nerInvoker.java:370)
    [PIDETAIL] at java.lang.reflect.Method.invoke(Native Method)
    [PIDETAIL] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
    [PIDETAIL] at sun.rmi.transport.Transport$1.run(Transport.java:142)
    [PIDETAIL] at java.security.AccessController.doPrivileged(Native Method)
    [PIDETAIL] at sun.rmi.transport.Transport.serviceCall(Transport.java:139)
    [PIDETAIL] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:443)
    [PIDETAIL] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:6
    43)
    [PIDETAIL] at java.lang.Thread.run(Thread.java:484)


    And I am having such xml descriptors as follows

    This is my ejb-jar xml.......
    -----------------------------------ejb-jar.xml--------------------------------------------
    <ejb-jar>
        <enterprise-beans>
          <entity>
    <ejb-name>PIDETAIL</ejb-name>
    <home>examples.trial.detail.PIDetailHome</home>
    <remote>examples.trial.detail.PIDetail</remote>
    <ejb-class>examples.trial.detail.PIDetailBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>examples.trial.detail.PIDetailPK</prim-key-class>
    <reentrant>False</reentrant>
    ...................
    ...................

          </entity>
        </enterprise-beans>
        <assembly-descriptor>
          <container-transaction>
    <method>
    <ejb-name>PIDETAIL</ejb-name>
    <method-intf>Remote</method-intf>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
          </container-transaction>
        </assembly-descriptor>
      </ejb-jar>
    -------------------------------------------- --------------------------------------------

    And my jaws.xml file as follows ...................

    --------------------------------------------jaws.xml------------------------------------------
    <jaws>
         <datasource>java:/OraclePool</datasource>
       <enterprise-beans>
         <entity>
           <ejb-name>PIDETAIL</ejb-name>
           <table-name>PU_PO_DETAIL</table-name>
           <create-table>true</create-table>
        <cmp-field>
          <field-name>poNo</field-name>
          <column-name>PONO</column-name>
        </cmp-field>
        <cmp-field>
          <field-name>po_Srno</field-name>
          <column-name>PO_SRNO</column-name>
        </cmp-field>
        <cmp-field>
          <field-name>revision_No</field-name>
          <column-name>REVISION_NO</column-name>
        </cmp-field>
    ...................
    ...................

           <primkey-field>poNo</primkey-field>
           <primkey-field>po_Srno</primkey-field>
           <primkey-field>revision_No</primkey-field>
        </entity>
       </enterprise-beans>
     </jaws>
    -----------------------------------------------------
    Thease are my composite key.
    PoNo, po_Srno, revision_No.

     ---------------------------PK class ---------------
    package examples.trial.detail;
    import java.io.*;
    public class PIDetailPK implements Serializable
    {
    public String poNo;//fk
    public int po_Srno; //pk
    public int revision_No;//fk

    public PIDetailPK()
    {
    }
    public PIDetailPK(String poNo,int po_Srno,int revision_No)
    {
    this.poNo = poNo;
    this.po_Srno = po_Srno;
    this.revision_No = revision_No;
    }
    public boolean equals(Object ThisKey)
    {
    if( ThisKey == null | | !(ThisKey instanceof PIDetailPK) )
    return false ;
    PIDetailPK pk = (PIDetailPK)ThisKey ;
    if( (this.poNo.equals(pk.poNo)) && (this.revision_No == pk.revision_No) && (this.po_Srno == pk.po_Srno))
    return true ;
    return false ;
    }
    public int hashCode()
    {
    return ((this.toString()).hashCode()) ;
    }
    public String toString()
    {
    StringBuffer sb = new StringBuffer();
    sb.append(poNo);
    sb.append(revision_No);
    sb.append(po_Srno);
    return (sb.toString());
    }
    }
    *************************************** **************

  2. Hi,

    It would help if you posted your ejbCreate() method in your bean...

    Joost.
  3. Hi
    This is my Create Method
      public PIDetailPK ejbCreate(String poNo, int po_Srno ,int revision_No,String item_cd ,String po_Item_Spec ,double po_Rate,double po_Qty,double bal_Po_Qty, String uom_Cd,String validity_Detail )
        throws CreateException
      {


        this.poNo = poNo;
        this.po_Srno = po_Srno;
        this.revision_No = revision_No;
        this.item_cd = item_cd;
        this.po_Item_Spec = po_Item_Spec;
        this.po_Rate = po_Rate;
        this.po_Qty = po_Qty;
        this.bal_Po_Qty = bal_Po_Qty;
        this.uom_Cd = uom_Cd;
        this.validity_Detail= validity_Detail;

    PIDetailPK aa=new PIDetailPK( poNo, po_Srno, revision_No);
        return aa;
        
      }

      public void ejbPostCreate(String poNo, int po_Srno ,int revision_No,String item_cd ,String po_Item_Spec ,double po_Rate,double po_Qty,double bal_Po_Qty, String uom_Cd,String validity_Detail )
      {
        log("PIDetailBean.ejbPostCreate ");
      }

    Waiting for reply
    Regards Gajanan
  4. He Gajanan,

    I looked it up for you and this is the line in jboss that gives the null-pointer:

    id = jawsEntity.getPrimaryKeyClass().newInstance();

    so it is very likely that the getPrimaryKeyClass() method gives back a null object..

    The differences I see with your code/descriptors and mine that use PK classes is that you define

    <primkey-field>poNo</primkey-field>
           <primkey-field>po_Srno</primkey-field>
           <primkey-field>revision_No</primkey-field>

    in jaws.xml.. maybe this screws jaws up.. i will look a bit further, in the mean time you can try removing these lines..

    good luck,

    Joost.