cailin186 / 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

concurrency exception when scanning during Servlet init #56

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Servlet
2. Override init(ServletConfig config)
3. On Webapp startup, the init method will start using the Reflections instance 
to getTypesAnnotatedWith(...)

For a view on the actual code, see init(...) definition in:
http://code.google.com/p/rendersnake/source/browse/trunk/rendersnake/src/main/ja
va/org/rendersnake/annotation/AnnotationBasedResolver.java 

What is the expected output? What do you see instead?

java.lang.RuntimeException: java.util.concurrent.ExecutionException: 
java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile

What version of the product are you using? On what operating system?

0.9.5-RC2 on Mac OSX 10.6, Java 6

Please provide any additional information below.

The code in my AnnotationBasedResolver DOES work when running a Unit test.

Original issue reported on code.google.com by ernest.m...@gmail.com on 26 Oct 2010 at 7:07

GoogleCodeExporter commented 9 years ago
javassist jar is missing in your classpath, would probably have to add it to 
the lib directory:
java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile

other option is to save scanned metadata and use Reflections.collect method, so 
that javassist is not needed and bootstrap is faster. check how in the wiki

Original comment by ronm...@gmail.com on 26 Oct 2010 at 7:39

GoogleCodeExporter commented 9 years ago
The WAR of my application contains javaassist-3.8.0.jar in de /lib folder (as a 
result of a maven build). IMO the NoClassDefFoundError does not always indicate 
the cause of the problem. In the stack, I noticed the classes are loaded in 
other threads ; this might contribute to the concurrency problems I see. I will 
spent some more time there.

I like your suggestion to pre-scan the classes and use that metadata on 
runtime. Thx!

Original comment by ernest.m...@gmail.com on 26 Oct 2010 at 7:55