Can CMT Session Bean call BMP Entity Bean in WebLogic 6.0?

          Hi
          Does anybody successfully use CMT Session Bean calling BMP +CMT Entity bean in
          WebLogic6.0? I have the following problem.
          Any idea will be appreciated.
          --Winston
          Let's say we have a Session bean SB, it uses container to manage the transaction.
          A method of SB will call an Entity Bean EB which adopts bean-managed persistence.
          Both SB and EB use CMT and all of their methods use "required" in the descriptor
          file.
          1. If the connection con.getAutoCommit() is true in the EB, then the transaction
          within SB cannot be rolled back as the ejbCreate() has already commit into the
          database.
          2. On the other hand if Connecton of EB con.getAutoCommit() is false, then container
          cannot successfully commit the transaction from SB's method, as EjbCreate and
          EjbStore() in EB are likely using the different database connections, which causes
          EbjStore() fail and the following error message will be sent to the Console:
          ============================================================
          "<Jul 9, 2001 4:16:48 PM PDT> <Error> <EJB> <Exception during commit of transacti
          on transaction=(IdHash=7738920,Name = [EJB TraderBeanImpl.buy()],Xid=105:5e6719a
          ded42e332,Status=Rolled back. [Reason = weblogic.utils.NestedRuntimeException:
          E
          rror writing from beforeCompletion - with nested exception:
          [java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
          xception: ejbStore: AccountBean (4003) not updated]],numRepliesOwedMe=0,numRepli
          esOwedOthers=0,seconds since begin=0,seconds left=30,SCInfo[examplesServer]=(sta
          te=rolledback),properties=({weblogic.transaction.name=[EJB TraderBeanImpl.buy()]
          })): java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEnt
          ityException: ejbStore: AccountBean (4003) not updated
          at weblogic.ejb20.internal.EJBRuntimeUtils.throwRemoteException(EJBRunti
          meUtils.java:57)
          at weblogic.ejb20.manager.DBManager.beforeCompletion(DBManager.java:364)
          at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManag
          er.java:211)
          at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
          erSCInfo.java:511)
          at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
          rverSCInfo.java:78)
          at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
          dChain(ServerTransactionImpl.java:893)
          at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
          ServerTransactionImpl.java:1229)
          at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
          sactionImpl.java:168)
          at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
          01)
          at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
          mpl.java:37)
          at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
          derBeanEOImpl_WLSkel.java:76)
          at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
          va:373)
          at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
          va:237)
          at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
          andler.java:118)
          at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
          .java:17)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          --------------- nested within: ------------------
          weblogic.utils.NestedRuntimeException: Error writing from beforeCompletion - wit
          h nested exception:
          [java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
          xception: ejbStore: AccountBean (4003) not updated]
          at weblogic.ejb20.internal.TxManager$TxListener.beforeCompletion(TxManag
          er.java:220)
          at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(Serv
          erSCInfo.java:511)
          at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(Se
          rverSCInfo.java:78)
          at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAn
          dChain(ServerTransactionImpl.java:893)
          at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(
          ServerTransactionImpl.java:1229)
          at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
          sactionImpl.java:168)
          at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
          01)
          at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
          mpl.java:37)
          at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
          derBeanEOImpl_WLSkel.java:76)
          at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
          va:373)
          at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
          va:237)
          at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
          andler.java:118)
          at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
          .java:17)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          --------------- nested within: ------------------
          weblogic.transaction.RollbackException: Unexpected exception in beforeCompletion
          : sync = weblogic.ejb20.internal.TxManager$TxListener@356eb0
          Error writing from beforeCompletion - with nested exception:
          [weblogic.utils.NestedRuntimeException: Error writing from beforeCompletion -
          wi
          th nested exception:
          [java.rmi.NoSuchObjectException: Exception from ejbStore:javax.ejb.NoSuchEntityE
          xception: ejbStore: AccountBean (4003) not updated]]
          at weblogic.transaction.internal.TransactionImpl.throwRollbackException(
          TransactionImpl.java:1261)
          at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTran
          sactionImpl.java:218)
          at weblogic.ejb20.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:2
          01)
          at examples.ejb.basic.statefulSession.TraderBeanEOImpl.buy(TraderBeanEOI
          mpl.java:37)
          at examples.ejb.basic.statefulSession.TraderBeanEOImpl_WLSkel.invoke(Tra
          derBeanEOImpl_WLSkel.java:76)
          at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
          va:373)
          at weblogic.rmi.internal.BasicServerAdapter.invoke(BasicServerAdapter.ja
          va:237)
          at weblogic.rmi.internal.BasicRequestHandler.handleRequest(BasicRequestH
          andler.java:118)
          at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
          .java:17)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
          >"
          

We did receive a 4.5.1 / 5.1 interoperability patch - but it wasn't quite 'seamless'.
We never tried to use it.
SOAP? Isn't that around 50 times slower than RMI?
Mike
"Gary Mui" <[email protected]> wrote:
We ran into this issue last fall and got some feedback from weblogic
support. They originally said that it could be done (as well as different
versions talking to one another via JMS) but it turned out that they
were
incorrect and ended up saying that it is not possible. Before 6.0 went
GA,
BEA said that there would be a interoperability patch to do this, but
I've
never seen nor heard of anything regarding it. As a workaround, we
implemented 4.5.1 / 6.0 communication via SOAP.
Mike Reiche wrote in message <3b1bcaec$[email protected]>...
I have the same question - and more. Last year we were told that wecould
not use
RMI (and ejbs) between 4.5.1 and 5.1. Which seems kinda weird becauseI've
heard
of people using WL ejbs from Tomcat. This issue has caused us to avoidusing
WL ejbs in any future development which has any chance of ever beingused
by any
app server (WL included) that is not under the direct control of thedata
center.
I've been trying to convince the Architecture team here that we canuse WL
EJBs
and we can call them from other app servers - but can't seem to getany
supporting
statement from BEA (maybe I haven't tried hard enough).
Anyway, a response from BEA would be appreciated.
- Mike
"Madhu K" <[email protected]> wrote:
Is it possible to call a (stateless session) bean deployed in weblogic
6.0
from a bean in weblogic 5.1? I have two versions of weblogic running
on two
different hosts and I have to call a bean that is running in 6.0 from
5.1.
Are there any limitations?
Appreciate any feedback/suggestions.
Thanks,
Madhu

Similar Messages

  • Can't get BMP Entity Bean Instance!!

    Hello
    I have created a BMP Entity bean, and put on the findPrimaryKey method this code:
    try {
    context = new InitialContext();
    DataSource ds = (DataSource) context.lookup(nombreConexion);
    conn = ds.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery("select count(upc) from musiccdejb where upc='"+ primaryKey +"'");
    if (rs!=null && rs.next()) {    
    countNumber = rs.getInt(1);
    if (countNumber!=1) {
    throw new Exception();
    catch (SQLException e) {
    System.out.println("Error ejbFindPrimaryKey"+e);
    catch (Exception e1) {
    System.out.println("Otro error ejbFindPrimaryKey"+e1);
    Everything there seem to be ok, because the select return 1, so the primary key exist, but after that the container doesn't get the information for this entity bean, everything is null when I tried to acces the information.
    Context ctx = new InitialContext();
    MusicCDBMPHome musicCDHome = (MusicCDBMPHome)ctx.lookup("java:comp/env/ejb/MusicCDBMP");
    boolean found = false;
    try {
    musicCDObj = musicCDHome.findByPrimaryKey("1");
    found = true;
    } catch (Exception e) {
    found = false;
    if (found) {
    out.println(musicCDObj.getUpc());
    out.println(musicCDObj.getTitle());
    Please help me, I am working with JDeveloper 9i Release 2 and OC4J Standalone version 9.0.2.
    Ana Maria

    Yes, I alredy did that, and this is te content of my ejbLoad:
    String upc = (String)entityContext.getPrimaryKey();
    ResultSet rs = null;
    try {
    context = new InitialContext();
    DataSource ds = (DataSource) context.lookup(nombreConexion);
    conn = ds.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery("select count(upc) from musiccdejb where upc='"+ upc +"'");
    if (rs!=null && rs.next()) {
    if (rs.getInt(1)!=1) {
    throw new Exception();
    catch (SQLException e) {
    System.out.println("Error ejbLoad"+e);
    catch (Exception e1) {
    System.out.println("Otro error ejbLoad"+e1);
    Another suggestion??
    Thanks
    Ana Maria

  • Deploying BMP Entity Bean with primary key calss

    Hi,
    I am using EJB 2.0 with and websphere studio 5.0 and database is sql server 2000.
    My BMP Entity bean has a primary key class.From my client I am invoking the Entity Bean by calling it's findbyprimarykey method.
    The home interface of my findbyprimarykey method returns a class of type Remote.But in the Entity Bean class,the return type is the primarykey class type.
    My problem is invoking this findbyprimarykey from the client to get the remote interface so that the other business methods of the entity bean can be called.
    The control goes into the ejbFindbyPrimaryKey but when it is returing from the Entity Bean class,it gives a remote exception (as the return type in Entity Bean class and Home interface are different for the findbyprimarykey method).
    I think that somewhere in the deployment decriptor in my websphere,i have to specify the primarykey class type,which i am missing out and hence getting the error.
    Please help me out with your advice and solution.
    Thanks
    Rahul Priyadarshi

    Hi,
    Sorry to disturb you again.
    Even my code is also almost the same....i am pasting the code below...Please go through it and let me know if I have made any mistake..
    EditVendorEntityBean.....(Bean Class)
    package code.beans.EditVendor;
    import code.beans.dataAccess.*;
    import javax.ejb.CreateException;
    import javax.ejb.RemoveException;
    import javax.ejb.EntityBean;
    import javax.ejb.EntityContext;
    import javax.ejb.EJBException;
    import javax.ejb.FinderException;
    import javax.ejb.ObjectNotFoundException;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import java.sql.*;
    import javax.sql.*;
    import java.util.*;
    * Bean implementation class for Enterprise Bean: EditVendorEntity
    public class EditVendorEntityBean implements javax.ejb.EntityBean {
         private static Hashtable dataSources = new Hashtable();
         private String username;
    private int Vendor_ID;
    private int Category_Id;
    private String Category_Name;
    private String Vendor_Name;
    private String Vendor_Address1;
    private String Vendor_Address2;
    private String Contact_Name;
    private String Home_Phone;
    private String Work_Phone;
    private String email;
    private String faxno;
    private String userloginname;
    private boolean dirtyFlag = false;
    private EntityContext context;
    private static final String DS_NAME = "jdbc/spiPOPS";
    Connection con = null;
    Statement stmt = null;
    PreparedStatement st = null;
    ResultSet res = null;
         //***********************Business Methods*********************
    // Begin of Busines Methods
    public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax) {
              System.out.println("in setData where Vendor Id= "+ Vendor_ID);
                   boolean status=false;
                   boolean existing=false;
                   ArrayList cat=new ArrayList();
                   try
                        cat=getcategorylist(this.Vendor_ID);
                   catch(SQLException e)
                        System.out.println("Could not get category list");
                   System.out.println("Size of cat array -->" + cat.size() + " and string array size -->" + catname.length);
                   if(catname.length>0)
                        //Removing unwanted vendor categories for a particular vendor id
                        for(int i=0;i<cat.size();i++)
                                  existing=false;
                                  String tempdata=(String)cat.get(i);
                                  for(int j=0;j<catname.length;j++)
                                       if(tempdata.equals(catname[j]))
                                            existing=true;
                                  if(!existing)
                                       try
                                            delvencat(this.Vendor_ID,tempdata.trim());
                                       catch(SQLException e)
                                            System.out.println("Could not delete record in POPS_VENDOR_CATEGORY for -->" + tempdata);
                   //Adding new vendor categories for a particular vendor
                        try
                                  for(int i=0;i<catname.length;i++)
                                       status=false;
                                       String strcat=catname;
                                       status=checkcat(this.Vendor_ID,strcat.trim());
                                       if(!status)
                                            insertvencat(this.Vendor_ID,strcat.trim());
                        catch(SQLException e)
                                  System.out.println("Could not insert or select from POPS_VENDOR_CATEGORY table");
                   this.Vendor_Name          =vendorname;
              this.Vendor_Address1     =vendadd1;
              this.Vendor_Address2     =vendadd2;
              this.Contact_Name          =vendcontact;
              this.Work_Phone               =venoff;
              this.Home_Phone               =venres;
              this.email                    =mailid;
              this.faxno                    =venfax;
                   dirtyFlag = true;
                   System.out.println("Leaving set data method");
    public Vector getData() {
         Vector vctRec=new Vector();
         ArrayList arrdatas = new ArrayList();
         arrdatas.add(""+this.Vendor_ID);
         arrdatas.add(this.Vendor_Name);
         arrdatas.add(this.Vendor_Address1);
         arrdatas.add(this.Vendor_Address2);
         arrdatas.add(this.Contact_Name);
         arrdatas.add(this.Work_Phone);
         arrdatas.add(this.Home_Phone);
         arrdatas.add(this.email);
         arrdatas.add(this.faxno);
         vctRec.addElement(arrdatas);
         ArrayList cat=new ArrayList();
              try
              System.out.println("Calling getcategorylist from getdata with vendorid-->" + this.Vendor_ID);
              cat          = getcategorylist(this.Vendor_ID);
         catch(SQLException e)
                   System.out.println("Could not get datas for category list");
         vctRec.addElement(cat);
         ArrayList allcats=new ArrayList();
         try
                        allcats          = getallcategorylist();
              catch(SQLException e)
                        System.out.println("Could not get datas for category list");
         vctRec.addElement(allcats);
              dirtyFlag = false;
         System.out.println("Before return statement in getdata with vector size -->" + vctRec.size());
              return vctRec;
    // End of Business Methods
    //**************************Entity Bean Methods*******************************
         * ejbActivate
         public void ejbActivate() {
              Vendor_ID = Integer.parseInt((String)context.getPrimaryKey());
         System.out.println("Inside ejbActivate Vendor_ID-->"+ Vendor_ID);
         * ejbLoad
         public void ejbLoad() {
              System.out.println("Inside ejbLoad ********" );
    try {
    loadRow();
    }catch (Exception ex) {
              System.out.println("Failed in loadRow()");
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
         * ejbPassivate
         public void ejbPassivate() {
         System.out.println("Inside ejbPassivate " );
    Vendor_ID = 0;
         * ejbRemove
         public void ejbRemove() throws javax.ejb.RemoveException {
              //Empty Method
         * ejbStore
         public void ejbStore() {
    System.out.println("Inside ejbStore " );
    try {
    storeRow();
    }catch (Exception ex) {
              System.out.println("Exception thrown in storeRow" + ex.getMessage());
    throw new EJBException("ejbLoad: " +
    ex.getMessage());
         * getEntityContext
         public javax.ejb.EntityContext getEntityContext() {
              return context;
         * setEntityContext
         public void setEntityContext(javax.ejb.EntityContext ctx) {
              System.out.println("Inside setEntityContext " );
    try{
         con = getConnection(DS_NAME);
         System.out.println("DB Connection Created!!");
    catch(Exception e){
    this.context = ctx;
         * unsetEntityContext
         public void unsetEntityContext() {
    System.out.println("Inside unsetEntityContext " );
    closeDbConnection(con, res, st);
    this.context = null;
         * ejbCreate
         //code.beans.EditVendor.EditVendorEntityKey
         public code.beans.EditVendor.EditVendorEntityKey ejbCreate(String vendorid)
              throws javax.ejb.CreateException {          
              return new EditVendorEntityKey(vendorid);
              //return null;
         * ejbPostCreate
         public void ejbPostCreate(String vendorid) throws javax.ejb.CreateException {
              //Empty
         * ejbFindByPrimaryKey
         //code.beans.EditVendor.EditVendorEntityKey
         public code.beans.EditVendor.EditVendorEntityKey ejbFindByPrimaryKey(
              code.beans.EditVendor.EditVendorEntityKey primaryKey)
              throws javax.ejb.FinderException {
    try {
    if(selectByPrimaryKey(Integer.parseInt(primaryKey.getVendorId()))) {
              System.out.println("Leaving the findbyprimarykey method from the entity bean");
         return primaryKey;
         //return null;
    }else {
         throw new ObjectNotFoundException
         ("Row for id " + primaryKey + " not found.");
    }catch (Exception ex) {
    throw new EJBException("EXCEPTION IN ejbFindByPrimaryKey :- " + ex.getMessage());
         /*********************** Database Utility Routines *************************/
    private boolean selectByPrimaryKey(int priKey)
    throws SQLException {
         System.out.println("inside selectByPrimaryKey for primary key " + priKey);
    String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR WHERE VENDOR_ID = " + priKey;
    System.out.println("in selectByPrimaryKey where queryString is: "+ queryStr);
              stmt = con.createStatement();
    ResultSet result = stmt.executeQuery(queryStr);
    if(!result.next()) {
    stmt.close();
         System.out.println("Did not find "+priKey);
    return false;
    else { //Found the primaryKey
    Vendor_ID = result.getInt("VENDOR_ID");
    stmt.close();
    return true;
    private void loadRow() throws SQLException {
              System.out.println("inside loadRow ...");
              stmt = con.createStatement();
              String queryStr = "SELECT VENDOR_NAME,VENDOR_ADDRESS1,VENDOR_ADDRESS2,CONTACT_NAME,HOME_PHONE,WORK_PHONE,EMAIL_ID,FAX_NO " +
                                  "FROM POPS_VENDOR WHERE VENDOR_ID=" + Vendor_ID;
              System.out.println("Inside loadRow()***********"+queryStr);
              ResultSet result = stmt.executeQuery(queryStr);
              ArrayList catadatas=new ArrayList();
         if(!result.next())
         throw new SQLException("No record for primary key" + Vendor_ID);
              this.Vendor_ID               =Vendor_ID;
                        this.Vendor_Name          =result.getString("VENDOR_NAME");
                        this.Vendor_Address1     =result.getString("VENDOR_ADDRESS1");
                        this.Vendor_Address2     =result.getString("VENDOR_ADDRESS2");
                        this.Contact_Name          =result.getString("CONTACT_NAME");
                        this.Home_Phone               =result.getString("HOME_PHONE");
                        this.Work_Phone               =result.getString("WORK_PHONE");
                        this.email                    =result.getString("EMAIL_ID");
                        this.faxno                    =result.getString("FAX_NO");
                             System.out.println("Leaving loadrow method with loaded datas for vendor -->" + Vendor_ID);
                             stmt.close();
    private ArrayList getcategorylist(int vendor) throws SQLException{
              String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID=" + vendor;
              System.out.println("Query for the cat list --> " + queryStr);
              stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(queryStr);
              ArrayList catdatas=new ArrayList();
    try{
                   while(result.next())
                        catdatas.add(result.getString("VENDOR_CAT"));
              catch (SQLException e){
                   stmt.close();
                   System.out.println("Could not retrieve datas for Category list");
              stmt.close();
              System.out.println("size off array for cat -->" + catdatas.size() + " and datas ->" + catdatas);
              return catdatas;
         private ArrayList getallcategorylist() throws SQLException{
                   //String queryStr ="SELECT DISTINCT(VENDOR_CAT) FROM POPS_VENDOR_CATEGORY";
                   StringBuffer strquery=new StringBuffer(20);
                   strquery.append("SELECT DISTINCT(CATEGORY_NAME) FROM POPS_CATEGORY");
                   stmt = con.createStatement();
                   //ResultSet result = stmt.executeQuery(queryStr);
                   ResultSet result = stmt.executeQuery(strquery.toString());
                   ArrayList catdatas=new ArrayList();
                   try{
                        while(result.next())
                                  //catdatas.add(result.getString("VENDOR_CAT"));
                                  catdatas.add(result.getString("CATEGORY_NAME"));
                   catch (SQLException e){
                             stmt.close();
                             System.out.println("Could not retrieve datas for All Category list");
                   stmt.close();
                   return catdatas;
         private void delvencat(int vendor,String vencat) throws SQLException {
              int update=-1;
              stmt = con.createStatement();
              String queryStr ="DELETE FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + vencat.toUpperCase() + "'";
              System.out.println("Delete query --> " + queryStr);
              update= stmt.executeUpdate(queryStr);
              if(update!=1)
                   System.out.println("Did not find data to delete");
              stmt.close();
         private void insertvencat(int vendor,String vencat) throws SQLException {
              int update=-1;
              String queryStr ="INSERT INTO POPS_VENDOR_CATEGORY(VENDOR_ID,VENDOR_CAT)" +
                                  " VALUES(" + vendor +",'" + vencat + "')";
              System.out.println("Insert query --> " + queryStr);
              stmt = con.createStatement();
              update=stmt.executeUpdate(queryStr);
              if(update!=1)
                   System.out.println("Could not insert records in the database");
              stmt.close();
         private boolean checkcat(int vendor,String catven) throws SQLException {
              boolean datastatus=false;
              String queryStr ="SELECT VENDOR_ID FROM POPS_VENDOR_CATEGORY WHERE VENDOR_ID = " + vendor + " AND VENDOR_CAT = '" + catven.toUpperCase() + "'";
              stmt = con.createStatement();
              ResultSet result = stmt.executeQuery(queryStr);
              datastatus=result.next();
              stmt.close();
              return datastatus;
    private void storeRow() throws SQLException {
                   System.out.println("Inside ejb store");
         if (!dirtyFlag) {
         System.out.println("Skipping the UPDATE because object is not dirty");
         return;
         CallableStatement cs=null;
    try{
                        cs = con.prepareCall("EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
                        System.out.println("\n\n SQL Statement : \n " + "EXEC POPS_VENDOR_UPDATE " + this.Vendor_ID + ",'" + this.Vendor_Name + "','" + this.Vendor_Address1 + "','" + this.Vendor_Address2 + "','" + this.Contact_Name + "','" + this.Work_Phone + "','" + this.Home_Phone + "','" + this.email + "','" + this.faxno +"'");
                        cs.executeUpdate();
              catch (SQLException e){
                        cs.close();
                        System.out.     println("\n\n Error in calling stored procedure POPS_INSERT_NEW_REQUEST \n\n"+ e.getMessage() + "\n\n");
              cs.close();
              dirtyFlag = false;
         private Connection getConnection(String dbName) throws SQLException
              String configuredDataSourceName = null;
              if (dbName == null) {
                   System.out.println("Attemp to get connection failed. The requested database name is null");
              DataSource dbSource = getDataSource(dbName);
              return dbSource.getConnection();
         private DataSource getDataSource(String dbName)
              // looking from cache;
              DataSource dbSource = (DataSource) dataSources.get(dbName);
              if (dbSource == null) { //we need to find it from JNDI
                   try {
                        Context ic = new InitialContext();
                        dbSource = (DataSource) ic.lookup(dbName);
                        dataSources.put(dbName, dbSource);
                   }catch (NamingException e){
              return dbSource;
         * User calls this function to safely close an connection
         * @param connt The connection a datasource
         * @param rs The resulSet inside this connection
         * @param statement The statement associate with this connection
         private void closeDbConnection(Connection cont,ResultSet rs,Statement statement)
              if (rs != null)
              try {
                        rs.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
              if (statement != null)
                   try {
                        statement.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
              if (cont != null)
                   try {
                        cont.close();
                   } catch (SQLException ignored) {
                        ignored.printStackTrace();
         } //closeDbConnection
    EditVendorEntity (Remote Interface)
    package code.beans.EditVendor;
    import javax.ejb.EJBObject;
    import java.rmi.RemoteException;
    import java.util.*;
    * Remote interface for Enterprise Bean: EditVendorEntity
    public interface EditVendorEntity extends javax.ejb.EJBObject {
         public void setData (String[] catname, String vendorname,String vendadd1,String vendadd2,String vendcontact,String venoff,String venres,String mailid,String venfax)
                   throws RemoteException;
    public Vector getData() throws RemoteException;
    EditVendorEntityHome (Home Interface)
    package code.beans.EditVendor;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import javax.ejb.DuplicateKeyException;
    import javax.ejb.EJBHome;
    import java.util.*;
    * Home interface for Enterprise Bean: EditVendorEntity
    public interface EditVendorEntityHome extends javax.ejb.EJBHome {
         * Creates an instance from a key for Entity Bean: EditVendorEntity
         public code.beans.EditVendor.EditVendorEntity create(String vendorid)
              throws javax.ejb.CreateException, java.rmi.RemoteException;
         * Finds an instance using a key for Entity Bean: EditVendorEntity
         public code.beans.EditVendor.EditVendorEntity findByPrimaryKey(
              code.beans.EditVendor.EditVendorEntityKey Vendor_ID)
              throws javax.ejb.FinderException, java.rmi.RemoteException;
    EditVendorEntityKey (Primary Key Class)
    package code.beans.EditVendor;
    * Key class for Entity Bean: EditVendorEntity
    public class EditVendorEntityKey implements java.io.Serializable {
         static final long serialVersionUID = 3206093459760846163L;
         public String primkey;
         * Creates an empty key for Entity Bean: EditVendorEntity
         public EditVendorEntityKey() {  }
         public EditVendorEntityKey(String primarykey) {     
              this.primkey=primarykey;
         public String getVendorId() {
    return primkey;
         * Returns true if both keys are equal.
         public boolean equals(java.lang.Object otherKey) {
              if (otherKey instanceof code.beans.EditVendor.EditVendorEntityKey) {
                   code.beans.EditVendor.EditVendorEntityKey o =
                        (code.beans.EditVendor.EditVendorEntityKey) otherKey;
                   return (primkey.equals(otherKey));
              return false;
         * Returns the hash code for the key.
         public int hashCode() {
              return (primkey.hashCode());
    Please go through and give me your comments and solution...
    Thanks in advance
    Rahul

  • Using JDO under BMP entity beans

    I have an entity bean that is a BMP which uses JDO under the hood. The Oc4J document says that "Bean-managed persistence entity beans manage the resource locking within the bean implementation themselves" in the advanced subject chapter. Ok can someone in oracle add an extra line eloborating on that statement ?
    I am stuck in trying to pass a test that can do concurrent modify of an entity bean. I had 2 or more threads trying to modify one single BMP entity bean object concurrently. The database vendor recognizes one bean had the lock and deny locks to any other beans. Who should block the call to the database until one thread releases the lock on the object ? The developer ? J2EE container ? Database ?
    J2EE tenet "Developers are shielded from concurrency and threading issues while implementing business logic" Does that still hold ??
    An object Person's salary value and his benefit information are tried to be modified at the same time by different external system(salary administrator, benefit's administrator). But I dont want the user to see the lock on the object error, but instead I require a pessimistic lock on the BMP. Why does Oc4J not support pessimistic concurrency option for BMP ?

    Kurien,
    If you wish to bring something to the attention of the "Oracle dev team", I suggest you try Oracle's "MetaLink" Web site:
    http://metalink.oracle.com
    It is the official Oracle support Web site.
    These forums are for the Oracle community. Oracle Corporation employees are not obliged to even visit these forums.
    By the way, I am not an Oracle employee.
    Good Luck,
    Avi.
    P.S. For your information, you may find Debu Panda's blogs of help:
    http://radio.weblogs.com/0135826/

  • Example of client/servelt calling an Entity Bean(EJB 2.0)

    Hi !!
    Can somebody give any code of servlet or client calling an entity bean...please give any sample code... I am getting error while calling an entity bean in Servlet....
    It says that the Jndi name not found
    SERVLET CODE----------
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import javax.naming.*;
    import javax.rmi.PortableRemoteObject;
    import sfms.mtk.*;
    import sfms.sec.*;
    import java.util.*;
    public class TestServletExample extends HttpServlet
         SecDbSecUserHome home;
         public void init(ServletConfig config)throws ServletException{
         //Look up home interface
              try
                   Properties props = new Properties();
                   System.out.println("Looking for Jndi ----->>");
                   InitialContext ctx = new javax.naming.InitialContext();
                   home = (SecDbSecUserHome)javax.rmi.PortableRemoteObject.narrow(ctx.lookup("SecUserJndi"), SecDbSecUserHome.class);
                   System.out.println("Lookup is over ----->>");
              catch (Exception NamingException)
                   NamingException.printStackTrace();
         public void doGet (HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException
              MTKDataObject objDataObject = null;
              PrintWriter out;
              response.setContentType("text/html");
              String title = "EJB Example";
              out = response.getWriter();
              out.println("<HTML><HEAD><TITLE>");
              out.println(title);
              out.println("</TITLE></HEAD><BODY>");
              try
                   System.out.println("*************STARTING NOW*************");
                   Collection coll = home.findAllUsers();
                   Iterator i =coll.iterator();
                   while(i.hasNext())
                        SecDbSecUserRemote remote = (SecDbSecUserRemote)i.next();
                        System.out.println("User ID "+remote.getUserId());
                        System.out.println("FirstName "+remote.getFirstName());
              catch(Exception CreateException)
                        CreateException.printStackTrace();
              out.close();
         public void destroy()
              System.out.println("Destroy");
    javax.naming.NameNotFoundException: SecUserJndi not found
    <<no stack trace available>>
    *************STARTING NOW*************
    java.lang.NullPointerException
    at TestServletExample.doGet(TestServletExample.java:49)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
    at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
    at java.lang.Thread.run(Thread.java:484)
    PLEASE DO REPLY ME BACK (ASAP)
    Bhumika

    There should be some error in looking up the Jndi..
    In weblogic server I have been using the following code:
         try
              Context ctx = getContext.getInitialContext();
              HelloHome home = (HelloHome)ctx.lookup("MyHello");
              Hello hello = home.create();
              System.out.println(hello.display());
         catch(Exception e)
              System.out.println("Error :");
              e.printStackTrace();
         static String user = null;
         static String password = null;
         static String url = "t3://localhost:7001";
         * Gets an initial context.
         * @return Context
         * @exception java.lang.Exception if there is
         * an error in getting a Context
         static public Context getInitialContext() throws Exception
              Properties p = new Properties();
              p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
              p.put(Context.PROVIDER_URL, url);
              if (user != null)
         System.out.println ("user: " + user);
         p.put(Context.SECURITY_PRINCIPAL, user);
                   if (password == null)
                        password = "";
         p.put(Context.SECURITY_CREDENTIALS, password);
    return new InitialContext(p);
    this works fine in weblogic..
    also check if ur classpath is ok..

  • Help! My database connection from BMP Entity bean dies after a while!!!

    Hi all!
    I posted a related post about this lately How do I use connection pooling from BMP Entity Beans in OC4J 10.1.2? but it didn't solve my problems.
    I have some entity beans coded with BMP, so I handle all database stuff myself. I have set up datasources.xml like this:
        <data-source
            class="com.evermind.sql.DriverManagerDataSource"
            name="OracleDS"
            location="jdbc/OracleCoreDS"
            xa-location="jdbc/xa/OracleXADS"
            ejb-location="jdbc/OracleDS"
            connection-driver="oracle.jdbc.driver.OracleDriver"
            username="scott"
            password="tiger"
            url="jdbc:oracle:thin:@//URL TO DB:SID"
            inactivity-timeout="30"
            min-connections="10"
            max-connections="50"
        />All JNDI connection lookup is done through the ejb-location as I should. I have been through all my try {} catch {} finally {} blocks, so ensure that I close all objects after use.
    After a few hours of inactivity, my program dies. I have inserted a lot of debug statements (System.out.println()), and it seems like the program hangs when it's trying to execute a PreparedStatement.
    I.e. it dies when I do ps.ExecuteQuery in the code below (NOTE: to make things easier to read, I have stripped out all error handling here):
        Context ic = new InitialContext();
        DataSource ds = (DataSource)ic.lookup("jdbc/OracleDS");
        c = ds.getConnection();
        System.out.println("DEBUG: Got database connection.");
        PreparedStatement ps = c.prepareStatement("SELECT foobar FROM footable WHERE foo=?");
        System.out.println("DEBUG: Prepared SQL statement.");
        ps.setString(1,"foo");
        ResultSet rs = ps.executeQuery();
        // Close all objects (rs, ps, c) here.My database is on another physical server, so I wonder if this is caused by an unstable network, or?
    Please help!
    ~Morten

    Hi again!
    Sorry for the delay, but I have been busy lately.
    Anyway: Our application server is 10.1.2, so I don't think patch 4307303 is relevant here. Database server is Oracle 9.2.0.6. Everything runs on Linux (of course) ;-).
    Here's a thread dump:
    Full thread dump Java HotSpot(TM) Server VM (1.4.2_04-b05 mixed mode):
    "ApplicationServerThread-8" prio=1 tid=0x089a9448 nid=0x5902 in Object.wait() [885e6000..885e687c]
         at java.lang.Object.wait(Native Method)
         at EDU.oswego.cs.dl.util.concurrent.SynchronousChannel.poll(SynchronousChannel.java:353)
         - locked <0x91a31e60> (a EDU.oswego.cs.dl.util.concurrent.LinkedNode)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor.getTask(PooledExecutor.java:767)
         at com.evermind.util.ReleasableResourcePooledExecutor.myGetTask(ReleasableResourcePooledExecutor.java:151)
         at com.evermind.util.ReleasableResourcePooledExecutor.access$000(ReleasableResourcePooledExecutor.java:33)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:190)
         at java.lang.Thread.run(Thread.java:534)
    "AJPRequestHandler-ApplicationServerThread-7" prio=1 tid=0x08d78a58 nid=0x5902 runnable [8b2f4000..8b2f587c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at oracle.net.ns.Packet.receive(Unknown Source)
         at oracle.net.ns.DataPacket.receive(Unknown Source)
         at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
         at oracle.net.ns.NetInputStream.read(Unknown Source)
         at oracle.net.ns.NetInputStream.read(Unknown Source)
         at oracle.net.ns.NetInputStream.read(Unknown Source)
         at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:978)
         at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:950)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:434)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:661)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:959)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:693)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1065)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2901)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2942)
         - locked <0x914cad08> (a oracle.jdbc.driver.T4CPreparedStatement)
         - locked <0x920256c0> (a oracle.jdbc.driver.T4CConnection)
         at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:270)
         at com.evermind.sql.FilterPreparedStatement.executeQuery(FilterPreparedStatement.java:270)
         at com.evermind.sql.PreparedStatementBCELProxy.executeQuery(PreparedStatementBCELProxy.java:31)
         at com.brunata.servicerapport.ejb.CustomerBean.ejbCreate(Unknown Source)
         at CustomerLocalHome_EntityHomeWrapper2.create(CustomerLocalHome_EntityHomeWrapper2.java:420)
         at com.brunata.servicerapport.BeanFactory.getCustomerBean(Unknown Source)
         at com.brunata.servicerapport.CustomerOpenAction.execute(Unknown Source)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
         at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
         at com.brunata.servicerapport.CustomerAuthorizationFilter.doFilter(Unknown Source)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-23" daemon prio=1 tid=0x092ebb18 nid=0x5902 in Object.wait() [88565000..8856587c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x920000f0> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x920000f0> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "Thread-22" daemon prio=1 tid=0x092eb988 nid=0x5902 in Object.wait() [8dfa0000..8dfa087c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92000188> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x92000188> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "AJPRequestHandler-ApplicationServerThread-6" prio=1 tid=0x08c03240 nid=0x5902 runnable [8b0f1000..8b0f187c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at com.evermind.io.SingleReadBufferInputStream.readChunk(SingleReadBufferInputStream.java:116)
         at com.evermind.io.SingleReadBufferInputStream.read(SingleReadBufferInputStream.java:35)
         at com.evermind.server.http.AJPRequestHandler.readAJPPackets(AJPRequestHandler.java:462)
         at com.evermind.server.http.AJPRequestHandler.initRequest(AJPRequestHandler.java:396)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:185)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    "DestroyJavaVM" prio=1 tid=0x08053278 nid=0x5902 waiting on condition [0..bfffcac4]
    "OC4JMonitorThread" daemon prio=1 tid=0x08d7a5a0 nid=0x5902 in Object.wait() [88667000..8866787c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92aed1f8> (a java.lang.Object)
         at oracle.ons.NotificationQueue.internalDequeue(NotificationQueue.java:253)
         - locked <0x92aed1f8> (a java.lang.Object)
         at oracle.ons.NotificationQueue.dequeue(NotificationQueue.java:226)
         at oracle.ons.Subscriber.receive(Subscriber.java:136)
         at com.evermind.server.OC4JMonitorThread.run(OC4JMonitorThread.java:315)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-6" daemon prio=1 tid=0x087f9f98 nid=0x5902 in Object.wait() [886e8000..886e887c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92aed368> (a java.lang.Object)
         at java.lang.Object.wait(Object.java:429)
         at oracle.ons.NotificationQueue.internalDequeue(NotificationQueue.java:255)
         - locked <0x92aed368> (a java.lang.Object)
         at oracle.ons.NotificationQueue.dequeue(NotificationQueue.java:215)
         at oracle.ons.SenderThread.run(SenderThread.java:81)
    "Thread-5" daemon prio=1 tid=0x087f9d10 nid=0x5902 runnable [88769000..8876987c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at oracle.ons.InputBuffer.readMoreData(InputBuffer.java:267)
         at oracle.ons.InputBuffer.getNextString(InputBuffer.java:222)
         at oracle.ons.ReceiverThread.run(ReceiverThread.java:228)
    "TaskManager" prio=1 tid=0x087f9b30 nid=0x5902 waiting on condition [887ea000..887ea87c]
         at java.lang.Thread.sleep(Native Method)
         at com.evermind.util.TaskManager.run(TaskManager.java:247)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-4" prio=1 tid=0x08ca2fb8 nid=0x5902 in Object.wait() [891e2000..891e287c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x92aee258> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x92aee258> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "AJPConnectionListener [0.0.0.0/0.0.0.0:3302]" prio=1 tid=0x086f1668 nid=0x5902 runnable [8a7ca000..8a7ca87c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x927a0390> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at com.evermind.server.http.AJPConnectionListener.run(AJPConnectionListener.java:60)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "RMIServer [0.0.0.0:3202] count:2" prio=1 tid=0x086cbff0 nid=0x5902 runnable [8b172000..8b17287c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x927a0850> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at com.evermind.server.rmi.RMIServer.run(RMIServer.java:464)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "JMSServer[webprod:3702]" prio=1 tid=0x0879aff0 nid=0x5902 runnable [8b1f3000..8b1f387c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x92746aa0> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at com.evermind.server.jms.JMSServer.run(JMSServer.java:516)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
         at java.lang.Thread.run(Thread.java:534)
    "LogFlusher" daemon prio=1 tid=0x081b91a0 nid=0x5902 waiting on condition [8b274000..8b27487c]
         at java.lang.Thread.sleep(Native Method)
         at oracle.core.ojdl.BufferedLogWriter$Flusher.run(BufferedLogWriter.java:354)
    "Signal Dispatcher" daemon prio=1 tid=0x080ba9e0 nid=0x5902 waiting on condition [0..0]
    "Finalizer" daemon prio=1 tid=0x080b61a8 nid=0x5902 in Object.wait() [8e9a7000..8e9a787c]
         at java.lang.Object.wait(Native Method)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
         - locked <0x925b0378> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
         at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=1 tid=0x080b5dc8 nid=0x5902 in Object.wait() [8ea28000..8ea2887c]
         at java.lang.Object.wait(Native Method)
         at java.lang.Object.wait(Object.java:429)
         at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
         - locked <0x925b02a0> (a java.lang.ref.Reference$Lock)
    "VM Thread" prio=1 tid=0x080b52e0 nid=0x5902 runnable
    "VM Periodic Task Thread" prio=1 tid=0x080bee08 nid=0x5902 waiting on condition
    "Suspend Checker Thread" prio=1 tid=0x080b9fc8 nid=0x5902 runnable As far as I can see, my PreparedStatement (or connection) is locked.... Any ideas?
    ~Morten ;-)

  • Bean-Managed Persistent Entity Bean - SDA

    Hello,
    I wrote a BMP Entity Bean and it should use a data dictionary that i already have defined, but i do not know what should i write in the ejb-jar.xml file in order to get it works. Could you please tell me what should i write?
    <resource-ref>
      <res-ref-name>???</res-ref-name>
      <res-type>????<res-type>
    </resource-ref>
    Thanks for your help,
    SAPLernen

    Hello,
    I wrote a BMP Entity Bean and it should use a data dictionary that i already have defined, but i do not know what should i write in the ejb-jar.xml file in order to get it works. Could you please tell me what should i write?
    <resource-ref>
      <res-ref-name>???</res-ref-name>
      <res-type>????<res-type>
    </resource-ref>
    Thanks for your help,
    SAPLernen

  • Help with exception calling cmp entity bean from session bean

    Hi,
    I know someone else posted a very similar problem recently but I think the root of my problem may be different.
    This is the exception that I receive:
    javax.transaction.TransactionRolledbackException: CORBA TRANSACTION_ROLLEDBACK 9998 Maybe; nested exception is:
    org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
    at com.sun.corba.ee.internal.iiop.ShutdownUtilDelegate.mapSystemException(ShutdownUtilDelegate.java:114)
    at javax.rmi.CORBA.Util.mapSystemException(Util.java:65)
    at itsthes.security._SecurityManager_Stub.findUserRoles(Unknown Source)
    at itsthes.security._SecurityManager_Stub.findUserRoles(Unknown Source)
    at itsthes.security.servlets.SecurityUserListView.processRequest(SecurityUserListView.java:80)
    at itsthes.security.servlets.SecurityUserListView.doGet(SecurityUserListView.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    Caused by: org.omg.CORBA.TRANSACTION_ROLLEDBACK: vmcid: 0x2000 minor code: 1806 completed: Maybe
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at java.lang.Class.newInstance0(Class.java:306)
    at java.lang.Class.newInstance(Class.java:259)
    at com.sun.corba.ee.internal.iiop.messages.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:94)
    at com.sun.corba.ee.internal.iiop.LocalClientResponseImpl.getSystemException(LocalClientResponseImpl.java:120)
    at com.sun.corba.ee.internal.POA.GenericPOAClientSC.invoke(GenericPOAClientSC.java:133)
    at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
    at itsthes.security._SecurityManager_Stub.findUserRoles(Unknown Source)
    ... 17 more
    This is my primary key implementation:
    public final class SecurityUserKey implements java.io.Serializable {
    public java.lang.Integer userId;
    public java.lang.Integer roleId;
    public java.lang.String emailAddress;
         * Creates an empty key for Entity Bean: SecurityUser
         public SecurityUserKey() {
    * @see java.lang.Object#equals(java.lang.Object)
    public boolean equals(java.lang.Object otherOb) {
    if (this == otherOb) {
    return true;
    if (!(otherOb instanceof itsthes.security.entitybeans.SecurityUserKey)) {
    return false;
    itsthes.security.entitybeans.SecurityUserKey other = (itsthes.security.entitybeans.SecurityUserKey) otherOb;
    return (
    (userId==null?other.userId==null:userId.equals(other.userId))
    (roleId==null?other.roleId==null:roleId.equals(other.roleId))
    (emailAddress==null?other.emailAddress==null:emailAddress.equals(other.emailAddress))
    * @see java.lang.Object#hashCode()
    public int hashCode() {
    return (
    (userId==null?0:userId.hashCode())
    ^
    (roleId==null?0:roleId.hashCode())
    ^
    (emailAddress==null?0:emailAddress.hashCode())
    My entity method invocation is this:
    public Collection findUserRoles() {
    Vector userCollection=new Vector();
    try {
    Context jndiContext = new InitialContext();
    LocalSecurityUserHome home = (LocalSecurityUserHome) jndiContext.lookup(this.securityUserBean);
    Iterator i = home.findAll().iterator();
    while ( i.hasNext() ) {
    LocalSecurityUser securityUser = (LocalSecurityUser)i.next();
    SecurityUser sessionBean=mapLocalSecurityUser(securityUser);
    userCollection.add(sessionBean);
    } catch (javax.naming.NamingException e) {
    System.err.println(e);
    } catch (javax.ejb.FinderException e) {
    System.err.println(e);
    return userCollection;
    If anyone could point me in the right direction that would be great.
    thanks,
    William

    Hi,
    The Transaction Rollback exception may be due to the SystemException thrown in your findUserRoles() code which force the container to rollback the transaction. catch the generic exception in your findUserRoles() code and veriy what went wrong.
    i hope this helps.
    -ram

  • Need a Tx aware datasource when using CMT with BMP entity beans?

    When using Containter-Managed Transactions with entity beans that have
              bean-managed persistence, do I need to use a transaction-aware datasource?
              Thanks,
              Ken Gertsen
              

    Hi ad13217 and thanks for reply.
    I'm sorry but my code is like this:
    javax.naming.Context ctx=new javax.naming.InitialContext();
    arguments was an error on copy, but it doesn't work.
    Thanks
    Fil

  • Problem in calling single entity bean from other beans

    Hi,
    I am implementing session facade with SUN's J2EE 1.3 deploy tool for JBoss server.
    I have a entity bean UserBean which creates users in database ( create() )and tells if user exists or not ( findByPrimaryKey() ).
    Initially, I had implemented UserBean with remote interfaces. So, any servlet ( my client ) which needed to use UserBean would make a remote call to it. It was used by 5 different servlets.
    Now I am going for Local interfaces. So, I am packaging UserBean with other beans which need it.
    Problem is, if I package UserBean with , say , ChatLogsBean ( Stateless bean ), it works fine. But when I package it with WebLogsBean ( Stateless bean ) also and deploy all beans together, JBoss gives error messages that instances of UserBean are already created.
    How should structure my beans sothat I can avoid these duplication problem ?
    Present flow is as follow:
    Servlet Stateless Bean Other beans
    ChatLogs Servlet --> ChatLogsWrapper --> ChatLogsBean ( Stateless bean ) & UserBean( Entity bean )
    WebLogs servlet --> WebLogsWrapper --> WebLogsBean ( Stateless bean ) & UserBean
    WordLogs servlet --> WordLogsWrapper --> WordLogsBean ( Stateless bean ) & UserBean
    All servlets are packaged into corresponding WARs.
    ChatLogsWrapper , ChatLogsBean ,UserBean are packaged into 'ChatWrapper' JAR.
    WebLogsWrapper , WebLogsBean , UserBean are packaged into 'webWrapper' JAR
    and similarly for WordLogs.
    Any help ?
    Regards,
    Suraj

    I suggest you post to one of the forums on jboss.org. There should not be a problem AFAIK having remote and local interfaces to the same EJB. I assume that you gave these unique names (FooHome/FooLocalHome..etc...) for the home and remote interfaces and declared both in the ejb DD.

  • Can anyone explain the advantage of entity beans

    Hi All,
    I was wondering if anyone can explain the advantage of entity beans versus session beans. We argue that session beans can perform retrival/storage more efficiently than having an extra layer of entity beans. Basically we can't see any advantage entity beans have to offer except caching a row in a database table. I'd like to see the other side of the argument. So please if someone is an expert in this field, please advise us.
    Thanks in advance for any argument
    Regards,
    Di

    -Caching the data is one.
    -Seperation of logical layer. Entity beans are used to represent the data layer, while session beans hold the business rules. This is some what nebulous as some business rules are often best implement directly in the database, although they might be replicated at a different level as well.
    -Mapping a logical layout to a physical layout. For example 'customer' might have a 'fax' and 'voice' line which is represented as a Customer class with two TN classes hanging off of it. The database might represent this in one of two ways: two tables (customer and TN) or one table (customer with two tn fields).
    Both of the above are more readily apparent when dealing with distributed data. If one database holds the customer and another holds the TNs, then caching of data is more relevant and dealing with the actual CRUD stuff is much more complicated. This is likely to lead to a session bean offloading the logic to another class anyways - and it becomes a defacto bean.
    And a really excellent example is when the entity bean represents data that isn't accessed via normal database calls. For example the customer record might be on a legacy system which can only be accessed via screen scrapping and batch input. That single customer entity is now the front end for a large sub-system.
    All such answers are usually pretty wishy-washy anyways. Why should one use java over C++? Most decisions of this nature are made because developers want to use something rather than because there is any strong technical reason to do so. And even though keeping the data layer seperate for the rules layer seems like a good idea, compromises are always required and adding layers adds complexity.

  • How to use same transaction when calling CMP entity beans and  DAO (JDBC)

    We are currently using Weblogic 8.1 SP2 with an Oracle 10g database (using XA thin and non-XA drivers).
    We have a session bean that invokes an entity bean and a DAO (data access object pattern) in order to add data in 2 separate tables (account and history). Rows are added to the first (account) table using a CMP Entity bean while inserts are done in the 2nd (history) table using a DAO. Here is some pseudo code:
    addHistorySessionBean (trans-attribute="Required")
    begin
    Step #1 - call addAccountEntityBean (trans- attribute="Required")
    Step #2 - call addHistoryDAO (get datasource, connection)
    end
    The 2nd table (history) has a foreign key constraint to ensure that the corresponding key exists in the first (account) table. Unfortunately, DAO inserts on the 2nd (history) table fail with a foreign key constraint violation (INTEGRITY CONSTRAINT VIOLATION - PARENT KEY NOT FOUND!) since they cannot see the row added to the 1st (account) table in step #1 by the CMP entity bean.
    How does one ensure that all this is done in a single transaction ? It appears that the app server creates two seperate transactions (one for the session bean facade and the entity bean and a 2nd transaction (when we retrieve a connection using the same data source JNDI name) for the DAO.
    A post on server side suggested using a "<resource-ref>" in the session bean to tie the two potentially separate transactions together, but that does not work for us. However, I am not sure if we are doing that correctly. After we define the resource ref in the session facade bean, do we use the resource ref "name" attribute to lookup the datasource or do we still lookup the datasource by JNDI name ? Do we need to define the resource-ref tag in the entity bean also ?
    Does Weblogic allow using a single transaction for this type of a scenario ? How does one specify within Weblogic that the same transaction should be utilized by the entity bean and any subsequent DAOs?
    People have also suggested that we defer constraint checking until the transaction(s) are committed but that sounds like a work acount without addressing this issue. Would postponing the constraint checking in Oracle cause any additional overhead ?
    Any suggestions with specific examples or documentation on how to address this issue will be gratefully appreciated.

    Thanks for your suggestion. Unfortunately, this does not work since it appears that there are 2 separate transactions going on here. One, the original one initiated by the session bean and used by the entity bean and the other initiated by the DAO. Any other ideas appreciated.
    Hi,
    Try setting the delay-database-inserts tag to
    ejbCreate in RDBMS descriptor file.
    http://bernal/stage/wls/docs81/ejb/DDreference-cmp-jar
    .html#1113981
    vasanthi ramesh

  • Session bean with 2 entity bean

    i have a phonebook manager (session bean) taht controls the category of contacts such as group a , group b, group c and group d. where group a b c and d are all entity beans.
    may i know how to control a session bean so that it can diferent which entity beans to invoke ?

    Group might be a table in a database,
    GroupEJB referes to Entity Bean.
    with the following fields. Group Id , Group disciption. where group ID is primary Key.
    Use a session bean and create your group A B C D.( EJB create method).
    Simple i guess.
    Enjoy
    Zoha.

  • BMP Entity Beans: A sample someone ???

    Is there someone out there that has a working (very simple) sample on bean managed entity beans?
    One that one can compile, deploy and access.
    I can't get it to work.
    Even if I do it with the wizards in Jdev and do nothing with the code I get ' remote exception: null pointer exception' when trying to access the with my client.
    If you could pass it on to me I would be very grateful

    I would like to second this request. All of the examples I see are session beans.
    Thanks in advance,
    Dennis

  • Calling Local Entity Beans from another Application

    Hi,
    I packaged all my Local entity Beans in 1 single Application (APP1.EAR).
    I then I have another Application (APP2.EAR) which is made of Session Beans which require access to the APP1 application.
    I'm using this code to achieve this:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "manager");
    env.put(Context.PROVIDER_URL, "ormi://<host>/APP1");
    context = new InitialContext(env);
    ... (BeanLocalHome)context.lookup("java:comp/env/ejb/BeanLocal");
    I get the Following Exception:
    javax.naming.NameNotFoundException: java:comp/env/ejb/BeanLocal not found
    1) is there any problem with this code?
    2) can local interfaces be accessed by another Application (or can they be accessed only by the same application) ?
    Regards.
    giuseppe.

    Hi ,
    thank you for your answer.
    I'm still in trouble:
    these are the steps:
    App1.jar entity beans.
    App2.jar Session bean.
    I embedded the App1.jar into the App2.ear
    dir :
    App1.jar
    App2.jar
    application.xml (added the App1.jar)
    then I added this in the ejb-jar.xml deployment descriptor for App2.jar
    <ejb-link>../App1.jar#BeanName</ejb-link>
    for each entity bean.
    But I still get :
    javax.naming.NameNotFoundException: java:comp/env/ejb/BeanNameLocal not found
    java.lang.Object com.evermind.server.ApplicationContext.lookup(java.lang.String, boolean)
    ApplicationContext.java:110
    java.lang.Object com.evermind.server.ApplicationContext.lookup(java.lang.String)
    ApplicationContext.java:66
    java.lang.Object javax.naming.InitialContext.lookup(java.lang.String)
    What am I missing ??
    Thanks.
    giuseppe.

Maybe you are looking for

  • My graphic card failed but passes the recall test - surely Apple would replace it? How wrong can you be!

    Even though I had read about the product recall on some iMacs, mine had never had an issue, but to be safe, the plan was to take it to an Apple store to have them test and replace it. A week ago, on occasion, the screen suddenly started going complet

  • Embedding flash files in pdf

    Hello, as far as I know, it is now possible to include flash movies in pdf files that can then be viewed with Adobe Reader. I am more interested in controllable flash files with for instance, a slider that control a mathematical parameter of a curve

  • CSS Keepalive Problem

    Currently, I have two web server(A and B) with java engine running on top of the web server. It will give a error message "Internal error" if the java engine is mul-function. As such, CSS will detect that the Java engine of the web server(etc A) is d

  • Reference information model for the manufacturing industry?

    Hello, Do anybody know about some kind of reference information model in the manufactoring industry or any organization that are working on devloping this (doesn't have to be for the full information landscape, could be for bits and picees)? Thanks f

  • Authorization in Reporting

    Hi, I have the following problem when executing BW queries. A user is responsible for a country. Country is an authorization relevant characteristic. The user is able to see the sales ONLY in his own country. The same user is responsible for a produc