java.lang.NoClassDefFoundError:ognl.OgnlRuntime

问题描述 投票:0回答:3

我最初想将一个JAVA EE项目迁移到Maven中。

但是,我遇到了调度错误。 我在文件中得到了这个堆栈跟踪:

C:\Program Files using(x86)\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\My_SERVER\SystemOut.log

    [22/03/18 07:46:32:755 VET] 00000020 XmlConfigurat I
    com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    Parsing configuration file [struts-default.xml] [22/03/18 07:46:32:766
    VET] 00000020 XmlConfigurat I
    com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    Parsing configuration file [struts-plugin.xml] [22/03/18 07:46:32:812
    VET] 00000020 XmlConfigurat I
    com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    Parsing configuration file [struts.xml] [22/03/18 07:46:32:814 VET]
    00000020 DefaultConfig I
    com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    Overriding property struts.i18n.reload - old value: false new value:
    true [22/03/18 07:46:32:814 VET] 00000020 DefaultConfig I
    com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    Overriding property struts.configuration.xml.reload - old value: false
    new value: true [22/03/18 07:46:32:858 VET] 00000020 Dispatcher    E
    com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
    Dispatcher initialization failed
                                     java.lang.RuntimeException: java.lang.reflect.InvocationTargetException    at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
        at
    com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
        at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)   at
    com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
        at
    com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
        at
    com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:252)
        at
    com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
        at
    com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        at
    org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
        at
    org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
        at
    com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:140)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:509)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:423)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:282)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:340)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:812)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:917)
        at
    com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:924)
        at
    com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:852)
        at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
        at
    com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
        at
    com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
        at
    com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
        at
    com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
        at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
        at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
        at
    com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
        at
    com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
        at
    com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
        at
    com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at
    com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)     at
    com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)     at
    com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)     at
    com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527) Caused by:
    java.lang.reflect.InvocationTargetException     at
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)     at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
        ... 40 more Caused by: java.lang.NoClassDefFoundError:
    ognl.OgnlRuntime (initialization failure)   at
    java.lang.J9VMInternals.initialize(J9VMInternals.java:140)  at
    com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
        ... 45 more
    
    [22/03/18 07:46:32:860 VET] 00000020 webapp        E
    com.ibm.ws.webcontainer.webapp.WebApp logError SRVE0293E: [Erreur du
    servlet]-[ognl.OgnlRuntime (initialization failure)] :
    java.lang.reflect.InvocationTargetException - Class:
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector File:
    ContainerImpl.java Method: inject Line: 295 -
    com/opensymphony/xwork2/inject/ContainerImpl.java:295:-1    at
    org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)  at
    org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)
        at
    com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:140)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:509)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:423)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:282)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:340)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:812)
        at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:917)
        at
    com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:924)
        at
    com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:852)
        at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
        at
    com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
        at
    com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
        at
    com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
        at
    com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
        at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
        at
    com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
        at
    com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
        at
    com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1772)
        at
    com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
        at
    com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
        at
    com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
        at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)     at
    com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)     at
    com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
        at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)     at
    com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527) Caused by:
    java.lang.RuntimeException:
    java.lang.reflect.InvocationTargetException     at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
        at
    com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
        at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)   at
    com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
        at
    com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
        at
    com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
        at
    com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:252)
        at
    com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
        at
    com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
        at
    org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)     at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
        ... 27 more Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
        at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:599)     at
    com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
        ... 40 more Caused by: java.lang.NoClassDefFoundError:
    ognl.OgnlRuntime (initialization failure)   at
    java.lang.J9VMInternals.initialize(J9VMInternals.java:140)  at
    com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
        ... 45 more
    
    [22/03/18 07:46:32:873 VET] 00000020 srt           W
    com.ibm.ws.webcontainer.srt.SRTServletResponse addHeader WARNING:
    Cannot set header. Response already committed. [22/03/18 07:46:32:874
    VET] 00000020 srt           W
    com.ibm.ws.webcontainer.srt.SRTServletResponse setHeader WARNING:
    Cannot set header. Response already committed. [22/03/18 07:46:32:875
    VET] 00000020 srt           W
    com.ibm.ws.webcontainer.srt.SRTServletResponse setHeader WARNING:
    Cannot set header. Response already committed. [22/03/18 07:46:32:875
    VET] 00000020 srt           W
    com.ibm.ws.webcontainer.srt.SRTServletResponse setDateHeader WARNING:
    Cannot set header. Response already committed.

我将此依赖项添加到我的

pom.xml
(我认为它丢失了):

<dependency>
    <groupId>org.apache.struts.xwork</groupId>
    <artifactId>xwork-core</artifactId>
    <version>2.2.1</version>
</dependency>

但是我仍然有错误。 谁能告诉我我错过了什么?可能是因为我使用的是 Eclipse NEON1?

我有 JDK1.7.0_71 和 Websphere 7.0.0。

JAVA_HOME=C:\Program Files (x86)\Java\jdk1.7.0_71

MAVEN_HOME=D:\Maven\apache-maven-3.3.9
java configuration struts2 websphere-7 ognl
3个回答
3
投票
Caused by: java.lang.NoClassDefFoundError:
 ognl.OgnlRuntime (initialization failure)  at

您在运行时缺少类路径上的 OGNL 依赖项。

xwork-core
struts2-core
工件的传递依赖。

OGNL 也是传递依赖。

关于第二个错误:

Response has been already commuted.

Struts 试图通过内部使用 servlet 响应来返回错误结果,或者如果响应已被转换,则无法执行此操作转发到错误页面。一旦缓冲区被刷新,响应就会被交换。您应该检查响应对象上的缓冲区大小以及写入了多少字节。


0
投票

javassist 依赖性很混乱。 我在 POM 文件中添加了这个依赖:

<dependency>
    <groupId>javassist</groupId>
    <artifactId>javassist</artifactId>
    <version>3.12.1.GA</version> 
</dependency>

它对我有用。


0
投票

这种错误

Filter [struts2]: could not be initialized
会在websphere日志文件中包含详细的错误消息,因此请查找详细消息,例如
java.lang.NoClassDefFoundError
并添加相关依赖。检查
<featureManager>
中的
server.xml
可能会有所帮助。

<featureManager>
    <feature>jsp-2.3</feature>
    <feature>servlet-3.1</feature>
</featureManager>
© www.soinside.com 2019 - 2024. All rights reserved.