tomcate无法启动 我检查过了 引用都setter getter了 还是找不到问题 望高手请教Error creating bean with name 'studentAction' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'addservice' while setting bean property 'as'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'addservice' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0 implementing Demo.Dao.Dao,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [Demo.Dao.StudentDao] for property 'sd'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0 implementing Demo.Dao.Dao,org.springframework.beans.factory.InitializingBean,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [Demo.Dao.StudentDao] for property 'sd': no matching editors or conversion strategy found
解决方案 »
- org.apache.jasper.JasperException: Unable to compile class for JSP
- hibernate 自我映射
- 服务器端获得客户端的MAC地址的方式?
- java 本机测试通过为何上传到服务器上时 会报404错误???
- 帮忙看个Struts2的异常
- 精通EJB第二版(中文版) 免费下载!
- java代码打开本地“我的电脑”
- 各位大侠,紧急求救啊!java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
- 用hibernate的高手们请指点一下,菜鸟问题,很急很急
- 关于struts下拉列表的一种实现!请大家帮忙!在线等待!!
- 大家有应聘的面试题么?有的话共享一下
- 有谁想找工作
看看配制文件。
<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-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.1.xsd">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/test"></property>
<property name="username" value="root"></property>
<property name="password" value=""></property>
<property name="initialSize" value="5"></property>
<property name="maxActive" value="20"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>
Demo/Beans/Student.hbm.xml
</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQL5InnoDBDialect
</prop>
<prop key="hibernate.show_sql">
true
</prop>
<prop key="hibernate.hbm2ddl.auto">
update
</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<bean id="studentdao" class="Demo.Dao.StudentDao">
<property name="hibernateTemplate" ref="hibernateTemplate"></property>
</bean>
<bean id="studentAction" class="Demo.Action.StudentAction">
<property name="as" ref="addservice"></property>
</bean>
<bean id="delAction" class="Demo.Action.DelAction">
<property name="ds" ref="delservice"></property>
</bean>
<bean id="addservice" class="Demo.Service.AddStudent">
<property name="sd" ref="studentdao"></property>
</bean>
<bean id="delservice" class="Demo.Service.DelectStudent">
<property name="sd" ref="studentdao"></property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<tx:advice id="daoTransactionAdvice">
<tx:attributes>
<tx:method name="save" isolation="DEFAULT" propagation="REQUIRED"/>
<tx:method name="delByName" isolation="DEFAULT" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<tx:advice id="serviceTransactionAdvice">
<tx:attributes>
<tx:method name="service" isolation="DEFAULT" propagation="REQUIRED"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="daocut" expression="execution(* Demo.Dao.*.save(..))"/>
<aop:pointcut id="servicecut" expression="execution(* Demo.Service.*.service(..))"/>
<aop:advisor advice-ref="daoTransactionAdvice" pointcut-ref="daocut"/>
<aop:advisor advice-ref="serviceTransactionAdvice" pointcut-ref="servicecut"/>
</aop:config>
</beans>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>
MyDemo</display-name>
<welcome-file-list>
<welcome-file>add.jsp</welcome-file>
</welcome-file-list> <filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="flase"></constant>
<constant name="struts.devMode" value="false"></constant>
<constant name="struts.beanFactory" value="spring"></constant>
<package name="default" namespace="/" extends="struts-default">
<action name="studentAction" class="studentAction">
<result name="success">success.jsp</result>
</action>
<action name="delAction" class="delAction">
<result name="success">del.jsp</result>
</action>
</package></struts>
sd 这个属性对应的类不对
看下 bean 要求的是什么类 你传进去的又是什么类