tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanislas Nanchen <stanislas.nanc...@ergon.ch>
Subject OpenEJB Startup Problem : NPE in CdiScanner
Date Wed, 21 May 2014 09:24:58 GMT
Hello everyone,

We are using Tomee (and OpenEJB) 1.6.0.2 and we have a problem with the startup of OpenEBJ:
a NPE occurs in the CdiScanner: on line 260 of the CdiScanner.java, there
is a comparison between 2 ClassLoaders. (see below).

257   final ClassLoader cl = clazz.getClassLoader();
... 
260   if (!filterByClassLoader
261         || comparator.isSame(cl) || (cl.equals(scl) && startupObject.getWebContext()
== null)) {

I have debugged step by step and found that the NPE occurs when the variable clazz is
the class java.nio.charset.Charset. In this case, the classloader is null and the test
on lines 260/261 fails.

I have patched the line 261 to check whether cl is null (according to the Class API, wenn
a class
is loaded with the Bootloader, it is allowed to return null to the method Class#getClassLoader);
and it works perfectly. (It would be probably a better idea to check for null in the comparator).

Have other Tomee/OpenEJB users encountered the same problem? It seems to me strange that the
class java.nio.charset.Charset is being scanned.

Thanks for your help!
Cheers,
Stan.



stanislas.nanchen@ergon.ch +41 44 268 89 00
Ergon Informatik AG, Kleinstrasse 15, CH-8008 Z├╝rich
http://www.ergon.ch
e r g o n smart people - smart software

Mime
View raw message