سؤال

I'm trying to upgrade an application to Java 7 from Java 6 and I'm getting a new exception that isn't present when running the application under Java 6.

Here's the first section of the stack trace:

java.lang.ClassCastException: java.lang.String cannot be cast to org.jboss.serial.finalcontainers.IntegerContainer
    at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readInt(DataContainer.java:1044)
    at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:310)
    at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:273)
    at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
    at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:412)
    at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
    at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:845)
    at org.jboss.serial.persister.RegularObjectPersister.readSlotWithFields(RegularObjectPersister.java:353)
    at org.jboss.serial.persister.RegulrObjectPersister.defaultRead(RegularObjectPersister.java:273)
    at org.jboss.serial.persister.RegularObjectPersister.readData(RegularObjectPersister.java:241)
    at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.readObjectDescriptionFromStreaming(ObjectDescriptorFactory.java:412)
    at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.objectFromDescription(ObjectDescriptorFactory.java:82)
    at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readObject(DataContainer.java:845)
    at org.jboss.serial.persister.ObjectInputStreamProxy.readObjectOverride(ObjectInputStreamProxy.java:68)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:364)
    at java.util.ArrayList.readObject(ArrayList.java:733)
    at sun.reflect.GeneratedMethodAccessor352.invoke(Unknown Source)

I found this JBoss bug, which is supposedly fixed... https://issues.jboss.org/browse/JBSER-128

but the version it's fixed in (1.0.6.FINAL) hasn't been released yet: https://issues.jboss.org/browse/JBSER

Has anybody run into this that could suggest a workaround?

The application runs in JBoss 6.0.0.

PS I am aware that JBoss 6 is past its EOL and not tested with Java 7.

هل كانت مفيدة؟

المحلول 2

I found a workaround solution for my problem. Since Java 7 changed the serialization behavior of Vector, I changed to ArrayList (which did not change) and the problem has been resolved.

Hope this helps somebody out there struggling with the same issue.

نصائح أخرى

Well, you could build the release yourself from the tag in the SVN repo. Or if you're really trusting (or want to do a quick experiment) download the binary I built (here, won't promise they stay online though).

Just replace all occurrences of the jar in the JBoss distribution and don't forget to enable the fix with system property

-Dorg.jboss.serial.sync_binary_formats=true

As highlighted here https://issues.jboss.org/browse/JBSER-128?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel

Anyhow for me this worked for Vectors at least (there's other potential problems, but not being able to transfer CCHashMaps I'll survive ;) ).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top