[
https://issues.apache.org/jira/browse/DAFFODIL-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17757623#comment-17757623
]
Steve Lawrence commented on DAFFODIL-2728:
------------------------------------------
I found this scala bug that talks about confusing error messages/exceptions
related to deserialization and proxys:
https://github.com/scala/bug/issues/9777
See the comment in the "FailingTest", which sounds just like what's happening
here. Likely we are getting a ClassNotFoundException (which our reload logic
handles), but something in Java or Scala deserialization ends up causing that
to become a confusing ClassCastException.
Here's other issues where comments mentions this kind of thing:
https://github.com/scala/bug/issues/11204
https://github.com/scala/bug/issues/9237
The latter claims this is just how serialization works and there's nothing that
can really be done about it on Scala's side.
So likely the best we can do is catch the ClassCastException when we reload,
and output a generic message about ensuring all jars are on the classpath,
since the current message is completely useless and confusing.
> Missing layer plugin causes abort "this is a bug"
> -------------------------------------------------
>
> Key: DAFFODIL-2728
> URL: https://issues.apache.org/jira/browse/DAFFODIL-2728
> Project: Daffodil
> Issue Type: Bug
> Components: Back End
> Affects Versions: 3.4.0
> Reporter: Mike Beckerle
> Assignee: Mike McGann
> Priority: Major
> Fix For: 3.5.0
>
>
> If you pre-compile a schema to a binary file, then try to parse data with it,
> without setting up the DAFFODIL_CLASSPATH to provide access to a layer
> plugin, you get an abort during deserialization (i.e., reload) of the stored
> parser.
> The workaround is of course just setup the DAFFODIL_CLASSPATH for running the
> CLI the same as when the parser was compiled and saved.
> {code:java}
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !! An unexpected exception occurred. This is a bug! !!
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Please report this
> bug and help us fix it: https://daffodil.apache.org/community/#issue-tracker
> Please include the following exception, the command you
> ran, and any input, schema, or tdml files used that led
> to this bug.
> java.lang.ClassCastException: cannot assign instance of
> scala.collection.immutable.HashMap$SerializationProxy to field
> org.apache.daffodil.processors.parsers.ChoiceDispatchCombinatorParserBase.dispatchBranchKeyMap
> of type scala.collection.immutable.Map in instance of
> org.apache.daffodil.processors.parsers.ChoiceDispatchCombinatorParser
> at
> java.base/java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(ObjectStreamClass.java:2227)
> at
> java.base/java.io.ObjectStreamClass$FieldReflector.checkObjectFieldValueTypes(ObjectStreamClass.java:2191)
> at
> java.base/java.io.ObjectStreamClass.checkObjFieldValueTypes(ObjectStreamClass.java:1478)
> at
> java.base/java.io.ObjectInputStream$FieldValues.defaultCheckFieldValues(ObjectInputStream.java:2657)
> at
> java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2471)
> at
> java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2242)
> at
> java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1742)
> at
> java.base/java.io.ObjectInputStream$FieldValues.<init>(ObjectInputStream.java:2584)
> at
> java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2442)
> at
> java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2242)
> at
> java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1742)
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)