Comments (6)
With a change in Boot so that ActiveMQConnectionFactory
is no longer created using reflection, a problem with the reachability metadata is revealed:
Caused by: java.io.IOException: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/tcp
at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.loadProperties(FactoryFinder.java:104)
at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.create(FactoryFinder.java:61)
at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:154)
at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:182)
... 39 more
While reachability metadata is provided for activemq-client
, there is none for activemq-client-jakarta
so the META-INF/services/org/apache/activemq/transport/tcp
resource is not available in the native image. This resource refers to org.apache.activemq.transport.tcp.TcpTransportFactory
which will require some further reachability metadata.
from spring-boot.
I've pushed a fix for the Boot side of things. Please open a reachability metadata issue or PR for the activemq-client-jakarta
piece.
from spring-boot.
My understanding is that all Spring Starters should work out the box with Spring Native but I may have misread this.
Can you please point us to the documentation that gave you this impression? It's not the case as we offer starters for some projects that cannot be made to work with GraalVM. The Known Limitations section of the reference documentation and the wiki page to which it links should reflect the currently known state of things.
uses
@ConditionalOnProperty
and.enable
properties which according to the documentation is not supported
The properties are supported, but when they change the application's beans, they must be set at build time.
I was able to get past this error by creating the
ActiveMQConnectionFactory
bean directly
The problem here is that the ActiveMQConnectionFactory
instance is being created through reflection. You could also work around the problem by providing a runtime hint that allows ActiveMQConnectionFactory
to be instantiated using reflection.
Looking at the code, we could either add those hints in Spring Boot (as it's our code that's using reflection), or I think we could remove the use of reflection entirely. Whether or not that's enough to get ActiveMQ working in a native image remains to be seen as there may be other uses of reflection in ActiveMQ itself where some reachability metadata would be required.
from spring-boot.
Can you please point us to the documentation that gave you this impression? It's not the case as we offer starters for some projects that cannot be made to work with GraalVM. The Known Limitations section of the reference documentation and the wiki page to which it links should reflect the currently known state of things.
I may have confused documentation with what someone may have stated in a Youtube video (its all blending together from my learning time hehe). But thank you for the links to the limitations. That could have answered some questions I had a while ago a bit faster.
The properties are supported, but when they change the application's beans, they must be set at build time.
Ahh I misread the doc. That makes much more sense. Thanks for the clarity.
The problem here is that the
ActiveMQConnectionFactory
instance is being created through reflection. You could also work around the problem by providing a runtime hint that allowsActiveMQConnectionFactory
to be instantiated using reflection.
I've been trying to understand how the runtime hints work but don't have a full understanding yet. I used the tracing agent to generate the json files when running the applicationand placed them in the META-INF/native-image
folder under src/main/resources
but that didn't resolve the error. It did show the class with the method as well which I found a bit odd for it not to work. Do you have some examples on how the runtime hints would apply or is that something that would have to go on the auto configuration code to be applied effectively? I would definitely prefer to use the properties if possible vs creating the factory directly.
in ActiveMQ itself where some reachability metadata would be required.
There is already metadata added for the ActiveMQ client it seems here. Again I'm still a bit new to it all but I'm not sure if the version has to be an exact match or just above the version available as the current client is 6.1.2.
from spring-boot.
Also just to add some clarity, I wanted to state that the purpose of this issue is mainly to see if the auto config for ActiveMQ could be corrected to help developers using Native to work easier. As you have stated:
Looking at the code, we could either add those hints in Spring Boot (as it's our code that's using reflection), or I think we could remove the use of reflection entirely.
The original autoconfig I believe was probably made this way because the ActiveMQ factory requires different classes if it uses pools or not. Without duplicating all of the logic for each class, this was a clever way to reuse the code. The new tech is challenging those decisions now but I don't feel its anything that can't be resolved with the new understanding while keeping the expected outcome.
from spring-boot.
Wow you fixed that really quickly! Thanks! I have created an issue.
from spring-boot.
Related Issues (20)
- spring-boot-testcontainers causes unwanted container initialization during AOT processing
- EL-based validation message interpolation does not work when using MessageSource HOT 3
- @EventListener invoked on a proxy HOT 1
- startup failure when the component class contain the ahth0 Algorithm abstract class
- Spring boot native with jetty cannot be started #2 HOT 1
- Use latest Framework 6.0.x versions when downgrading it for compatibility with version of Gradle that do not support multi-release jars
- Use latest Framework 6.0.x versions when downgrading it for compatibility with version of Gradle that do not support multi-release jars
- Use latest Framework 6.0.x versions when downgrading it for compatibility with version of Gradle that do not support multi-release jars
- Correct grammar in 'Running your Application with Maven'
- Correct grammar in 'Running your Application with Maven'
- Test Gradle plugin against Gradle 8.10
- Test Gradle plugin against Gradle 8.10
- Test Gradle plugin against Gradle 8.10
- Launcher's ClassLoader is no longer parallel capable
- Launcher's ClassLoader is no longer parallel capable
- Use activemq-bom
- Improve documentation on registering custom system environment property source via environment post processor HOT 2
- Maven binaries should be cleared if necessary
- Maven binaries should be cleared if necessary
- Configuring metric `percentiles-histogram` and `percentiles` disables the `quantile` tag since at least `Spring Boot 3.3.1` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-boot.