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)
- Closing org.springframework.web.context.support.GenericWebApplicationContext issue during running Test class HOT 3
- Configuration property parsing list has unexpected behavior HOT 2
- @RedisHash timeToLive is a long, which is not compatible with the use of SPeL HOT 1
- Run Docker-based tests serially
- Run Docker-based tests serially
- Combine tests for standard and Bitnami images into single classes
- Replace RFC 7807 by RFC 9457 in property documentation
- Combine tests for standard and Bitnami images into single classes
- Rework fix for #21992 to avoid polluting Gradle Module Metadata with mavenOptional… variants
- SpringBoot Liquibase Support of rollback automatically HOT 1
- Improve classpath index documentation for reproducible builds HOT 3
- Tracing propagation does not work in ControllerAdvice with async controllers since 3.2.7 HOT 6
- Polish gh-40023
- Rework fix for #21992 to avoid polluting Gradle Module Metadata with mavenOptional… variants
- Rework fix for #21992 to avoid polluting Gradle Module Metadata with mavenOptional… variants
- Update Kotlin DSL examples that configure the environment of bootBuildImage to be additive
- Update Kotlin DSL examples that configure the environment of bootBuildImage to be additive
- Make buildSrc's custom tasks consistently abstract
- Make buildSrc's custom tasks consistently abstract
- Make buildSrc's custom tasks consistently abstract
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.