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 ;-)

Similar Messages

  • 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/

  • 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

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

  • Error While creating new database connection from HFM workspace

    Hi,
    We have recently installed HFM and was trying to create database connection from database connection manager in HFM workspace.
    I am getting below error:
    "Error connecting to database connection : no HssJNIDriver950 in java.library.path" initially and later
    "Error connecting to database connection : com/hyperion/ap/adm/HssConn".
    Any information in this direction would helpful.
    Thanks,
    Bhargav
    Edited by: bhargavr on Jan 24, 2011 6:55 PM

    Hi bhargavr,
    We came accross the same issue. Try the following solution below for this 'KNOWN ISSUE' and let me know how you get on. Drop me a note if you have any questions regarding this post.
    Error: *"Error connecting to database connection: com/hyperion/ap/adm/HssConn" While Creating a Financial Management Database Connection* [ID 1102697.1]
    Modified 04-JAN-2011 Type PROBLEM Status PUBLISHED
    Applies to:
    Hyperion BI+ - Version: 11.1.2.0.00 and later [Release: 11.1 and later ]
    Microsoft Windows x64 (64-bit)
    Symptoms:
    You are running the Financial Reporting Web Server on a 64-bit server.
    When you try to create a new Financial Management (HFM) database connection using the Database Connection Manager in Workspace you receive the following message:
    “Error connecting to database connection <connection_name>: com/hyperion/ap/adm/HssConn”
    You can create a database connection in Financial Reporting Studio. When you refresh a report with a Financial Management database connection, you receive one of the following messages:
    “1001: Error connecting to database connection <DATABASE_CONNECTION_NAME>: com/hyperion/ap/adm/HssConn”
    or
    “1001: Error connecting to database connection <DATABASE_CONNECTION_NAME>: no HssJNIDriver950 in java.library.path”
    Cause:
    The issue is documented in unpublished bug 9537050, and in Known Issues in the 11.1.2 Reporting and Analysis Readme. Cross-reference unpublished bug 9707353.
    Solution:
    In the Windows registry, take the following steps:
    Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\HyperionSolutions\FinancialReporting0\HyS9FRReports.
    For each of the following entries, prefix the contents with text in the blue box: Env2, JVMOption13, and JVMOption17 (note that the JVMOption numbers might be slightly different in your environment).
    C:\Oracle\Middleware\EPMSystem11R1\common\ADM\11.1.2.0\bin-64
    If your EPM_ORACLE_HOME is not located at C:\Oracle\Middleware\EPMSystem11R1, replace that location with your location.
    Restart the server.
    G'Luck,
    -David

  • How can I get Connection(Database Connection)on my backing bean

    hello guys!
    How can I get the Database Connection on my managed bean?
    I want to use this connection for my reports.
    thanks a lot!
    alvin

    Alvin,
    You can access the data provider through ADF the binding. The data provider represents the business service you use. Once you have a handle to this you can get the connection.
    You don't mention the business service, so I cannot help you more than this. If it is ADF BC, have a look at http://download.oracle.com/docs/html/B25947_01/toc.htm and the stored procedure section. Steve Muench explains a trick to access the "real" JDBC connect used by ADF BC
    Frank

  • CMP entity bean update after database update

    I'm new to JDeveloper and J2EE. Since JDev 10.1.3 is now production software I finally got started with it. Everything was quite simple to achieve however I have one problem.
    My current setup is faily easy. I have a statelss session bean and a CMP entity bean using TopLink (both EJB 2.1). Getting them both created went smooth and having the two talk was as easy as pie thanks to Jdev.
    The problem I have is with the entity bean. I'm using a custom finder method to retrieve records using non-PK fields. This works like a charm and I'm getting the data I need. But when I update the data in the database (OracleXE) and I rerun the client I get the old data. The only way for me to get new data is to restart the embedded OC4J server in JDev.
    How can I have the entity bean updated by changes in the database?

    Thanks Avi!
    I spent some time with the documentation and I see I can configure the cache. However how to do this is not clear to me. I have the impression that most of it relates to BMP entity beans.
    Apparantly there is a DoNotCheckCache method I can invoke on the query, but I have no idea how to achieve this...
    Message was edited by:
    Deddiekoel

  • How to read a passward protected excel file with the help of database connectivity tool kit

    hi, i was reading an excel file with the help of database connectivity tool kit in labview 8.0
    i made tabels in the excel file nand made odbc connection and specified the workbbok name.
    now my problem is how to read the same file if i specife a pasword to that excel file ?

    Hi,
    Check out this thread about opening a password-protected Excel file using ActiveX. This should take care of it for you!
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • Steps to change universe database connection from SQL server to Oracle 10

    Hi,
    we are moving from sql server to Oracle 10.Please let me know the steps and various parameters I should consider while changing universe database connection from SQL server to Oracle 10.
    Following are the steps which I assumed :
    1.     create a new Oracle database connection or edit the existing connection to point to Oracle server
    2.     Need to check sql for each object, having integrity check for universe will solve the purpose of parsing each object
    3.     Exporting the universe after integrity check
    4.     Report data testing
    Let me know if I miss on any steps.Also what all factors I need to consider while moving to Oracle for eg: what @ custom sql,what @ table names,what @ LOV etc.
    Kindly reply

    Thanks Abhijeet and Shreyash,
    I will follow the steps you have suggested.
    Actually I was searching for this on net and got to know that with Oracle database connection,theres lot of stuff needs to take care of in terms of custom sql and LOV and in our case,we have lot of custom sql for each object in the universe so just wanted to confirm.
    I will do the changes and let you guys know in case theres any isuue specifically to Oracle.

  • Connecting to sqlserver from beanManaged entity bean...help me..

    hi all
    I want to connect to SQLServer7.0 from my beanManaged persistence Entity bean.Can any body tell me how to get Connection to data base using JDBC.wether I have to install any new drivers.can i use jdbcodbcbridge drivers.How should my deployment descriptor be?
    If possible give me a simple code snippet.
    Thank you
    srinivas

    hi,
    First:
    Copy %JAVA_HOME%\jre\lib\rt.jar to
    your web server lib folder(Example:J2ee\lib\system\)
    Second:
    make a bean---example:
    package my;
    import java.sql.*;
    public class myDBBean{
    private String DBLocation= "jdbc:odbc:yourDSN";
    private String DBDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
    private ResultSet rs = null;
    private Connection conn = null;
    public myDBBean(){
    public ResultSet executeQuery(String sql){
    if(conn==null){
    DBConnect();
    if(conn==null)
    rs=null;
    else{
    try{
    Statement s=conn.createStatement();
    rs=s.executeQuery(sql);
    catch (SQLException e){
    return(rs);
    public String DBConnect(){
    String strExc="";
    try{
    Class.forName(DBDriver);
    conn=DriverManager.getConnection(DBLocation,"userName","password");
    catch(ClassNotFoundException e){
    strExc=e.toString();
    catch(SQLException e){
    strExc=e.toString();
    return(strExc);
    public void setDBDriver(String driver){
    DBDriver=driver;
    public void setconn(Connection conn){
    conn=conn;
    public String getDBLocation(){
    return(DBLocation);
    public String getDBDriver(){
    return(DBDriver);
    public ResultSet getRs(){
    return(rs);
    public Connection getconn(){
    return(conn);
    Third:
    Compile class file to folder of server classes
    example:j2ee\lib\classes\my\
    Fourth:
    Use jsp file to use the bean
    example:
    <%@ page contentType="text/html;charset=gb2312" %>
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="myDB" class="my.myDBBean" scope="page" />
    <html>
    <head>
    <title>test Sql</title>
    <meta http-equiv="Content-Type" content="text/html;charset=gb2312">
    </head>
    <body>
    <p>Result:</p>
    <%
    String sql;
    ResultSet rs;
    sql="select * from yourTable";
    myDB.DBConnect();
    rs=myDB.executeQuery(sql);
    while(rs.next()){
    out.print("<p>");
    out.print(rs.getString("UserName"));
    out.print("</p>");
    %>
    </body>
    </html>
    hope can help you out.
    David

  • 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

  • How to upload a BLOB file from CMP Entity Beans

    Hi,
    I want to upload a .xls file as a BLOB using CMP. And also to get back the BLOB from the database through CMP. I am using oracle 8i DataBase and weblogic 8.1 server with weblogic workshop as IDE.
    I don't have any idea to save a file as BLOB.
    Could any one please help me to solve this as it is very urgent.
    regards
    KumudaRajarshi

    I would just put the .xls file into a byte array in a
    class that implements the serializable
    interface. This class then becomes a column in your
    database table(as a blob) represented by an
    attribute in your entity bean. On sun appserver7
    serializable is mapped to a blob column in the
    database by default. You don't have to deal with a
    blob at all in the code, just your
    serializable type. You may have to use a type 2
    driver to get it to work with files
    over 4 or 5k.
    See the appserver7 EJBdevguide, page 92 for details.could you descrbe the detail how to use the class to become the column as blob?
    is that any sample code can be provided?
    it's very urgent, please help..
    thanks

  • HELP IN DATABASE CONNECTIVITY IN A SERVLET`

    HI there,
    I have some issues in an application. I have a servlet which is called Servlet1.class. I have deployed this in my tomcat webapps folder. There is a stand alone application called MailAgent.class which pools into a mail box and retrieves the messages and converts them as HTTP messages. Then the MailAgent.class sends the HTTP message as multipart post (email message) to the servlet. In the servlet I am trying to establish a database connection with the JDBC driver from third party vendor. I am unable to get the driver class when I establish the connection with the database. Is there any issues with servlet and database access. I am able to connect if I run as a stand alone application.
    Any help would be greatly appreciated.
    Thanks
    John

    There shouldn't be any .class file in your webapps folder. I hope you mean that you created a subdirectory under webapps, with a WEB-INF under that and /classes and /lib under that. Your servlet .class file and its package directory structure belong under webapps/yourApp/WEB-INF/classes, right?
    You can create database connections in a servlet, although I agree with the previous poster that you'd be better off putting database code into objects that you could test off-line, without the servlet.
    You've got to have the JDBC driver JARs in the webapps/yourApp/WEB-INF/lib directory, for starters.
    If you get really adventurous you can create a pooled JNDI data source, but maybe that's another day's work. Get the basic connection working first.

  • External Database Updates Automatically Updating Entity Beans

    Hi,
    I have a Java GUI which displays the contents of a table. One row is displayed on the GUI for each row in the table.
    The data is accessed by the Java GUI from the table using a container Managed Entity Bean.
    If I insert a row in the table from Oracle's SQL command prompt, can the GUI be automatically refreshed to display the new row that was inserted in the table i.e. does weblogic container receive any message which can be trapped by the entity bean to automatically reload the content of the table.
    Regards,
    Dinesh

    "Dinesh Mehta" <[email protected]> wrote in message
    news:3bd5eba3$[email protected]..
    Hi Dinesh,
    I think there is a requirements/design problem here.
    First, it's hardly possible to implement a callbacks
    from the DB layer to a container layer.
    Second, what would happend to the GUI if many
    changes to the database ocure simultaneously?
    I thinks this is a GUI user who has to request
    a refresh when it's necessary.
    Regards,
    Slava Imeshev
    I have a Java GUI which displays the contents of a table. One row isdisplayed on the GUI for each row in the table.
    >
    The data is accessed by the Java GUI from the table using a containerManaged Entity Bean.
    >
    If I insert a row in the table from Oracle's SQL command prompt, can theGUI be automatically refreshed to display the new row that was inserted in
    the table i.e. does weblogic container receive any message which can be
    trapped by the entity bean to automatically reload the content of the table.

Maybe you are looking for

  • Vendor Account group assign recon. account

    Hi Experts, I'm looking tcode to assing recon. account for vendor account group. I created Vendor account group and recon. account. I would like to have in tcode fk01 assing Vendor account group to recon. account. Now in tcode fk01 I choose vendor ac

  • CC not showing the updating to Indesign 9.1

    It has been impossible to update ID to 9.1. I reloaded many times CCloud app to see the upgrade but is not present. I installed again InCopy, just to see, and after this, it appeared in CC app the update. Now InCopy is updated to 9.1 (also Acrobat an

  • Output of PL/SQL code in Client Machine.

    I am writing the output of PL-SQL code to a file. Later on I will use that output in a UNIX shell script. For that I am creating directory object and using the UTL_FILE.fopen and UTL_FILE.put_line functions of UTL_FILE package in Oracle. E.G. 1) CREA

  • My photo album is not in order by date taken

    my photo album is not in order by date taken, how do I get it in order?

  • Newbie Finding Tables

    Ok, forgive me for being a newbie first off. What I am needing is to create a report using crystal reports that pulls the following data from a Oracle App Suite 10g database at a sister site in my division and matched to data in my Dynamics GP using