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
Call to classgraph inside JAX-RS endpoint does not find any results #515
Comments
Your first guess is probably correct -- this classloader is almost certainly not supported. You can see the supported classloaders here, as well as many examples of how to support a classloader: I even wrote a fallback Please try to introspect/debug your instance of |
@Restage Please let me know when you get a chance to look at the internal fields and methods of the classloader. I cloned the git repo you provided, but I have no idea how to launch it the two different ways you mentioned (let alone how to launch it in the debugger)... |
Hello @Restage! I try to fix and close bug reports quickly -- typical turnaround time is around 24 hours once I have all the information I need. I would appreciate your response so I can get this fixed! Thanks. |
Hi @lukehutch, depending on you IDE you need to build the sample application and deploy it to TomEE. In my case I used the webprofile 8.0.6 version. You then need to to call either the servlet or rest endpoint to see the difference. I also tried to write a new ClassLoaderHandler. But I'm stuck right now because I'm not sure how to implement For
For
My plan was to analyze how other ClassLoaderHandler do their work but the time I can put into this topic is very limited at the moment. Maybe in the course of the weekend. The target
|
You're on the right track. The order you call If this is the right definition of CxfContainerClassLoader, then you can see the delegation order in
The There's nothing to do in Sorry that that's not properly documented, I see how it would be confusing for this situation. I checked a quick prototype of the |
Incidentally |
Actually I couldn't understand why I took a shot at writing a Thanks! |
@Restage do you want me to push out a release with these two (untested) ClassLoaderHandler instances? They should work, fingers crossed, but I don't know how to test them. |
@Restage I released the new |
Hi @lukehutch,
You might try these steps to run the example:
Depending on your IDE you might be able to integrate TomEE, start the example and debug the application. |
Thank you very much for the detailed instructions for running the code. ClassGraph supports dozens of runtime environments, and I can't possibly learn them all, so this was very helpful. You are right, I forgot to add the two new The reason that adding
It turns out that The issue with The result of this is that a Fixing this will require modifying ClassGraph a bit to handle this weird case, so that I don't use |
@Restage : OK, with this change to use Thank you for all your detailed assistance to get this fixed! |
Hi,
I’ve started a small project in which I use the neo4j-ogm library, which itself uses classgraph to find relevant entity classes.
Since this application was never able to find any of my entities, no matter in which package they reside, I did some research to find the root cause of the problem.
In the end I discovered that using classgraph inside a servlet works perfect.
I got
de.test.classgraph.ClassToFind
as the expected result.But as soon as I put the same code inside a JAX-RS endpoint classgraph fails to find my class.
The application with both endpoints has been deployed on apache-tomee-webprofile-8.0.6.
I then took a look at the classgraph log output and discovered that different classloaders where used.
Calling the servlet brought
while accessing the JAX-RS endpoint gave me
So I was hoping that overriding the classloader might give me the expected result. But enhancing the configuration to
didn't find the class either.
This repository contains the full example.
So is this a bug or am I doing something wrong?
Best regards
The text was updated successfully, but these errors were encountered: