[ http://jira.jboss.com/jira/browse/JBAS-1235?page=history ]

Thomas Diesler updated JBAS-1235:
---------------------------------

    Fix Version: JBossAS-4.0.2 Final

> TimedObject id persistence fails on restart
> -------------------------------------------
>
>          Key: JBAS-1235
>          URL: http://jira.jboss.com/jira/browse/JBAS-1235
>      Project: JBoss Application Server
>         Type: Bug
>   Components: CMP service
>     Versions: JBossAS-4.0.0 Final
>     Reporter: SourceForge User
>     Assignee: Thomas Diesler
>      Fix For: JBossAS-4.0.2 Final

>
>
> SourceForge Submitter: cstach .
> Upon restarting JBoss, persisted timers throw this SQL 
> exception because it seems that the entity bean that 
> implements the TimedObject had its primary key (Long) 
> converted into a byte array.
> java.sql.SQLException: Cannot convert class [B to SQL 
> type requested due to java.lang.ClassCastException - 
> null
>       at 
> com.mysql.jdbc.PreparedStatement.setObject
> (PreparedStatement.java:922)
>       at 
> com.mysql.jdbc.PreparedStatement.setObject
> (PreparedStatement.java:944)
>       at 
> org.jboss.resource.adapter.jdbc.WrappedPreparedStatem
> ent.setObject(WrappedPreparedStatement.java:615)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCParameterSetter$5.se
> tNotNull(JDBCParameterSetter.java:130)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCParameterSetter$JDB
> CAbstractParameterSetter.set
> (JDBCParameterSetter.java:56)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFi
> eldBridge.setArgumentParameters
> (JDBCAbstractCMPFieldBridge.java:354)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFi
> eldBridge.setPrimaryKeyParameters
> (JDBCAbstractCMPFieldBridge.java:343)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.se
> tPrimaryKeyParameters(JDBCEntityBridge.java:770)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.e
> xecute(JDBCLoadEntityCommand.java:157)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.e
> xecute(JDBCLoadEntityCommand.java:72)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEnt
> ity(JDBCStoreManager.java:631)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEnt
> ity(JDBCStoreManager.java:613)
>       at 
> org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity
> (CMPPersistenceManager.java:391)
>       at 
> org.jboss.resource.connectionmanager.CachedConnection
> Interceptor.loadEntity
> (CachedConnectionInterceptor.java:351)
>       at 
> org.jboss.ejb.plugins.EntitySynchronizationInterceptor.inv
> oke(EntitySynchronizationInterceptor.java:232)
>       at 
> org.jboss.resource.connectionmanager.CachedConnection
> Interceptor.invoke
> (CachedConnectionInterceptor.java:185)
>       at 
> org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke
> (EntityReentranceInterceptor.java:111)
>       at 
> org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke
> (EntityInstanceInterceptor.java:211)
>       at 
> org.jboss.ejb.plugins.EntityLockInterceptor.invoke
> (EntityLockInterceptor.java:89)
>       at 
> org.jboss.ejb.plugins.EntityCreationInterceptor.invoke
> (EntityCreationInterceptor.java:53)
>       at 
> org.jboss.ejb.plugins.CallValidationInterceptor.invoke
> (CallValidationInterceptor.java:48)
>       at 
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext
> (AbstractTxInterceptor.java:105)
>       at 
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
> ons(TxInterceptorCMT.java:283)
>       at 
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke
> (TxInterceptorCMT.java:149)
>       at 
> org.jboss.ejb.plugins.SecurityInterceptor.invoke
> (SecurityInterceptor.java:128)
>       at org.jboss.ejb.plugins.LogInterceptor.invoke
> (LogInterceptor.java:191)
>       at 
> org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invok
> e(ProxyFactoryFinderInterceptor.java:122)
>       at org.jboss.ejb.EntityContainer.internalInvoke
> (EntityContainer.java:514)
>       at org.jboss.ejb.Container.invoke
> (Container.java:854)
>       at 
> org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout
> (TimedObjectInvokerImpl.java:63)
>       at 
> org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run
> (TimerImpl.java:472)
>       at java.util.TimerThread.mainLoop
> (Timer.java:432)
>       at java.util.TimerThread.run(Timer.java:382)
> 11:44:21,750 ERROR [TimerImpl] Error invoking 
> ejbTimeout: javax.ejb.EJBException: Internal error 
> setting parameters for field id; CausedByException is:
>       Cannot convert class [B to SQL type requested 
> due to java.lang.ClassCastException - null
> 11:44:21,750 WARN  [TimerImpl] Timer was not 
> registered with Tx, reseting state: [id=1target=
> [target=jboss.j2ee:jndiName=ejb/mdf/Campaign,service=E
> JB,[EMAIL PROTECTED],remaining=-
> 59694750,periode=0,in_timeout]
> 11:44:21,859 ERROR [LogInterceptor] EJBException in 
> method: public abstract void 
> javax.ejb.TimedObject.ejbTimeout(javax.ejb.Timer), 
> causedBy:
> java.sql.SQLException: Cannot convert class [B to SQL 
> type requested due to java.lang.ClassCastException - 
> null
>       at 
> com.mysql.jdbc.PreparedStatement.setObject
> (PreparedStatement.java:922)
>       at 
> com.mysql.jdbc.PreparedStatement.setObject
> (PreparedStatement.java:944)
>       at 
> org.jboss.resource.adapter.jdbc.WrappedPreparedStatem
> ent.setObject(WrappedPreparedStatement.java:615)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCParameterSetter$5.se
> tNotNull(JDBCParameterSetter.java:130)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCParameterSetter$JDB
> CAbstractParameterSetter.set
> (JDBCParameterSetter.java:56)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFi
> eldBridge.setArgumentParameters
> (JDBCAbstractCMPFieldBridge.java:354)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFi
> eldBridge.setPrimaryKeyParameters
> (JDBCAbstractCMPFieldBridge.java:343)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.se
> tPrimaryKeyParameters(JDBCEntityBridge.java:770)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.e
> xecute(JDBCLoadEntityCommand.java:157)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCLoadEntityCommand.e
> xecute(JDBCLoadEntityCommand.java:72)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEnt
> ity(JDBCStoreManager.java:631)
>       at 
> org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadEnt
> ity(JDBCStoreManager.java:613)
>       at 
> org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity
> (CMPPersistenceManager.java:391)
>       at 
> org.jboss.resource.connectionmanager.CachedConnection
> Interceptor.loadEntity
> (CachedConnectionInterceptor.java:351)
>       at 
> org.jboss.ejb.plugins.EntitySynchronizationInterceptor.inv
> oke(EntitySynchronizationInterceptor.java:232)
>       at 
> org.jboss.resource.connectionmanager.CachedConnection
> Interceptor.invoke
> (CachedConnectionInterceptor.java:185)
>       at 
> org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke
> (EntityReentranceInterceptor.java:111)
>       at 
> org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke
> (EntityInstanceInterceptor.java:211)
>       at 
> org.jboss.ejb.plugins.EntityLockInterceptor.invoke
> (EntityLockInterceptor.java:89)
>       at 
> org.jboss.ejb.plugins.EntityCreationInterceptor.invoke
> (EntityCreationInterceptor.java:53)
>       at 
> org.jboss.ejb.plugins.CallValidationInterceptor.invoke
> (CallValidationInterceptor.java:48)
>       at 
> org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext
> (AbstractTxInterceptor.java:105)
>       at 
> org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransacti
> ons(TxInterceptorCMT.java:283)
>       at 
> org.jboss.ejb.plugins.TxInterceptorCMT.invoke
> (TxInterceptorCMT.java:149)
>       at 
> org.jboss.ejb.plugins.SecurityInterceptor.invoke
> (SecurityInterceptor.java:128)
>       at org.jboss.ejb.plugins.LogInterceptor.invoke
> (LogInterceptor.java:191)
>       at 
> org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invok
> e(ProxyFactoryFinderInterceptor.java:122)
>       at org.jboss.ejb.EntityContainer.internalInvoke
> (EntityContainer.java:514)
>       at org.jboss.ejb.Container.invoke
> (Container.java:854)
>       at 
> org.jboss.ejb.txtimer.TimedObjectInvokerImpl.callTimeout
> (TimedObjectInvokerImpl.java:63)
>       at 
> org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run
> (TimerImpl.java:472)
>       at java.util.TimerThread.mainLoop
> (Timer.java:432)
>       at java.util.TimerThread.run(Timer.java:382)
> 11:44:21,859 ERROR [TimerImpl] Error invoking 
> ejbTimeout: javax.ejb.EJBException: Internal error 
> setting parameters for field id; CausedByException is:
>       Cannot convert class [B to SQL type requested 
> due to java.lang.ClassCastException - null
> 11:44:21,859 WARN  [TimerImpl] Timer was not 
> registered with Tx, reseting state: [id=2target=
> [target=jboss.j2ee:jndiName=ejb/mdf/Campaign,service=E
> JB,[EMAIL PROTECTED],remaining=-
> 59688859,periode=0,in_timeout]
> I don't know if this is the exact same problem (I haven't 
> checked the JBoss source yet), but I ran into something 
> very similar before with JBoss CMP.  I used 
> org.jboss.invocation.MarshalledValue.get() on the 
> column.
> switch (resultSetMetaData.getColumnType(column)) {
> case Types.BINARY:
> case Types.VARBINARY: {
>     byte[] bytes = resultSet.getBytes(column);
>     InputStream inputStream =
>         new ByteArrayInputStream(bytes);
>     ObjectInputStream ois =
>         new ObjectInputStream(inputStream);
>     Object obj = ois.readObject();
>     if (obj instanceof MarshalledValue) {
>         return ((MarshalledValue) obj).get();
>     } else {
>         return obj;
>     }
> }
> break;
> case Types.BLOB:
> case Types.LONGVARBINARY: {
>     InputStream inputStream =
>         resultSet.getBinaryStream(column);
>     ObjectInputStream ois =
>         new ObjectInputStream(inputStream);
>     Object obj = ois.readObject();
>     if (obj instanceof MarshalledValue) {
>         return ((MarshalledValue) obj).get();
>     } else {
>         return obj;
>     }
> }
> break;
> [...]
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-Development mailing list
JBoss-Development@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to