tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanislas Nanchen <stanislas.nanc...@ergon.ch>
Subject Re: OpenEJB Startup Problem : NPE in CdiScanner
Date Mon, 26 May 2014 10:34:41 GMT
Hello,

I found the culprit: for some (not yet explained reasons), our gradle script
write a copy of java.nio.charset.* to the WEB-INF/classes directory and
therefore these classes are scanned and found by the IAnnotationFinder.

Sorry for the noise! and thank for the help.
Cheers,
Stan.


----- Original Message -----
From: "Romain Manni-Bucau" <rmannibucau@gmail.com>
To: users@tomee.apache.org
Sent: Monday, 26 May, 2014 10:10:38 AM
Subject: Re: OpenEJB Startup Problem : NPE in CdiScanner

Hi

basically it is computed from the classes found in the webapp so java.nio
shouldn't be here in AnnotationDeployer you can find a method
getBeanClasses or something like that.


You can't reproduce it in a shareable sample?




Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau


2014-05-26 9:54 GMT+02:00 Stanislas Nanchen <stanislas.nanchen@ergon.ch>:

> Hi everyone,
>
> Thank you for the answers and sorry for the late answer. I have dumped the
> beans.managedClasses variable (line 186 in CdiScanner).
>
> The set is too big to be printed (1672 classes); almost all classes are
> from our application.
> not from our applications are:
> - some classes of google guava (from the packages annotations, base,
> collect)
> - 4 classes of java.nio
>   "java.nio.charset.Charset",
>   "java.nio.charset.Charset$1",
>   "java.nio.charset.IllegalCharsetNameException",
>   "java.nio.charset.UnsupportedCharsetException"
> - classes of vaadin cdiutils package : org.vaadin.virkki.cdiutils.
>
> I'm checking now for duplicate libraries. I would be interested to know how
> this set is computed, maybe i can find out why the java.io classes are
> included.
>
> I'm also checking our runtime environment for duplicates. (thank you for
> the hint).
> cheers,
> stan.
>
>
> ----- Original Message -----
> From: "Andy Gumbrecht" <agumbrecht@tomitribe.com>
> To: users@tomee.apache.org
> Sent: Thursday, 22 May, 2014 2:46:09 PM
> Subject: Re: OpenEJB Startup Problem : NPE in CdiScanner
>
> What is your runtime environment?
>
> I also think I may have seen this when there are duplicate libraries on
> the classpath, just not sure where :-\
>
> Switch to debug logging and see if there is anything else in the logs
> that may throw some more light on this.
>
> Andy.
>
> On 22/05/2014 08:59, Romain Manni-Bucau wrote:
> > PS: maybe dump in CdiScanner value of beans.managedClasses
> >
> > shouldn't contain any JVM classes
> >
> >
> >
> > Romain Manni-Bucau
> > Twitter: @rmannibucau
> > Blog: http://rmannibucau.wordpress.com/
> > LinkedIn: http://fr.linkedin.com/in/rmannibucau
> > Github: https://github.com/rmannibucau
> >
> >
> > 2014-05-22 8:48 GMT+02:00 Romain Manni-Bucau <rmannibucau@gmail.com>:
> >
> >> Hi
> >>
> >> I'll try to have a quick look to check few thing but a sample showing it
> >> would be great. A if (!= null) would surely work for you but is not
> really
> >> compatible with this logic (well not alone ;))
> >>
> >>
> >>
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >> 2014-05-22 7:50 GMT+02:00 Stanislas Nanchen <stanislas.nanchen@ergon.ch
> >:
> >>
> >> Hi,
> >>> I think we use it quite "normally". The problem arised when we upgraded
> >>> a library (vaadin from 7.1.10 to 7.2). However the vaadin jar does not
> >>> contain any beans.xml file.
> >>>
> >>> How can I investigate more?
> >>>
> >>> As Class#getClassLoader() can be null, I think it would be a good idea
> >>> to check for this, e.g. in the comparator. Should I submit a patch?
> >>>
> >>> Cheers.
> >>> Stan.
> >>>
> >>> ----- Original Message -----
> >>> From: "Romain Manni-Bucau" <rmannibucau@gmail.com>
> >>> To: users@tomee.apache.org
> >>> Sent: Wednesday, 21 May, 2014 11:33:21 AM
> >>> Subject: Re: OpenEJB Startup Problem : NPE in CdiScanner
> >>>
> >>> Hi
> >>>
> >>> how do you use it? Charset can't be in this class list normally
> >>>
> >>>
> >>>
> >>> Romain Manni-Bucau
> >>> Twitter: @rmannibucau
> >>> Blog: http://rmannibucau.wordpress.com/
> >>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >>> Github: https://github.com/rmannibucau
> >>>
> >>>
> >>> 2014-05-21 11:24 GMT+02:00 Stanislas Nanchen <
> stanislas.nanchen@ergon.ch
> >>>> :
> >>>> 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
> >>>>
> >>
>
> --
>    Andy Gumbrecht
>
>    http://www.tomitribe.com
>    agumbrecht@tomitribe.com
>    https://twitter.com/AndyGeeDe
>
>    TomEE treibt Tomitribe! | http://tomee.apache.org
>

Mime
View raw message