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 (war packaging) #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. deploy war on jboss.
2. Code is:

// Replaces dots with slashes
final String packagePreffix = "com.example";
final String preffix = packagePreffix.replace(".", "/");

// Find urls
Enumeration<URL> urlEnumeration;
try {
    urlEnumeration = ClasspathHelper.getContextClassLoader().getResources(preffix);
} catch (IOException e) {
    throw new ApplicationException(e);
}
final List<URL> urls = 
Lists.newArrayList(Iterators.forEnumeration(urlEnumeration));

// Create the confBuilder with urls and type annotation scanner
final ConfigurationBuilder confBuilder = new 
ConfigurationBuilder().setUrls(urls);
confBuilder.setScanners(new TypeAnnotationsScanner());

Reflections reflections = new Reflections(confBuilder);
Set<Class<?>> annotatedTypes = 
reflections.getTypesAnnotatedWith(MyAnnotation.class);

....

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. 
Reflections see classes when the project is deployed as folder with the 
extension ".war"

What version of the product are you using? On what operating system?
0.9.5, on Windows/Linux, deployed on Jboss EAP 6

Original issue reported on code.google.com by jval...@exe.cl on 23 Feb 2013 at 12:43

GoogleCodeExporter commented 9 years ago
We had it working with 0.9.6 on OC4J 10.1.3.5

No longer working with 0.9.8 on this application server.

Original comment by keesvand...@gmail.com on 4 Mar 2013 at 3:18

GoogleCodeExporter commented 9 years ago
should be ok with 0.9.9. is it so?

Original comment by ronm...@gmail.com on 23 Mar 2013 at 4:14

GoogleCodeExporter commented 9 years ago
0.9.9 seems to be working with JBoss7. Thanks!

Original comment by saraswat...@gmail.com on 9 Apr 2013 at 4:02

GoogleCodeExporter commented 9 years ago

Original comment by ronm...@gmail.com on 9 Apr 2013 at 6:42