如何在不配置Spring的情况下设置Struts2.5

时间:2019-04-14 06:28:59

标签: struts2

使用Struts2.5编写一个简单的HelloWorld应用程序。出现以下错误。

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
FATAL StrutsSpringObjectFactory ********** FATAL ERROR STARTING UP STRUTS-SPRING INTEGRATION **********
Looks like the Spring listener was not configured for your web app! 
Nothing will work until WebApplicationContextUtils returns a valid ApplicationContext.
You might need to add the following to web.xml: 
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
ERROR DefaultConversionPropertiesProcessor Conversion registration error
 java.lang.NullPointerException
    at com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:165)
    at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:177)
    at com.opensymphony.xwork2.conversion.impl.DefaultTypeConverterCreator.createTypeConverter(DefaultTypeConverterCreator.java:40)
    ......
INFO: Server startup in [11,384] milliseconds

下面是struts.xml文件。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
        "http://struts.apache.org/dtds/struts-2.5.dtd">

<struts>
    <package name="default" extends="struts-default">
        <action name="reg" class="action.EmployeeController">
            <result name="input">/input.jsp</result>
            <result name="success">/success.jsp</result>
        </action>
    </package>
</struts>

不配置Spring怎么解决?

0 个答案:

没有答案