Bugs item #1076950, was opened at 2004-12-01 12:03
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1076950&group_id=22866

Category: JBossCMP
Group: v4.0
Status: Open
Resolution: None
Priority: 5
Submitted By: Christopher G. Stach II (cstach)
Assigned to: Nobody/Anonymous (nobody)
Summary: TimedObject id persistence fails on restart

Initial Comment:
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;

[...]

}


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=1076950&group_id=22866


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to