Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
M1, 1.0.0-alpha-2, 1.0.0, 1.1.0
-
None
-
Windows Server 2003
Description
In tiered classloading environments, lifecycle start --> BeansDeployer deploy --> AnnotatedElementFactory.newAnnotatedType(Class<X>) sometimes throws ClassNotFoundException and NoClassDefFoundError's from the following methods
Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(annotatedClass);
Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(annotatedClass);
These exceptions and errors are typically due to incorrect or erroneous application packaging of classes and dependencies.
I would like OpenWebBeans to continue loading other classes even if one/few classes cannot be loaded correctly i.e. the assumption is that we don't punish the majority for the crimes of a few. We define Managed Beans ONLY for classes that yield a AnnotatedType.
At runtime, if the application exercises any CDI function on the "bad" classes, then the results are indeterminate.
I will attach a patch that will explain my approach of fixing this.
java.lang.NoClassDefFoundError: com.example svt.acme.AnnuityMgmt
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:260)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
at com.ws.classloader.CompoundClassLoader._defineClass(CompoundClassLoader.java:803)
at com.ws.classloader.CompoundClassLoader.localFindClass(CompoundClassLoader.java:718)
at com.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:541)
at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
at com.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:539)
at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
at java.lang.Class.getDeclaredMethodsImpl(Native Method)
at java.lang.Class.getDeclaredMethods(Class.java:674)
at org.apache.webbeans.util.SecurityUtil$PrivilegedActionForClass.run(SecurityUtil.java:137)
at java.security.AccessController.doPrivileged(AccessController.java:203)
at org.apache.webbeans.util.SecurityUtil.doPrivilegedGetDeclaredMethods(SecurityUtil.java:84)
at org.apache.webbeans.portable.AnnotatedElementFactory.newAnnotatedType(AnnotatedElementFactory.java:102)
Attachments
Attachments
Issue Links
- relates to
-
OWB-475 support for optional beans
- Closed