-
Notifications
You must be signed in to change notification settings - Fork 186
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
Problem: Classes that should be initialized at run time got initialized during image building #467
Comments
GraalVM 19.3.0 is not yet officially supported by quarkus so as first step I'd recommend to stick with 19.2.x. I'd also recommend to use camel sjms if possible as it does not depend on spring and there is an extension available on master. |
Okay, the extension camel-quarkus-sjms is not released anywhere I looked. Tried it via maven search and some googleing only to end up in the readme which tells me, it does exist. |
It is not yet available in a release but you can use it from Apache Snapshots Repo or build it from source. It will be available in the next Camel Quarkus release |
Ah okay, currently building it for our snapshot repo. I will test it out and let you know if the problem above still appears or not. |
There's a small integration test here which is far to be completed but can at least give you some hints about the dependencies and set-up |
No changes here. Used SJMS and Graal 19.2.1
|
can you share the example or part of it ? netty substitutions should be provided by one of the extensions |
Not sure, what you exactly mean. But our project setup is just a "normal" java project with quarkus at its core and camel-quarkus plus camel-quarkus-sjms and quarkus-ibmmq.
I could try to give you a variation of the project, but the quarkus-ibmmq extension is not shared for others in the internet. |
Thre's a quarkus-artemis-jms extension available, can you add it to your project ? it should alsoe bring netty substitutions |
Added the Extension and now it builds correctly. Also removed the artemis-jms-client. thanks for the help |
Now when I try to start it I get this error: Cannot auto create component: jms Which I normally only got, when there was no jms known to camel. Same happens to sjms.
|
Looks like the connection factory is misconfigured, but hard to guess why without a reproducer. |
They are configured via application.properties.
|
This is how the it is set-up in our tests: https://github.com/apache/camel-quarkus/blob/master/integration-tests/sjms/src/main/resources/application.properties#L29 It is pretty simple but that is what the extension provides at the moment |
Also before the update to 0.4.0 we used CamelRuntime and now CamelMain to work with the ContextListener. |
I guess you are parsing the property and then you create the connection factory from that one right ? |
Yes and we configure it via the key:value map.
The JMSConfig.class comes out of our IBM MQ Extension and worked for the Artemis and IBM ConnectionFactory so far. |
I think the problem is in the aartemis-jms extension as it creates a connection factory even if the configurations are empty. Can you try to add something like https://github.com/apache/camel-quarkus/blob/master/integration-tests/sjms/src/main/resources/application.properties#L29 in your application.properties ? |
Both changes have no effect. The part I showed a post back was just for the configuration. We initialize the Factories via Injection, could this be a problem? ActiveMQ
IBM MQ
|
I need to digg into it more, can you share a reproducer ? without the ibm bits of course |
Just edited the two producers we use in the last comment, if it helps. |
can you create a sample reproducer and share it on github ? that would help a lot |
Created an example without IBM MQ usage. quarkusBuild is the fastest way to directly do a first test, after importing the project. https://github.com/bframke/quarkus-examples dir: camel-producer |
I've cleaned it up and shrink-ed it to a bare minimum to reduce complexity: https://github.com/lburgazzoli/bframke-quarkus-examples/tree/cleanup/camel-producer To create connection factories, the best is to use CDI instead of putting things directly to the camel registry which is possible but should be done before routes are started otherwise registry elements can't be found. |
Okay, your example is just for one ConnectionFactory, we create several with this key:value map. Question here is, after reading through the CDI stuff, how to correctly implement it? We use the registry in the configure phase and add the routes in before start. Just injecting the example from you is already enough in that case or is there more to be done? |
I made it simpler because the example was not working out of the box so I did try to check that things are working as expected. In your code, the main problem is that |
Ah, so the AfterStart would be the better case? |
You should do it in |
Ah...darn events, thanks. Now it works. Was a bit confusing after we had to change the used events in the newer version. Factories are now registered correctly and the same is for the routes. Thanks for the help in this problem. |
can we close this ? |
Yes. |
What we are trying to do is sending Messages between IBM MQ and ActiveMQ Artemis. Therefore we use an selfmade Quarkus IBM MQ Extension and a selfmade Camel-JMS Extension. When we started the project there was no JMS support for Camel-Quarkus.
We currently face a problem with our Camel Extension. We tried to update it to a newer version to Camel 0.4.0, Graal 19.3.0 and Quarkus 1.0.0.CR2. But we receive this error message upon building a native image:
I already tried to use the
--initialize-at-run-time
and--initialize-at-build-time
parameters. The first throws the same message and the second this:I also tried to add this class via rerun and the Extension-Loader from Quarkus which also runs into an error in this case. Is there anyway for Camel to help or is the netty hub better suited for that?
The text was updated successfully, but these errors were encountered: