]
Brian Stansberry updated WFLY-11538:
------------------------------------
Fix Version/s: 16.0.0.CR1
(was: 16.0.0.Beta1)
Opentracing - SmallRye - IllegalStateException
----------------------------------------------
Key: WFLY-11538
URL:
https://issues.jboss.org/browse/WFLY-11538
Project: WildFly
Issue Type: Bug
Components: MP OpenTracing
Affects Versions: 15.0.0.Final
Reporter: Alessandro Moscatelli
Priority: Major
Fix For: 16.0.0.CR1
Caused by: org.jboss.weld.exceptions.IllegalStateException: WELD-000713: Unable to inject
ServletContext. None is associated with ModuleClassLoader for Module
The problem is the interaction between these two:
https://github.com/wildfly/wildfly/blob/master/microprofile/opentracing-s...
https://github.com/smallrye/smallrye-opentracing/blob/1.1.1/implementatio...
Those are delivered with Wildfly 15 out of the box in:
smallrye-opentracing-1.1.1.jar
wildfly-microprofile-opentracing-smallrye-15.0.0.Final.jar
I have an EAR with a EJB jar, WAR and a common JAR library.
To reproduce the issue I created a Stateless EJB in the EJB jar and then I injected a
Traced ApplicationScoped bean from the JAR library in the Stateless EJB.
SmallRyeTracingCDIInterceptor triggers and it requires an Injected Tracer.
TracerProducer triggers and it has no active ServletContext and this leads to the error
above.
My suggestion:
I don't think the ServletContext is a really good place to store the Tracer.
I think that the Tracer created by Wildfly should be registered into the GlobalTracer.
This should be done by:
https://github.com/wildfly/wildfly/blob/master/microprofile/opentracing-s...
If you don't want Wildfly to register automatically its Tracer in the GlobalTracer,
this behavior could be disabled in the subsystem.
Also please be aware that SmallRyeTracingCDIInterceptor is dismissed in the last versions
of the library and SmallRye states (
https://github.com/smallrye/smallrye-opentracing) it
has been replaced with:
https://github.com/opentracing-contrib/java-interceptors/blob/master/src/...
Also be aware that what I am suggesting is similar to the same behavior adopted in
opentracing java-cdi (not yet integrated in Wildfly):
https://github.com/opentracing-contrib/java-cdi/blob/master/opentracing-c...
https://github.com/opentracing-contrib/java-cdi/blob/master/opentracing-c...
Also notice that opentracing java-ejb (not yet integrated in Wildfly) also requires a
registration in GlobalTracing:
https://github.com/opentracing-contrib/java-ejb/blob/master/opentracing-e...
Thank you for your support.