在GlassFish / Payara上部署War时出现java.lang.NoClassDefFoundError

时间:2018-12-27 09:03:31

标签: java tomcat glassfish payara

Info:   WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
            WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.servlet.internal.CdiExternalRequestScope is deprecated from CDI 1.1!
            WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionHolder is deprecated from CDI 1.1!
            WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.WebAppExceptionInterceptor is deprecated from CDI 1.1!
            WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.transaction.internal.TransactionalExceptionMapper is deprecated from CDI 1.1!
            WARN:   WELD-000146: BeforeBeanDiscovery.addAnnotatedType(AnnotatedType<?>) used for class org.glassfish.jersey.ext.cdi1x.internal.CdiComponentProvider$JaxRsParamProducer is deprecated from CDI 1.1!
            Severe:   Error invoking ServletContainerInitializer org.jboss.weld.environment.servlet.EnhancedListener
            java.lang.NoClassDefFoundError: org/apache/tomcat/InstanceManager
                at java.lang.ClassLoader.defineClass1(Native Method)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
                at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1093)
                at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1624)
                at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
                at java.lang.ClassLoader.defineClass1(Native Method)
                at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
                at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:1093)
                at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1624)
                at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
                at org.jboss.weld.environment.tomcat.TomcatContainer.initialize(TomcatContainer.java:43)
                at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:213)
                at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:62)
                at org.apache.catalina.core.StandardContext.callServletContainerInitializers(StandardContext.java:5825)
                at com.sun.enterprise.web.WebModule.callServletContainerInitializers(WebModule.java:737)
                at org.apache.catalina.core.StandardContext.start(StandardContext.java:5722)
                at com.sun.enterprise.web.WebModule.start(WebModule.java:618)
                at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:956)
                at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
                at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
                at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2105)
                at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1750)
                at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
                at org.glassfish.internal.data.EngineRef.start(EngineRef.java:123)
                at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:294)
                at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:357)
                at com.sun.enterprise.v3.server.ApplicationLifecycle.initialize(ApplicationLifecycle.java:541)
                at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:542)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
                at java.security.AccessController.doPrivileged(Native Method)
                at javax.security.auth.Subject.doAs(Subject.java:360)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
                at java.security.AccessController.doPrivileged(Native Method)
                at javax.security.auth.Subject.doAs(Subject.java:360)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
                at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
                at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:564)
                at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:251)
                at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:166)
                at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:516)
                at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:213)
                at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
                at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
                at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
                at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
                at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
                at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
                at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
                at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
                at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
                at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
                at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
                at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
                at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
                at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
                at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
                at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
                at java.lang.Thread.run(Thread.java:748)
            Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.InstanceManager
    I'm
                at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1659)
                at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1505)
                ... 66 more

            Severe:   Startup of context /nrd failed due to previous errors
            Severe:   Exception during cleanup after start failed

我正在尝试在payara5 / glassfish Web服务器上进行战争。该应用程序使用tomcat运行,但是当我尝试部署war文件时,它引发了以上错误。清理构建项目无济于事。在Glassfish上部署它时,为什么在项目中包含一个包含Tomcat Instance Manager类的jar?我应该在项目中包括哪个罐子?谢谢

1 个答案:

答案 0 :(得分:1)

从StackTrace开始,您正在将Weld与Tomcat一起使用。在Tomcat中使用Weld需要进行配置才能集成Weld和Tomcat。但是,切换到GlassFish / Payara时不再需要这种集成,因为它们已经支持开箱即用的焊接。

所以,我认为您必须首先删除有关集成Tomcat和Weld的所有配置。我建议您确保先删除here中提到的所有配置。