You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by 吳廣鴻 <j_...@hotmail.com> on 2016/04/06 23:39:56 UTC

NullPointerException in Assembler.destroyApplication()

Hello. I seem to have encountered a NullPointerException (NPE) (bug?) in
TomEE 1.7.4 and I hope this is proper method to inform it. (Apologies if
this is not the proper place for such information). I managed to traced it
down to org\apache\openejb\assembler\classic\Assembler.java on line 1873.
containerSystem.getAppContext() can return a NULL and an attempt to
getClassLoader() produces the NPE. The method does warn of the possibility
of a NULL appContext but not before the getClassLoader().

The detail about a condition of how it could happen is when one work on two
(or more) webapp projects in NetBeans IDE and deploy them during development
to TomEE. When that happens, the two webapps share the same appId ("web").
Stopping one of the webapps is successful, but stopping the other(s)
afterward will produce the NPE. I assume it could lead to memory leakage.
Thank you.

Assembler.java:
    public void destroyApplication(final AppInfo appInfo) throws
UndeployException {
...
            final AppContext appContext =
containerSystem.getAppContext(appInfo.appId);
            final ClassLoader classLoader = appContext.getClassLoader();

            SystemInstance.get().fireEvent(new
AssemblerBeforeApplicationDestroyed(appInfo, appContext));

            if (null == appContext) {
                logger.warning("Application id '" + appInfo.appId + "' not
found in: " + Arrays.toString(containerSystem.getAppContextKeys()));
                return;
            } else {
...



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/NullPointerException-in-Assembler-destroyApplication-tp4678099.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: NullPointerException in Assembler.destroyApplication()

Posted by Romain Manni-Bucau <rm...@gmail.com>.
AppId should be unique (often a path). A "fix" could be to fail the
deployment if not versionned but not sure it would help you much.
Le 7 avr. 2016 00:11, "吳廣鴻" <j_...@hotmail.com> a écrit :

> Hello. I seem to have encountered a NullPointerException (NPE) (bug?) in
> TomEE 1.7.4 and I hope this is proper method to inform it. (Apologies if
> this is not the proper place for such information). I managed to traced it
> down to org\apache\openejb\assembler\classic\Assembler.java on line 1873.
> containerSystem.getAppContext() can return a NULL and an attempt to
> getClassLoader() produces the NPE. The method does warn of the possibility
> of a NULL appContext but not before the getClassLoader().
>
> The detail about a condition of how it could happen is when one work on two
> (or more) webapp projects in NetBeans IDE and deploy them during
> development
> to TomEE. When that happens, the two webapps share the same appId ("web").
> Stopping one of the webapps is successful, but stopping the other(s)
> afterward will produce the NPE. I assume it could lead to memory leakage.
> Thank you.
>
> Assembler.java:
>     public void destroyApplication(final AppInfo appInfo) throws
> UndeployException {
> ...
>             final AppContext appContext =
> containerSystem.getAppContext(appInfo.appId);
>             final ClassLoader classLoader = appContext.getClassLoader();
>
>             SystemInstance.get().fireEvent(new
> AssemblerBeforeApplicationDestroyed(appInfo, appContext));
>
>             if (null == appContext) {
>                 logger.warning("Application id '" + appInfo.appId + "' not
> found in: " + Arrays.toString(containerSystem.getAppContextKeys()));
>                 return;
>             } else {
> ...
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/NullPointerException-in-Assembler-destroyApplication-tp4678099.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>