3 Replies Latest reply on Apr 9, 2018 11:54 AM by Yves Martin

    WildFly 12 fails to serialize Throwable thrown by EJB

    Yves Martin Newbie

      Hello

      Our team is upgrading an application from WildFly 9 to 12 and we not face strange trouble when application remote EJB raises a "business" exception. Marshaling fails with:

      WFLYEJB0054: Failed to marshal EJB parameters, Caused by: java.lang.IllegalStateException: Constructor is unexpectedly inaccessible
                      at org.jboss.marshalling.reflect.SerializableClass.invokeConstructorNoException(SerializableClass.java:377)
                      at org.jboss.marshalling.reflect.SerializableClass.callNonInitConstructor(SerializableClass.java:332)
                      at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:248)
                      at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:130)
                      at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:391)
                      at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:311)
                      at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:279)

       

      When investigating in debug mode with break points, here is original exception (disappointingly swallowed) at jboss-marshalling/SerializableClass.java at master · jboss-remoting/jboss-marshalling · GitHub

      java.lang.IllegalAccessException: Class org.jboss.marshalling.reflect.SerializableClass can not access a member of class java.util.AbstractList with modifiers "protected"

       

      One step deeper, our understanding is that SerializingCloner.clone(Object, boolean) line: 248  cannot instantiate  java.util.AbstractList (nonSerializable) when clonedClass is java.util.ArrayList.

      This happens when processing Throwable.suppressedExceptions:

          /**
            * The list of suppressed exceptions, as returned by {@link
            * #getSuppressed()}.  The list is initialized to a zero-element
            * unmodifiable sentinel list.  When a serialized Throwable is
            * read in, if the {@code suppressedExceptions} field points to a
            * zero-element list, the field is reset to the sentinel value.
            *
            * @serial
            * @since 1.7
            */
           private List suppressedExceptions = SUPPRESSED_SENTINEL;

       

      Is that a WildFly bug or does our application now face more strict behaviour from WildFly compared to previous versions?

      Thank you in advance for your help

      Best regards

      Yves Martin