带有Struts2的SpringBoot引发异常

时间:2019-01-14 13:27:51

标签: java

我也遇到了这个问题:

我的项目是带有Spring的Struts2,现在我想将springboot添加到我的项目中, 然后我将struts2更新到2.5.18并添加springboot 2.1.1.RELEASE。这使用spring-core 5.1.3。

在这个项目中,我为Action和Controller使用注释,旧代码使用

Struts Action和新代码使用SpringMVC Controller

但是该项目总是会产生500个错误:

Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:161)
    at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:52)
    at com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:443)
    at com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:457)
    at com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:33)
    at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:282)
    ... 51 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:474)
    at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:511)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:564)
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:509)
    at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:50)
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:159)
    ... 56 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    ... 80 common frames omitted
    at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:284)
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:417)
Caused by: java.lang.reflect.InvocationTargetException: null
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:472)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    ... 61 more
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
Caused by: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:405)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    ... 81 common frames omitted
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Caused by: com.opensymphony.xwork2.config.ConfigurationException: Unknown default parent package [struts-default]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.apache.struts2.convention.ConventionUnknownHandler.<init>(ConventionUnknownHandler.java:108)
    at java.lang.reflect.Method.invoke(Method.java:498)
    ... 86 common frames omitted
    at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:282)
    ... 63 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerBuilder$4
File: ContainerBuilder.java
Method: create
Line: 161 - com/opensymphony/xwork2/inject/ContainerBuilder.java:161:-1
    at com.opensymphony.xwork2.DefaultUnknownHandlerManager.setContainer(DefaultUnknownHandlerManager.java:50)
    ... 68 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:161)
    at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:52)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:486)
    at com.opensymphony.xwork2.inject.ContainerImpl$8.call(ContainerImpl.java:519)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:564)
    at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:517)
    at com.opensymphony.xwork2.DefaultUnknownHandlerManager.build(DefaultUnknownHandlerManager.java:78)
    at com.opensymphony.xwork2.DefaultUnknownHandlerManager.setContainer(DefaultUnknownHandlerManager.java:48)
    ... 68 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:474)
    at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:511)
    at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:564)
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:509)
    at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:50)
    at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:159)
    ... 75 more
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:422)
    at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:472)
    ... 80 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:405)
    ... 81 more
Caused by: Unknown default parent package [struts-default] - [unknown location]
    at org.apache.struts2.convention.ConventionUnknownHandler.<init>(ConventionUnknownHandler.java:108)
    ... 86 more

0 个答案:

没有答案