9 Replies Latest reply on Feb 3, 2005 5:20 AM by Tim Webber

    Stateful Session bean and java.sql.Connection problem

    Ejaz Newbie

      I am creating java.sql.Connection with Oracle in ejb create in Stateful Session Bean.
      As
      Connection conn;

      ejbCreate(){
      Context ctx = new InitialContext();
      Object obj = ctx.lookup(“java:/OralceDS”);
      if (obj instanceof DataSource) {
      DataSource ds = (DataSource) obj;
      Conn = (Connection) ds.getConnection();
      }

      List getRestult(){
      // Â…Â….
      // Return list
      }

      In client of Stateful session bean as soon as I call the create method . Connection is being closed by server and and following error message is printed on jboss consoles

      [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@e7cb66 java.lang.Exception: STACKTRACE at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:282) at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:506)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:814)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)