tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tony Tubbs <tbbs...@yahoo.com>
Subject Re: Need help getting Derby running in JUnit (hanging test issue)
Date Tue, 30 Nov 2010 22:28:22 GMT
I'm using an in-memory instance of derby to test my application, mainly the EJB 
communication with the DB.  My EJBs are calling stored procedures.  For testing, 
I've stubbed out Java based stored procedures in Derby.  I have narrowed down my 
tests to those invoking one of these stored procedures as the one(s) that make 
JUnit hang.  Having prepared a callable statement cstmt and calling execute on 
it, Derby magically executes the java code for the procedure.  Perhaps my 
notes/tracing below will point out something to those more knowledgeable than I 
am, about what might be causing the problem.

TIA,
TT


*****************************************************************
     This run, the tests all run as expected, but JUnit hangs
     - Notice different ResultSet types on either side of the call
       Though the object id is the same on both
*****************************************************************

INSIDE EJB JAR CODE
Using:
- InitialContext ctx = new InitialContext();
- DataSource ds = (DataSource) ctx.lookup("openejb:Resource/WTSHARE");
- Connection conn = ds.getConnection();
---------------------------------------------
isResultSet = cstmt.execute();

        INSIDE DERBY JAVA BASED STORED PROCEDURE CODE
        Using:
        - Connection conn = 
DriverManager.getConnection("jdbc:default:connection");
        ---------------------------------------------
        rs: org.apache.derby.impl.jdbc.EmbedResultSet40@9f8c02
        rs: org.apache.derby.impl.jdbc.EmbedResultSet40@18a577d
        rs: org.apache.derby.impl.jdbc.EmbedResultSet40@1a96bae

BACK inside ejb jar code
---------------------------------------------
isResultSet: true
rs: org.apache.commons.dbcp.DelegatingResultSet@9f8c02
rs: org.apache.commons.dbcp.DelegatingResultSet@18a577d
rs: org.apache.commons.dbcp.DelegatingResultSet@1a96bae



*****************************************************************
 This run, the tests fail, because execute reports no ResultSets
*****************************************************************

INSIDE EJB JAR CODE
Using:
- InitialContext ctx = new InitialContext();
- DataSource ds = (DataSource) ctx.lookup("openejb:Resource/WTSHARE");
- Connection conn = ds.getConnection();
---------------------------------------------
isResultSet = cstmt.execute();

        INSIDE DERBY JAVA BASED STORED PROCEDURE CODE
        Using: (attempting to use the same OpenEJB style connection this time)
        - InitialContext ctx = new InitialContext();
        - DataSource ds = (DataSource) ctx.lookup("openejb:Resource/WTSHARE");
        - Connection conn = ds.getConnection();
        ---------------------------------------------
        rs: org.apache.commons.dbcp.DelegatingResultSet@663ec
        rs: org.apache.commons.dbcp.DelegatingResultSet@1a48515
        rs: org.apache.commons.dbcp.DelegatingResultSet@101a4f3

BACK inside ejb jar code
---------------------------------------------
isResultSet: false
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message