JiriOndrusek opened a new pull request #2560: URL: https://github.com/apache/camel-quarkus/pull/2560
fixes https://github.com/apache/camel-quarkus/issues/2260 @ppalaga @jamesnetherton I'm not sure about one thing, which causes user application to fail. As you can see in `CamelProcessor`, I'm getting a class from its name (snippet is lower in this comment) and `StaticAnnotationTypeConverterLoader` iterates over the methods of this class. Therefore converter class has to be registered for reflection to work in native mode. Which is done by `CamelProcess`. However if I try to use this feature from an app (not from a test - which is working). I can see: - my `System.out.println` showing, that class is registered: .. registering: [org.apache.camel.converter.NIOConverter, org.apache.camel.converter.CamelConverter, org.apache.camel.converter.CollectionConverter, org.apache.camel.converter.SQLConverter, org.apache.camel.converter.UriTypeConverter, org.apache.camel.converter.stream.StreamCacheConverter, org.apache.camel.converter.IOConverter, **org.acme.MyPairConverter**, org.apache.camel.converter.DurationConverter, org.apache.camel.converter.ObjectConverter, org.apache.camel.converter.DateTimeConverter] - followed by an error: ```` Caused by: java.lang.ClassNotFoundException: org.acme.MyPairConverter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:421) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:371) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:315) at org.apache.camel.quarkus.core.CamelRecorder.lambda$loadAnnotatedConverters$0(CamelRecorder.java:66) ```` I'm not sure why I can not create a class from its name if the class is registered for reflection (code from `CamelRecorder`) ```` public void loadAnnotatedConverters(RuntimeValue<TypeConverterRegistry> registry, Set<String> classNames) { StaticAnnotationTypeConverterLoader.load(registry.getValue(), classNames.stream().map(className -> { try { return Class.forName(className); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }).collect(Collectors.toSet())); } ```` The error from app is happening in **JVM** mode. Do you know why does it happen? <!-- Uncomment and fill this section if your PR is not trivial [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes. [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #. [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough. [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea. [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request. [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html --> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
