Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-6106 Update JBoss Serialization in JBoss EAP 4.3 CP10
  3. JBPAPP-6101

JDK 6_19 update breaks deserialization of java.io.File results in ClassCastException

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Major Major
    • 4.3.0.GA_CP10
    • 4.3.0.GA
    • Other
    • None
    • JBoss EAP 4.3.x on Sun JDK 6_19 and higher

    • Hide
      An update to the way <classname>java.io.File</classname> deserialized in JDK 6 Update 19 caused a binary incompatibility in JBoss Serialization. EJB clients running in the same JVM as the EJB failed with a ClassCastException. The fix makes serialization/deserialziation binary compatible with the java.io.File functionality in JDK 6 Update 19.

      A parameter must be set at startup for customers that are running this JDK version or higher. Set <parameter>-Dorg.jboss.serial.SYNC_SERIALIZATION_BINARY_FORMATS=true</parameter> to enable the fix.
      <important><para>In a clustered environment, JBoss Serialization is used when Stateful EJBs are passivated which is then replicated to the other JBoss instances in the cluster. You must set the parameter on all clustered JBoss instances affected by this issue so the nodes can communicate correctly when Stateful EJBs are used. </para></important>
      Show
      An update to the way <classname>java.io.File</classname> deserialized in JDK 6 Update 19 caused a binary incompatibility in JBoss Serialization. EJB clients running in the same JVM as the EJB failed with a ClassCastException. The fix makes serialization/deserialziation binary compatible with the java.io.File functionality in JDK 6 Update 19. A parameter must be set at startup for customers that are running this JDK version or higher. Set <parameter>-Dorg.jboss.serial.SYNC_SERIALIZATION_BINARY_FORMATS=true</parameter> to enable the fix. <important><para>In a clustered environment, JBoss Serialization is used when Stateful EJBs are passivated which is then replicated to the other JBoss instances in the cluster. You must set the parameter on all clustered JBoss instances affected by this issue so the nodes can communicate correctly when Stateful EJBs are used. </para></important>
    • Documented as Resolved Issue
    • ON_QA

      JBoss Serialization fails because the JDK 6 update 19 changes the way java.io.File deserializes. java.io.File uses defaultWriteObject when serializing and uses defaultReadObject prior to update 19. For 19 and higher, it uses defaultWriteObject when serializing and uses readFields when deserializing. JBoss Serialzation's format is not binary compatiable when using defaultWriteObject and then using readFields. This causes EJB clients that are running in the same JVM as the EJB to fail with the ClassCastException below.

      JDK 6_18
      private synchronized void readObject(java.io.ObjectInputStream s)
      throws IOException, ClassNotFoundException

      { s.defaultReadObject(); char sep = s.readChar(); // read the previous separator char if (sep != separatorChar) this.path = this.path.replace(sep, separatorChar); this.path = fs.normalize(this.path); this.prefixLength = fs.prefixLength(this.path); }

      ****************************************************************************************
      JDK 6_19
      private synchronized void readObject(java.io.ObjectInputStream s)
      throws IOException, ClassNotFoundException

      { ObjectInputStream.GetField fields = s.readFields(); String pathField = (String)fields.get("path", null); char sep = s.readChar(); // read the previous separator char if (sep != separatorChar) pathField = pathField.replace(sep, separatorChar); this.path = fs.normalize(pathField); this.prefixLength = fs.prefixLength(this.path); }

      The exception is:

      Caused by: java.lang.reflect.UndeclaredThrowableException
      at $Proxy71.hello(Unknown Source)
      at com.jboss.examples.ejb3.gui.BackingBean.hello(BackingBean.java:62)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
      at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      at org.apache.jasper.el.JspMethodExpression.invoke(JspMethodExpression.java:68)
      at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
      ... 26 more
      Caused by: java.io.IOException
      at org.jboss.serial.persister.RegularObjectPersister.readSlotWithMethod(RegularObjectPersister.java:107)
      at org.jboss.serial.persister.RegularObjectPersister.defaultRead(RegularObjectPersister.java:269)
      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.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.io.MarshalledObjectForLocalCalls.get(MarshalledObjectForLocalCalls.java:60)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:96)
      at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
      ... 36 more
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.serial.persister.RegularObjectPersister.readSlotWithMethod(RegularObjectPersister.java:103)
      ... 52 more
      Caused by: org.jboss.serial.exception.SerializationException: Excepted to be int
      at org.jboss.serial.objectmetamodel.DataContainer$DataContainerInput.readInt(DataContainer.java:1048)
      at org.jboss.serial.persister.ObjectInputStreamProxy.readInt(ObjectInputStreamProxy.java:156)
      at org.jboss.serial.objectmetamodel.FieldsContainer.readMyself(FieldsContainer.java:214)
      at org.jboss.serial.persister.ObjectInputStreamProxy.readFields(ObjectInputStreamProxy.java:224)
      at java.io.File.readObject(File.java:1927)
      ... 57 more
      Caused by: 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)
      ... 61 more

              rhn-support-bmaxwell Brad Maxwell
              rhn-support-bmaxwell Brad Maxwell
              Jared Morgan Jared Morgan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: