dev@glassfish.java.net

Re: WEB0600: failed to deploy and has been disabled: java.lang.NullPointerException

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Fri, 03 Aug 2007 03:24:34 -0400

Thanks to Hong and Jan for the offer to help. With Jan's patch, I got
this in server.log [1]

As I said earlier, despite this error, deployment *did succeed* and the
app *was* put into service. But the servlet filter is not invoked at
all, and may be other random behaviors.

 From the stacktrace, it's a ejb-ref that has caused this NPE. This is
how I declare it in web.xml:
<ejb-ref>
        <ejb-ref-name>helloBean2</ejb-ref-name>
        
<remote>com.sun.ts.tests.ejb30.common.helloejbjar.HelloRemoteIF</remote>
    </ejb-ref>

If I add a <ejb-ref-type>Session</ejb-ref-type>, everything works fine.
<ejb-ref-type> is optional in JavaEE 5 and all my modules are JavaEE 5
versions.

The similar <ejb-ref> declarations work in appclient and ejb. It failed
with web container, probably there is legacy tomcat code involved here?

This is somewhat related to issue 1265, which I filed in 10/2006
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1265 (Fail to
deploy apps when ejb-ref element does not have ejb-ref-type)

I have created a simple ejb module and web module to reproduce this
problem. Attached are a ejb-jar (foo-ejb.jar) and a NetBeans projects
for the web module.

Thanks,
-cheng


[1]
[#|2007-08-02T20:47:29.875-0400|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=14;_Th
readName=pool-1-thread-6;_RequestID=0243bda4-216d-42fe-a7c7-b07ef010d5ec;|WEB0600:
WebModule [/ejb3_assembly_m
etainfandlibdir] failed to deploy and has been disabled^M
java.lang.NullPointerException^M
        at java.util.Hashtable.put(Hashtable.java:396)^M
        at
org.apache.catalina.deploy.NamingResources.addEjb(NamingResources.java:175)^M
        at
org.apache.catalina.core.StandardContext.addEjb(StandardContext.java:2334)^M
        at
com.sun.enterprise.web.TomcatDeploymentConfig.configureContextEjb(TomcatDeploymentConfig.java:298)^
M
        at
com.sun.enterprise.web.TomcatDeploymentConfig.configureEjbReference(TomcatDeploymentConfig.java:243
)^M
        at
com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:195)^M
        at
com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:240)^M
        at
com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:156)^M
        at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:143)^M
        at
org.apache.catalina.core.StandardContext.start(StandardContext.java:5086)^M
        at com.sun.enterprise.web.WebModule.start(WebModule.java:327)^M
        at
com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)^M
        at
com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:296)^M
        at
com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:330)^M
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)^M
        at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)^M
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)^M
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)^M
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)^M
        at java.lang.Thread.run(Thread.java:595)^M
|#]^M

Jan.Luehe_at_Sun.COM wrote:
> Hi Cheng,
>
> Cheng Fang wrote:
>
>> Hi,
>>
>> I'm seeing the following exception when deploying my app to a recent
>> nightly build. I couldn't figure out what could've caused the NPE.
>> Turning on logging FINE in web-container didn't give more details.
>> Verifier also reported success on my app.
>>
>> I searched a few modules in my glassfish workspace but couldn't find
>> where this NPE is from (I don't have all modules in my workspace).
>> Although the error message says the web module has been disabled, I
>> can still access this webapp, except a servlet filter is not invoked.
>>
>> Could someone shed light on this?
>>
>> Thanks,
>> -cheng
>>
>> [#|2007-08-02T04:18:34.078-0400|INFO|sun-appserver9.1|javax.enterprise.system.core.classloading|_ThreadID=15;_
>>
>> ThreadName=httpWorkerThread-4848-0;ejb3_assembly_metainfandlibdir;|LDR5010:
>> All ejb(s) of [ejb3_assembly_metai
>> nfandlibdir] loaded successfully!|#]^M
>> ^M
>> [#|2007-08-02T04:18:34.093-0400|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=15;_Th
>>
>> readName=httpWorkerThread-4848-0;/ejb3_assembly_metainfandlibdir;java.lang.NullPointerException;_RequestID=63c
>>
>> 9ee02-0fcd-45c8-a681-e8b600cc0f03;|WEB0600: WebModule
>> [/ejb3_assembly_metainfandlibdir] failed to deploy and h
>> as been disabled: [java.lang.NullPointerException].|#]^M
>
>
> It is unfortunate that the exception is swallowed like that, without
> giving any stacktrace.
>
> Can you please try out the attached patch, which will log the
> exception's stacktrace?
> Hopefully, that will give you and Hong the information you are looking
> for.
>
> Thanks!
>
>
> Jan
>
>
>> ^M
>> [#|2007-08-02T04:18:34.937-0400|INFO|sun-appserver9.1|javax.enterprise.system.tools.admin|_ThreadID=15;_Thread
>>
>> Name=httpWorkerThread-4848-0;C:/ws/sjsas90/publish/glassfish/domains/domain1\generated\xml\j2ee-apps\ejb3_asse
>>
>> mbly_metainfandlibdir\ejb3_assembly_metainfandlibdirClient.jar;|ADM1040:Client-jar
>> location:[C:/ws/sjsas90/pub
>> lish/glassfish/domains/domain1\generated\xml\j2ee-apps\ejb3_assembly_metainfandlibdir\ejb3_assembly_metainfand
>>
>> libdirClient.jar]|#]^M
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
> ------------------------------------------------------------------------
>
> Index: WebModuleContextConfig.java
> ===================================================================
> RCS file: /cvs/glassfish/appserv-core/src/java/com/sun/enterprise/web/WebModuleContextConfig.java,v
> retrieving revision 1.12
> diff -u -r1.12 WebModuleContextConfig.java
> --- WebModuleContextConfig.java 5 May 2007 05:36:02 -0000 1.12
> +++ WebModuleContextConfig.java 2 Aug 2007 17:50:54 -0000
> @@ -241,9 +241,11 @@
> webBundleDescriptor);
> } catch (Throwable t){
> context.setAvailable(false);
> - Object[] objs = {context.getName(), t};
> - logger.log(Level.SEVERE,
> - "webModuleContextConfig.webModuleDisabled", objs);
> + String msg = _rb.getString(
> + "webModuleContextConfig.webModuleDisabled");
> + msg = MessageFormat.format(msg,
> + new Object[] { context.getName() });
> + logger.log(Level.SEVERE, msg, t);
> }
>
> context.setConfigured(false);
>
> Index: LogStrings.properties
> ===================================================================
> RCS file: /cvs/glassfish/appserv-commons/src/java/com/sun/logging/enterprise/system/container/web/LogStrings.properties,v
> retrieving revision 1.39
> diff -u -r1.39 LogStrings.properties
> --- LogStrings.properties 10 Jul 2007 19:44:19 -0000 1.39
> +++ LogStrings.properties 2 Aug 2007 17:51:47 -0000
> @@ -216,7 +216,7 @@
> webmodule.alternateDocBase.illegalUrlPattern=WEB0504: URL pattern {0} for alternate docbase is invalid
> webmodule.alternateDocBase.crlfInUrlPattern=WEB0505: URL pattern {0} for alternate docbase contains CR or LF or both
>
> -webModuleContextConfig.webModuleDisabled=WEB0600: WebModule [{0}] failed to deploy and has been disabled: [{1}].
> +webModuleContextConfig.webModuleDisabled=WEB0600: WebModule [{0}] failed to deploy and has been disabled
> webModuleContextConfig.missingDefaultWeb.xml=WEB0601: Missing default web.xml, using application web.xml only
> webModuleContextConfig.defaultMissing=WEB0602: Missing default-web.xml, using application web.xml only
> webModuleContextConfig.defaultParse=WEB0603: Parse error in default-web.xml
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>