You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomee.apache.org by awmurray <al...@lexisnexis.com> on 2017/12/13 18:25:28 UTC

Application InstanceManager is null causing crash with RestEasy Provider

I've been debugging a startup error deploying a WAR in an EAR.

After downloading the source and debugging, I can see that the Instance
Manager is null
which causes line 108 to NullPointerException out.

org.apache.catalina.core.ApplicationFilterConfig.java from catalina.jar. The
version is Tomcat 8.0.5:

108: getInstanceManager().newInstance(filter);


341:    private InstanceManager getInstanceManager() {
342:        if (instanceManager == null) {
343:            if (context instanceof StandardContext) { 
344:                instanceManager =
((StandardContext)context).getInstanceManager(); // <----- THIS RETURNS NULL
345:            } else {
346:                instanceManager = new DefaultInstanceManager(null,
347:                        new HashMap<String, Map&lt;String, String>>(),
348:                        context,
349:                        getClass().getClassLoader());
350:            }
350:        }
352:        return instanceManager;
353:    }

Why would Instance Manager be null?  Must be a configuration problem?

Application Background:
=======================
I have this in tomee/apps/myappEAR/webModuleOne/WEB-INF/web/xml: 

    <display-name>webModuleOne</display-name> 
    <context-param> 
      <param-name>resteasy.providers</param-name> 
      <param-value>com.widgets.CustomThrowableMapper</param-value> 
    </context-param> 
    <context-param> 
      <param-name>resteasy.resources</param-name> 
      <param-value> 
        [a comma separated list of classes omitted] 
      </param-value> 
    </context-param> 

The exception is can't find com.widgets.CustomThrowableMapper: 

 java.lang.ClassNotFoundException: com.widgets.CustomThrowableMapper 
        at 
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285) 
        at 
org.apache.tomee.catalina.TomEEWebappClassLoader.loadWithDelegate(TomEEWebappClassLoader.java:211) 
        at 
org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(TomEEWebappClassLoader.java:201) 
        at 

The root cause is:
Caused by: java.lang.NullPointerException
	at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	... 29 more




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html

Re: Application InstanceManager is null causing crash with RestEasy Provider

Posted by awmurray <al...@lexisnexis.com>.
I am using the bundled Tomcat 8.0.5 bundled with TomEE7.0.2(plus).  I noticed
the version of that was 8.0.5 from the startup logs and downloaded the
sources.

I downgraded my Rest Easy from 3.0.4.Final to 2.3.6.Final (which I was using
with an older version of TomEE) and the Instance Manager isn't null now. 

It has a type of org.apache.tomee.catalina.JavaeeInstanceManager now and I
got past that error.

Still have a warning about this class not being found from a second WAR in
my EAR, but that WAR shouldn't even use it since that class is defined and
configured only in the first WAR's web.xml and classes directory (as I
showed previously).



--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-f982480.html

Re: Application InstanceManager is null causing crash with RestEasy Provider

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Did you try with the tomcat version compatible of tomee (8.5)?

Le 13 déc. 2017 19:25, "awmurray" <al...@lexisnexis.com> a écrit :

> I've been debugging a startup error deploying a WAR in an EAR.
>
> After downloading the source and debugging, I can see that the Instance
> Manager is null
> which causes line 108 to NullPointerException out.
>
> org.apache.catalina.core.ApplicationFilterConfig.java from catalina.jar.
> The
> version is Tomcat 8.0.5:
>
> 108: getInstanceManager().newInstance(filter);
>
>
> 341:    private InstanceManager getInstanceManager() {
> 342:        if (instanceManager == null) {
> 343:            if (context instanceof StandardContext) {
> 344:                instanceManager =
> ((StandardContext)context).getInstanceManager(); // <----- THIS RETURNS
> NULL
> 345:            } else {
> 346:                instanceManager = new DefaultInstanceManager(null,
> 347:                        new HashMap<String, Map&lt;String, String>>(),
> 348:                        context,
> 349:                        getClass().getClassLoader());
> 350:            }
> 350:        }
> 352:        return instanceManager;
> 353:    }
>
> Why would Instance Manager be null?  Must be a configuration problem?
>
> Application Background:
> =======================
> I have this in tomee/apps/myappEAR/webModuleOne/WEB-INF/web/xml:
>
>     <display-name>webModuleOne</display-name>
>     <context-param>
>       <param-name>resteasy.providers</param-name>
>       <param-value>com.widgets.CustomThrowableMapper</param-value>
>     </context-param>
>     <context-param>
>       <param-name>resteasy.resources</param-name>
>       <param-value>
>         [a comma separated list of classes omitted]
>       </param-value>
>     </context-param>
>
> The exception is can't find com.widgets.CustomThrowableMapper:
>
>  java.lang.ClassNotFoundException: com.widgets.CustomThrowableMapper
>         at
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(
> WebappClassLoaderBase.java:1285)
>         at
> org.apache.tomee.catalina.TomEEWebappClassLoader.loadWithDelegate(
> TomEEWebappClassLoader.java:211)
>         at
> org.apache.tomee.catalina.TomEEWebappClassLoader.loadClass(
> TomEEWebappClassLoader.java:201)
>         at
>
> The root cause is:
> Caused by: java.lang.NullPointerException
>         at
> org.apache.catalina.core.ApplicationFilterConfig.<init>
> (ApplicationFilterConfig.java:108)
>         ... 29 more
>
>
>
>
> --
> Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Dev-
> f982480.html
>