Skip to content

Sql aggregator does not work in native mode, solve DefaultExchangeHolder globally. #2693

@JiriOndrusek

Description

@JiriOndrusek

During fixation of #2623, I found an issue with sql aggregator in native mode.

Firstly, simple Caused by: java.lang.ClassNotFoundException: org.apache.camel.support.DefaultExchangeHolder is thrown.
Fix (by addition of ReflectiveClassBuildItem) uncovers more serious issue. Problem is happening during serialization/deserialization of DefaultExchangeHolder.

Caused by: com.oracle.svm.core.jdk.UnsupportedFeatureError: The offset of private java.lang.Exception org.apache.camel.support.DefaultExchangeHolder.exception is accessed without the field being first registered as unsafe accessed. Please register the field as unsafe accessed. You can do so with a reflection configuration that contains an entry for the field with the attribute "allowUnsafeAccess": true. Such a configuration file can be generated for you. Read BuildConfiguration.md and Reflection.md for details.
	at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:87)
	at jdk.internal.misc.Unsafe.objectFieldOffset(Unsafe.java:50)
	at java.io.ObjectStreamClass$FieldReflector.<init>(ObjectStreamClass.java:2002)
	at java.io.ObjectStreamClass.getReflector(ObjectStreamClass.java:2266)
	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:534)
	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:381)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1135)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:349)
	at org.apache.camel.processor.aggregate.jdbc.JdbcCamelCodec.encode(JdbcCamelCodec.java:98)

I've tried suggested solution and I've also tried to register class for serialization (using native approach oracle/graal#2730), but it didn't help.


Problem is solvable with native serialization. But for such a solution it would be nice to register DefaultExchangeHolder and linked types in some core module.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions