我在运行简单的struts 2应用程序时遇到错误

时间:2013-04-16 09:01:48

标签: struts2

无法加载配置。 - 行动 -

  

文件:/ d:/DATA/STUDY/anup/Struts2Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/FirstStrutsApplication/WEB-INF/classes/struts.xml:6 :55     在   com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:58)     在   org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:374)org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418)     在   org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)     在   org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)     在   org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)     在   org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)     在   org.apache.catalina.core.ApplicationFilterConfig。(ApplicationFilterConfig.java:107)     在   org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)     在   org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)     在   org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)     在   org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1559)     在   org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1549)     at java.util.concurrent.FutureTask $ Sync.innerRun(Unknown Source)at   java.util.concurrent.FutureTask.run(未知来源)at   java.util.concurrent.ThreadPoolExecutor.runWorker(未知来源)at   java.util.concurrent.ThreadPoolExecutor $ Worker.run(未知来源)at   java.lang.Thread.run(Unknown Source)引起:Action类   找不到[com.javatpoint.Product] - 动作 -   文件:/ d:/DATA/STUDY/anup/Struts2Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/FirstStrutsApplication/WEB-INF/classes/struts.xml:6:55     在   com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:409)     在   com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:354)     在   com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:468)     在   com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:264)     在   org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)     在   com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)     在   com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)

struts.xml中:

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "struts.apache.org/dtds/struts-2.0.dtd">; 
<struts> 
  <package name="default" extends="struts-default"> 
    <action name="getTutorial" class="com.anup.work.TutorialAction" method="execute"> 
      <result name="success">/success.jsp</result> 
    </action> 
  </package>
</struts>

2 个答案:

答案 0 :(得分:0)

答案明确说明了问题所在:

Action class [com.javatpoint.Product] not found

您的操作类未部署,或根本不存在。

答案 1 :(得分:0)

您的.class文件尚未创建。右键单击您的项目,转到属性。选择java编译器并检查设置(取消选中Enable复选框)。