首页新闻找找看学习计划

ssh框架报错There is no Action mapped for action name processLogin. - [unknown location]

0
悬赏园豆:10 [待解决问题]

2016-06-03 17:03:06 org.apache.struts2.dispatcher.Dispatcher Could not find action or result: /Antenna/global/processLogin.action
There is no Action mapped for action name processLogin. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:37)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:554)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.bufferAndPostProcess(ContentBufferingFilter.java:169)
at org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ContentBufferingFilter.java:126)
at org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:662)

struts配置

<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定Struts2配置文件的DTD信息 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<!-- Struts2配置文件的根元素 -->
<struts>
<!-- 请求参数的编码方式 -->
<constant name="struts.i18n.encoding" value="UTF-8"/>
<!-- 当struts.xml改动后,是否重新加载。默认值为false(生产环境下使用),开发阶段最好打开 -->
<constant name="struts.configuration.xml.reload" value="true"/>
<!-- 是否使用struts的开发模式。开发模式会有更多的调试信息。默认值为false(生产环境下使用),开发阶段最好打开 -->
<constant name="struts.devMode" value="true"/>
<!-- 设置浏览器是否缓存静态内容。默认值为true(生产环境下使用),开发阶段最好关闭,我们希望每次请求都获得服务器的最新响应,则可设置该属性为false。 -->
<constant name="struts.serve.static.browserCache" value="false" />
<!-- 是否允许在OGNL表达式中调用静态方法,默认值为false -->
<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>
<!-- 将创建对象的控制权交给spring -->
<constant name="objectFactory" value="spring"></constant>
<!-- 指定被struts2处理的请求后缀类型。多个用逗号隔开 -->
<constant name="struts.action.extension" value="action" />

<package name="Antenna" namespace="/global" extends="struts-default,tiles-default">
<!-- 定义处理登录系统的的Action -->
<action name="processLogin" class="org.action.LoginAction">
<result name="input">/jsp/login2/login.jsp</result>
<!-- <result name="success" >/home/showHome.action</result> -->
<result type="chain">
<param name="actionName">showHome</param>
<param name="namespace">/home</param>
</result>
<result name="error">/jsp/login2/login.jsp</result>
</action>
<!-- 定义退出登录系统的的Action -->
<action name="loginOff" class="org.action.LoginOffAction">
<result name="success" >/jsp/login2/login.jsp</result>
<result name="error">/jsp/login2/login.jsp</result>
</action>
</package>

spring配置

<?xml version="1.0" encoding="UTF-8"?>
<!-- 指定Spring配置文件的Schema信息 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd" >

<!-- 定义数据源Bean,使用C3P0数据源实现 -->
<!-- 设置连接数据库的驱动、URL、用户名、密码
连接池最大连接数、最小连接数、初始连接数等参数 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close" >
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/antenna"></property>
<property name="user" value="root"></property>
<property name="password" value="LIyuan_pc1122"></property>
<property name="maxPoolSize" value="40"></property>
<property name="minPoolSize" value="1"></property>
<property name="initialPoolSize" value="1"></property>
<property name="maxIdleTime" value="1"></property>
</bean>

<!-- 定义Hibernate的SessionFactory -->
<!-- 依赖注入数据源,注入正是上面定义的dataSource -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<!-- mappingResouces属性用来列出全部映射文件 -->
<property name="mappingResources">
<list>
<!-- 以下用来列出Hibernate映射文件 -->
<value>org/entity/Role.hbm.xml</value>
<value>org/entity/User.hbm.xml</value>
<value>org/entity/Station.hbm.xml</value>
<value>org/entity/Device.hbm.xml</value>
</list>
</property>
<!-- 定义Hibernate的SessionFactory的属性 -->
<property name="hibernateProperties">
<!-- 指定数据库方言、是否自动建表
是否生成SQL语句等 -->
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
</props>
</property>

</bean>

<!-- Hibernatetemplate类是简化Hibernate数据访问代码的辅助类,可以获取一个Session对象 -->
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
<property name="allowCreate">
<value>true</value>
</property>
</bean>

<!-- Transaction Manager -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- AOP -->
<!-- Define exceptions -->
<!-- Transaction Manager -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="update*" read-only="false" propagation="REQUIRED" />
<tx:method name="delete*" read-only="false" propagation="REQUIRED" />
<tx:method name="save*" read-only="false" propagation="REQUIRED" />
<tx:method name="*" propagation="SUPPORTS" />
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="txPointcut" expression="bean(userService) || bean(deviceService)" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut" />
</aop:config>

<!-- action -->
<!-- scope="prototype"避免struts,action的线程安全问题 -->
<bean id="LoginBean" class="org.action.LoginAction" scope="prototype">
<property name="userService" ref="userService"></property>

<bean id="userService" class="org.service.impl.UserServiceImpl">
<property name="userDao" ref="userDao"></property>
<property name="roleDao" ref="roleDao"></property>
</bean>

<bean id="userDao" class="org.dao.impl.UserDaoImpl" >
<!-- 注入持久化操作所需的SessionFactory -->
<property name="sessionFactory" ref="sessionFactory" ></property>
<property name="pageDao" ref="pageDao" ></property>
</bean>
<!-- 依赖注入 -->
<bean id="roleDao" class="org.dao.impl.RoleDaoImpl" >
<!-- 注入持久化操作所需的SessionFactory -->
<property name="sessionFactory" ref="sessionFactory" ></property>
</bean>



</beans>

 

ssh
落微的主页 落微 | 初学一级 | 园豆:181
提问于:2016-06-03 17:14
< >
分享
所有回答(3)
0

struts配置呢

 

laugher_ccc | 园豆:593 (小虾三级) | 2016-06-03 17:17
0

action返回的时候出的错,仔细看下processLogin这个action配置,result的jsp路径有没有问题

如果配置没问题,看下是不是导入struts2-convention-plugin这个的原因

一码一生命 | 园豆:234 (菜鸟二级) | 2016-06-03 17:23

检查过了,没有导入struts2-convention-plugin

action配置如下,没发现有什么问题,

<package name="Antenna" namespace="/global" extends="struts-default,tiles-default">
<!-- 定义处理登录系统的的Action -->
<action name="processLogin" class="org.action.LoginAction">
<result name="input">/jsp/login2/login.jsp</result>
<!-- <result name="success" >/home/showHome.action</result> -->
<result type="chain">
<param name="actionName">showHome</param>
<param name="namespace">/home</param> 
</result>
<result name="error">/jsp/login2/login.jsp</result>
</action>

这是用myeclipse2013建立的项目,现在是导入到myeclipse10当中

支持(0) 反对(0) 落微 | 园豆:181 (初学一级) | 2016-06-03 21:37
0

程序没有问题,是我重装系统之后,更换myeclipse版本等造成的

落微 | 园豆:181 (初学一级) | 2016-06-06 11:03
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册