Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a Camel-main batch application #1474

Closed
gus-maurizio opened this issue Jul 13, 2020 · 9 comments
Closed

Running a Camel-main batch application #1474

gus-maurizio opened this issue Jul 13, 2020 · 9 comments

Comments

@gus-maurizio
Copy link

Hi. I have been trying to run a simple camel-main (new in CR3) application in java and kotlin. No luck.
Any examples or pointers highly appreciated (in java or kotlin, both better hehehe).

Exception in thread "main" java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @7068f7ca wants to load class io.quarkus.bootstrap.model.AppModel. A different class with the same name was previously loaded by 'app'. (io.quarkus.bootstrap.model.AppModel is in unnamed module of loader 'app') at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:130) at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:56) Caused by: java.lang.LinkageError: loader constraint violation: loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @7068f7ca wants to load class io.quarkus.bootstrap.model.AppModel. A different class with the same name was previously loaded by 'app'. (io.quarkus.bootstrap.model.AppModel is in unnamed module of loader 'app')

@lburgazzoli
Copy link
Contributor

can you share an example ?
we have this small example but may not be what you were looking for

@gus-maurizio
Copy link
Author

Ciao Luca. It is basically that example (with a few embellishments). Added the camel-main, camel-log, camel-timer to the pom.xml and it compiles ok. The problems are trying to do mvn clean quarkus:dev (I get the messages above) and java -jar ....-runner.jar when I get the messages below:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/camel/quarkus/core/CamelConfig$$accessor at io.quarkus.runtime.generated.Config.<clinit>(Config.zig:590) at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:45) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.base/java.lang.Class.newInstance(Class.java:584) at io.quarkus.runtime.Quarkus.run(Quarkus.java:60) at io.quarkus.runtime.Quarkus.run(Quarkus.java:38) at com.example.Main.main(Main.java:11) Caused by: java.lang.ClassNotFoundException: org.apache.camel.quarkus.core.CamelConfig$$accessor 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:522) ... 10 more

The main class is simple:
`
package com.example;

import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.annotations.QuarkusMain;
import org.apache.camel.quarkus.main.CamelMainApplication;

@QuarkusMain
public class Main {
public static void main(String... args) {
Quarkus.run(CamelMainApplication.class, args);
}
}
`

@lburgazzoli
Copy link
Contributor

do you mind sharing the entire project ? just to be sure I'm testing the same thing

@gus-maurizio
Copy link
Author

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jul 13, 2020

camel-quarkus 1.0.0-CR3 is based on quarkus 1.6.0.Final so I think the only think you need to do is changing the quarkus versions the pom

@gus-maurizio
Copy link
Author

That did it. Thanks!

@gus-maurizio
Copy link
Author

Just one more question.It seems like the bean used in some examples (pasted here below) is compiling fine but cannot be found. Has something changed in CR3 regarding CDI and injections?

`
package com.example;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;
import io.quarkus.runtime.annotations.RegisterForReflection;

@ApplicationScoped
@nAmed("myNamedBean")
@RegisterForReflection
public class NamedBean {
public String hello(String name) {
return "Hello " + name + " from the NamedBean";
}
}
`

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jul 13, 2020

you need camel-quarkus-bean extension, forgo to tell you that before

@gus-maurizio
Copy link
Author

Aha!!! wonderful, might be good to add that in the documentation.
your next Chianti is on me!

@ppalaga ppalaga added this to the No fix/wont't fix milestone Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants