过滤struts2:无法初始化

时间:2018-03-22 12:21:44

标签: struts2 websphere-7

我最初想将JAVA EE项目迁移到maven。但是,我遇到了一个调度错误。 我在文件中得到了这个堆栈跟踪: C:\ Program Files使用(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

2 个答案:

答案 0 :(得分:2)

? LenB(Dir("YourFullPathName.Ext", vbNormal)) > 0

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

Caused by: java.lang.NoClassDefFoundError: ognl.OgnlRuntime (initialization failure) at xwork-core工件的传递依赖。

OGNL也是传递依赖。

关于第二个错误:

struts2-core

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

答案 1 :(得分:0)

javassist依赖是搞乱的。 我在POM文件中添加了这个依赖项:

MSProject.Task t = ....;
t.SetField(Application.FieldNameToFieldConstant("xyz"),"value");

它适用于我。