Details
Description
When WS-RM's derby storage is activated, the sequence data are persisted in the database.
However, these sequence data are not loaded from the database when the WS-RM component is restarted.
This problem appears to be caused by the init method of the persistence class org.apache.cxf.ws.rm.persistence.jdbc.RMTxStore which leaves an uncommitted transaction to the relevant tables open. Consequently, the next select statement that loads the persisted sequence data is not seeing the content.
The original source code fragment of this method looks like this:
try { connection.setAutoCommit(false); createTables(); } catch (SQLException ex) { LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex); SQLException se = ex; while (se.getNextException() != null) { se = se.getNextException(); LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", se); } throw new RMStoreException(ex); }
The suggested change would be as follows:
try { connection.setAutoCommit(true); createTables(); } catch (SQLException ex) { LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex); SQLException se = ex; while (se.getNextException() != null) { se = se.getNextException(); LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", se); } throw new RMStoreException(ex); } finally { try { connection.setAutoCommit(false); } catch (SQLException ex) { LogUtils.log(LOG, Level.SEVERE, "CONNECT_EXC", ex); throw new RMStoreException(ex); } }
In the above code, the setAutoCommit(true) statement could be omitted if we simply want to rely on the default autoCommit mode.
In any case, the suggested code makes sure that the subsequence statement is correctly executed.
Attachments
Attachments
Issue Links
- is depended upon by
-
CXF-6406 WS-RM persistence with RMTxStore does not work with JNDI Lookup
- Closed