vancetang / reflections

Automatically exported from code.google.com/p/reflections
Do What The F*ck You Want To Public License
0 stars 0 forks source link

Does not work in a web application #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Write a web application that uses Reflections on a package belonging to this 
application and build a war. Deploy.

What is the expected output? What do you see instead?
Reflections does not see classes under the specified package, I guess that this 
might be because they are inside the deployed war. It should see them, just as 
other classes

What version of the product are you using? On what operating system?
0.9.5 RC2, on Windows, deployed on Tomcat 5.5

Original issue reported on code.google.com by tpreal on 14 Dec 2010 at 1:49

GoogleCodeExporter commented 9 years ago
Same issue for me. I tried the following:

reflections.getSubTypesOf(baseClass);
reflections.getTypesAnnotatedWith(annotation);
reflections.getStore().getSubTypesOf(baseClass.getName());

This logic is in one of my core libraries, when I use it with a normal Java 
application it gives the expected result, however in a webapplication (with the 
same libraries included) it cannot find anything.

Result of Reflection logline in webapplication:
INFO  org.reflections.Reflections - Reflections took 179 ms to scan 9 urls, 
producing 2 keys and 2 values 

My normal Java application produces:
19:01:14.270 [main] INFO  org.reflections.Reflections - Reflections took 110 ms 
to scan 6 urls, producing 8 keys and 9 values 

These are both testprojects containing the same libraries.

Original comment by RoelBeck...@gmail.com on 18 Dec 2010 at 6:01

GoogleCodeExporter commented 9 years ago
This may be caused by having spaces in the directory getting to the class 
directory.

Ex1. "C:\Program Files\Apache Software Foundation\Tomcat 
6.0\webapps\application\WEB-INF\classes\..." would not work find a class in 
here because the path has spaces in the name.

Ex2. "C:\tomcat\webapps\application\WEB-INF\classes\..." would find the class.

More detail in: http://code.google.com/p/reflections/issues/detail?id=65

Original comment by curtis.p...@gmail.com on 5 Jan 2011 at 4:41

GoogleCodeExporter commented 9 years ago
For me it's not the reason definitely. I tried this on Linux and have this 
problem too.

Original comment by tpreal on 6 Jan 2011 at 12:56

GoogleCodeExporter commented 9 years ago
This solution works fine for me.

Original comment by alexferr...@gmail.com on 9 Feb 2011 at 8:38

GoogleCodeExporter commented 9 years ago
fixed on trunk

Original comment by ronm...@gmail.com on 12 May 2011 at 7:49