<p>Working with Oracle/Clob/WebLogic/BMP EJB and getting: java.sql.SQLException: After clearParameters() ...
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   timo_maenpaa
Posted On:   Tuesday, October 29, 2002 12:32 PM

Hi, I have BMP entity bean in WebLobic 6.1 SP2 that has a String value as one of its persistent fields. This persistent field is stored to Oracle8i as a Clob field. When I create a BMP entity bean, the transaction succeeds most of the time and the Clob field is correctly set. Sometimes, however, I am getting a mysterious exception complaining: java.rmi.RemoteException: Exception while commiting Tx : Name=[EJB fi.itsolicom.billing.documentreceiver.DocumentReceiverSLBean.getDocument(int)] ,Xid=164:4adf347245864ff9(4424017),Status=Rolled back. [Reason=javax.ejb.EJBException - with nested exception: [java.sql.SQLException: Af   More>>


Hi,


I have BMP entity bean in WebLobic 6.1 SP2 that has a

String value as one of its persistent fields. This
persistent field is stored to Oracle8i as a Clob field.

When I create a BMP entity bean, the transaction succeeds
most of the time and the Clob field is correctly set.

Sometimes, however, I am getting a mysterious exception complaining:


			
java.rmi.RemoteException: Exception while commiting Tx : Name=[EJB
fi.itsolicom.billing.documentreceiver.DocumentReceiverSLBean.getDocument(int)]
,Xid=164:4adf347245864ff9(4424017),Status=Rolled back.
[Reason=javax.ejb.EJBException - with nested exception:

[java.sql.SQLException: After clearParameters() has been
called, all parameters must be reset before
executing]],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds
since begin=0,seconds left=9,ServerResourceInfo
[weblogic.jdbc.jts.Connection]=(state=rolledback,
assigned=TimoServer1), SCInfo[TimoDomain1+TimoServer1]=
(state=rolledback),properties=({ISOLATION LEVEL=2,
weblogic.transaction.name=[EJB
fi.itsolicom.billing.documentreceiver.DocumentReceiverSL
Bean.getDocument(int)],
weblogic.jdbc=t3://164.5.82.40:80}),OwnerTransactionManager
=ServerTM[ServerCoordinatorDescriptor=
(CoordinatorURL=TimoServer1+164.5.82.40:80+TimoDomain1+,
Resources={})],CoordinatorURL=TimoServer1+
164.5.82.40:80+TimoDomain1+); nested exception is:

weblogic.transaction.RollbackException: Unexpected
exception in beforeCompletion: sync=
weblogic.ejb20.internal.TxManager$TxListener@447e5a -

with nested exception: [javax.ejb.EJBException





So this transaction fails and the BMP entity bean is not
saved to the database. But when I retry to create a
BMP entity bean with the same data, it succeeds.


So, my question is that is the reason for that exception ?

I do not understand what does this clearParameters() method do and who is calling it ?



Basically, I have a BMP bean that first calls a stored
procedure to get a primary key and then it stores

the other data except the Clob (the Clob field in the
database is set to default the empty_clob()) to the
database.

Finally, my BMP bean tries to update the Clob field in
the database and then I get the exception when I

call the executeUpdate() in my prepared statement.

Yes, I think I was following all the instructions how
to work with Clob/Oracle/WebLogic combination.



thanks,

Timo







			
String lockRow = "select DOCUMENT_DATA from BILL.DOCUMENTS
where KEY="+ p_documentKey " for update of DOCUMENT_DATA";

PreparedStatement pStmt1 = p_con.prepareStatement(lockRow);

ResultSet rs = pStmt1.executeQuery();

Clob documentDataClob = null;

if (rs.next()) {

documentDataClob = rs.getClob(1);

}

java.io.Writer writer = ((weblogic.jdbc.common.OracleClob)
documentDataClob).getCharacterOutputStream();

char chars[] = p_documentData.toCharArray();

writer.write(chars);

writer.flush();

writer.close();

String updateRow = "update BILL.DOCUMENTS set DOCUMENT_DATA = ?
where KEY=" + p_documentKey;

PreparedStatement pStmt2 = p_con.prepareStatement(updateRow);

pStmt2.setClob(1, documentDataClob);

int i = pStmt2.executeUpdate(); // here comes the exception !!!

   <<Less
About | Sitemap | Contact