com.sun.enterprise.deployment.WebBundleDescriptor.getErrorPageDescriptorBySignifier中的java.lang.NullPointerException

时间:2013-11-28 06:13:26

标签: java glassfish glassfish-3

尝试在GlassFish 3.1.2中部署JSF Web应用程序时,我遇到以下异常:

[#|2013-11-28T05:36:51.841+0000|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=106;_ThreadName=admin-thread-pool-4848(2);|
java.lang.NullPointerException
    at com.sun.enterprise.deployment.WebBundleDescriptor.getErrorPageDescriptorBySignifier(WebBundleDescriptor.java:780)
    at com.sun.enterprise.deployment.WebBundleDescriptor.addErrorPageDescriptor(WebBundleDescriptor.java:760)
    at com.sun.enterprise.deployment.WebBundleDescriptor.addCommonWebBundleDescriptor(WebBundleDescriptor.java:221)
    at com.sun.enterprise.deployment.WebBundleDescriptor.addDefaultWebBundleDescriptor(WebBundleDescriptor.java:169)
    at com.sun.enterprise.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:385)
    at com.sun.enterprise.deployment.archivist.WebArchivist.postAnnotationProcess(WebArchivist.java:89)
    at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:406)
    at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:380)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:243)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:252)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:213)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:165)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:185)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:94)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:828)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:770)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:368)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
    at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:214)
    at org.glassfish.admin.rest.ResourceUtil.runCommand(ResourceUtil.java:207)
    at org.glassfish.admin.rest.resources.TemplateListOfResource.createResource(TemplateListOfResource.java:148)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
    at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.SubLocatorRule.accept(SubLocatorRule.java:134)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
    at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(GrizzlyContainer.java:182)
    at com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(GrizzlyContainer.java:147)
    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:148)
    at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
    at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:864)
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:761)
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1050)
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    at java.lang.Thread.run(Thread.java:724)
|#]

[#|2013-11-28T05:36:51.849+0000|SEVERE|oracle-glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=106;_ThreadName=admin-thread-pool-4848(2);|Exception while deploying the app [myWeb]|#]

[#|2013-11-28T05:36:51.868+0000|INFO|oracle-glassfish3.1.2|org.glassfish.admingui|_ThreadID=135;_ThreadName=admin-thread-pool-4848(6);|Exception Occurred :Error occurred during deployment: Exception while deploying the app [myWeb]. Please see server.log for more details.|#]

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:4)

GlassFish是开源的。只需查看与第一行相关的代码:

at com.sun.enterprise.deployment.WebBundleDescriptor.getErrorPageDescriptorBySignifier(WebBundleDescriptor.java:780)

源代码位于grepcode

778   public ErrorPageDescriptor getErrorPageDescriptorBySignifier(String signifier) {
779         for (ErrorPageDescriptor next : getErrorPageDescriptorsSet()) {
780             if (next.getErrorSignifierAsString().equals(signifier)) {
781                 return next;
782             }
783         }
784         return null;
785     }

好的,这表明next.getErrorSignifierAsString()由于某种原因返回了null。让我们看一下该方法(在grepcode中,您可以单击方法查看源代码,就像在IDE中执行Ctrl + Click一样):

84     public String getErrorSignifierAsString() {
85         if ("".equals(this.getExceptionType())) {
86            if (getErrorCode() == -1) {
87                return null;
88            } else {
89                return String.valueOf(this.getErrorCode());
90            }
91         }
92         return this.getExceptionType();
93     }

好的,这表明您<error-page>中声明的某些web.xml没有<exception-type>,也没有<error-code>

是时候检查web.xml(以及web-fragment.xml,如果有的话)查看损坏的<error-page>声明并修复它们。