Subject Sporadic NullPointerException with Jaybird used from JBoss
Author Josef Gschwendtner
Hi,

we use JBoss and Jaybird to connect to a Firebird 1.03 database.
Preparing a statement (stored procedure) produces sporadically a
NullPointerException.
The server is under heavy load (> 10 transactions per second).

Subsequently I will try to explain the problem:
===============================================

- Application in JBoss (3.2.3)

- Jaybird 1.5.4 (embedded via firebirdsql.rar - Firebird Database
Connector)

- WebService calls, which write data into a database via JDBC (using
Stored Procedures)

- using local transactions (not XA Transactions)

- there is only one webservice client which call methods sequentially

- after some time each database access leads to a NullPointerException
(different methods using several stored procedures get the same error).
There is no StackTrace, despite the Log4J method
log.error("ErrorMessage", e) is used to record the problem.

- the NullPointerException is thrown upon calling con.prepareStatement()

- this erroneous state lasts until a different Jboss-Application (JMS -
MessageDrivenBean) is reading data from the same database (using XA
transactions). In this case the following exeptions are thrown and
afterwords the webservice works proberly again. The whole cycle repeats
(maybe 2 hours later).


The following exceptions cure the NPE-Problem:
==============================================

2004-11-22 10:36:36,569 WARN [org.jboss.tm.TransactionImpl]
XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=TUX//11,
BranchQual=] errorCode=XAER_NOTA

org.firebirdsql.jca.FBXAException: Unrecognized transaction

at
org.firebirdsql.jca.FBManagedConnection.internalEnd(FBManagedConnection.
java:457)
at
org.firebirdsql.jca.FBManagedConnection.end(FBManagedConnection.java:429
)
at org.jboss.tm.TransactionImpl.endResource(TransactionImpl.java:1205)
at
org.jboss.tm.TransactionImpl.delistResource(TransactionImpl.java:543)
at
org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEve
ntListener.delist(TxConnectionManager.java:505)
at
org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEve
ntListener.connectionClosed(TxConnectionManager.java:554)
at
org.firebirdsql.jca.FBManagedConnection$5.notify(FBManagedConnection.jav
a:1208)
at
org.firebirdsql.jca.FBManagedConnection.notify(FBManagedConnection.java:
1189)
at
org.firebirdsql.jca.FBManagedConnection.close(FBManagedConnection.java:8
73)
at
org.firebirdsql.jdbc.AbstractConnection.close(AbstractConnection.java:44
8)


2004-11-22 10:36:36,571 ERROR
[org.jboss.resource.connectionmanager.TxConnectionManager]
ResourceException while closing connection handle!

javax.resource.ResourceException: Failure to delist resource

at
org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEve
ntListener.delist(TxConnectionManager.java:507)
at
org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEve
ntListener.connectionClosed(TxConnectionManager.java:554)
at
org.firebirdsql.jca.FBManagedConnection$5.notify(FBManagedConnection.jav
a:1208)
at
org.firebirdsql.jca.FBManagedConnection.notify(FBManagedConnection.java:
1189)
at
org.firebirdsql.jca.FBManagedConnection.close(FBManagedConnection.java:8
73)
at
org.firebirdsql.jdbc.AbstractConnection.close(AbstractConnection.java:44
8)


Has anybody an idea what could be the problem.

We would appreciate any help.

Thank you,
Josef Gschwendtner
Quattro-Soft GmbH