Sven Panko created DELTASPIKE-679:
-------------------------------------
Summary: NPE in BeanManagerProvider if parentClassLoader is null
Key: DELTASPIKE-679
URL: https://issues.apache.org/jira/browse/DELTASPIKE-679
Project: DeltaSpike
Issue Type: Bug
Components: Core
Affects Versions: 1.0.1, 1.0.0
Environment: Mac OS X 10.9, Java 1.7.45, Wildfly 8.1
Reporter: Sven Panko
I am encountering an NPE in BeanManagerProvider.getParentBeanManagerInfo() if
the parentClassLoader is null. In my scenario I had to add Wildfly's
jboss-modules.jar to the JVM's bootclasspath (using
-Xbootclasspath/a:"jboss-modules.jar"). It seems as if this causes the
parentClassLoader returned by the first statement to be null, which causes an
NPE in the following if-statement (see below). I patched my local installation
and added a check for parentClassLoader == null and everything works as
expected now.
I am honestly not 100% sure why classLoader.getParent() returns null and why
this only happens if I put the jboss-modules.jar on the bootclasspath, but
unfortunately I have to do this to circumvent a JAXP problem (see
https://community.jboss.org/thread/171177).
In addition to that I am not sure whether this is actually related to the
message "When using the BeanManager to retrieve Beans before the Container is
started, non-portable behaviour results!" At first I thought this occurred
because of @Startup I placed on some of my singleton EJBs, but even after
removing the startup annotation and using a timer to trigger initialization of
some classes, I still get this message (and my container is fully booted at
that time).
Source:
{code:java}
private BeanManagerInfo getParentBeanManagerInfo(ClassLoader classLoader)
{
ClassLoader parentClassLoader = classLoader.getParent();
if (parentClassLoader.equals(ClassLoader.getSystemClassLoader()))
{
return null;
}
BeanManagerInfo bmi = getBeanManagerInfo(parentClassLoader);
if (bmi == null)
{
bmi = getParentBeanManagerInfo(parentClassLoader);
}
return bmi;
}
{code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)