eclipse无法在Java中加载配置文件
我正在编写JavaBrains教程,在我完成课程后,Tomcat说:
SEVERE: Exception starting filter struts2
此外:
Caused by: Unable to load configuration. - action - file:/Users/jasonrodriguez/Java/apache-tomcat-7.0.47/wtpwebapps/TutorialFinder/WEB-INF/classes/struts.xml:8:83
Caused by: Action class [org.koushik.javabrains.action.TutorialAction] not found - action - file:/Users/jasonrodriguez/Java/apache-tomcat-7.0.47/wtpwebapps/TutorialFinder/WEB-INF/classes/struts.xml:8:83
我返回检查,我的web.xml
具有正确的过滤器映射:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>TutorialFinder</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
我的struts.xml
有名称空间、操作名称和类属性:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="default" namespace="/tutorials" extends="struts-default">
<action name="getTutorial" class="org.koushik.javabrains.action.TutorialAction">
<result name="success">/success.jsp</result>
<result name="failure">/error.jsp</result>
</action>
</package>
</struts>
我的库构建路径是正确的,但当我运行Tomcat时,它告诉我资源不可用,而且由于我是新手,我不知道如何解决它,因为我的项目中没有红色的x标记。我以为某个地方有一个文件不合适,但我觉得它很直观:
也许一双新的眼睛能捕捉到我错过的东西。昨天我在本教程中遇到了类似的问题,解决方法是在我的动作标记中提供类路径上存在的类引用。然而,据我所知,这个标签看起来已经是正确的了。我的目标是获得我创建、执行的业务服务
共 (0) 个答案