2015-7-14 20:22:47 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find action or result
There is no Action mapped for namespace / and action name customerAction. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:212)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)
这是action的注解
@Component
@Scope("prototype")
@Action
@Results({
})
public class CustomerAction {
private CustomerDao customerDao;
private String name;
public String getName() {
return name;
这是applicationtext.xml的配置
<?xml version="1.0" encoding="UTF-8"?>
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"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
">
<context:component-scan base-package="com.sxt"></context:component-scan>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
<property name="username" value="sxt_crm"></property>
<property name="password" value="bjsxt"></property>
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties" >
<props>
<prop key="hibernate.show_sql" >true</prop>
<prop key="hibernate.format_sql" >true</prop>
<prop key="hibernate.hbm2ddl.auto" >create</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
</props>
</property>
<property name="packagesToScan" >
<list>
<value>com.sxt.po</value>
</list>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!--
启动Annotation方式的事务配置功能
-->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" >
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<aop:config>
<aop:pointcut expression="execution(public * com.sxt.service.impl.*.*(..))" id="bussinessService"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="bussinessService" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager" >
<tx:attributes>
<tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED" />
<tx:method name="add*" propagation="REQUIRED"/> <!-- 其他方法在实务中运行 -->
<tx:method name="del*" propagation="REQUIRED"/> <!-- 其他方法在实务中运行 -->
<tx:method name="update*" propagation="REQUIRED"/> <!-- 其他方法在实务中运行 -->
</tx:attributes>
</tx:advice>
There is no Action mapped for namespace / and action name customerAction
你有没有命名空间,有的话要在jsp页面中也要加上的,否则会报这个错误
There is no Action mapped for namespace / and action name customerAction. - [unknown location]
说明没成成这个bean.看看是不是自动扫描有问题
@Namespace("/ssi")
@ParentPackage("json-default")
@Action(value = "admin", results = {
@Result(name = "success", location = "/WEB-INF/pages/admin.jsp"),
@Result(name = "json", type = "json", params = { "excludeProperties","adminMgr" }) })
写成这样子,
http://zhaozhi3758.iteye.com/blog/894757
http://blog.csdn.net/xyh820/article/details/7303330/
你的请求url写错了,看看你的namespace和action的name
看错误:There is no Action mapped for namespace / and action name customerAction
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'newsDao' of bean class [com.microsoft.telecom.service.NewsService]: Bean property 'newsDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1042)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:902)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:57)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1426)
... 50 more