SSH整合 配置文件报错 10C

这是报错
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myaction' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'cn.jbit.ssh.service.impl.PoitestServiceImpl$$EnhancerByCGLIB$$53789971' to required type 'cn.jbit.ssh.service.PoitestService' for property 'ps'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [cn.jbit.ssh.service.impl.PoitestServiceImpl$$EnhancerByCGLIB$$53789971] to required type [cn.jbit.ssh.service.PoitestService] for property 'ps': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4961)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5455)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3976)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:426)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1345)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'cn.jbit.ssh.service.impl.PoitestServiceImpl$$EnhancerByCGLIB$$53789971' to required type 'cn.jbit.ssh.service.PoitestService' for property 'ps'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [cn.jbit.ssh.service.impl.PoitestServiceImpl$$EnhancerByCGLIB$$53789971] to required type [cn.jbit.ssh.service.PoitestService] for property 'ps': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:485)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
... 22 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [cn.jbit.ssh.service.impl.PoitestServiceImpl$$EnhancerByCGLIB$$53789971] to required type [cn.jbit.ssh.service.PoitestService] for property 'ps': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:241)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470)
... 28 more

这是applicationcontext.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">

destroy-method="close">





class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- 数据源 -->


cn/jbit/ssh/entity/Poitest.hbm.xml
cn/jbit/ssh/entity/Kind.hbm.xml

cn/jbit/ssh/entity/Xzqh.hbm.xml

cn/jbit/ssh/entity/Chain.hbm.xml
cn/jbit/ssh/entity/Foodtype.hbm.xml





hibernate.dialect=org.hibernate.dialect.Oracle9iDialect


<!--声明事务 -->
<!-- 创建事务管理器 -->
class="org.springframework.orm.hibernate3.HibernateTransactionManager">


<!-- 织入增强 -->

expression="execution(* cn.jbit.ssh.service..*.*(..))" />

/aop:config

<!-- 定义事务 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="save*" propagation="REQUIRED" />
        <tx:method name="del*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="find*" read-only="true"/>
        <tx:method name="one*" read-only="true"/>
        <tx:method name="*" propagation="SUPPORTS" read-only="true" />
    </tx:attributes>
</tx:advice>

<!-- 接口注入 -->














<!-- service -->














<!-- action -->








8个回答

一般不都是自动搭建么。 你是用手动的吗? 自己➕jar包

qq_37782289
qq_37782289 我用eclipse这是手动建的,不知道哪里错了 麻烦你帮忙看一下
3 年多之前 回复

图片说明
图片说明
图片说明

qq_37782289
qq_37782289 这是我的jar包,因为不太确定都需要什么 所以放了好多jar包都导进去了
3 年多之前 回复

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myaction' defined in class path resource [applicationContext.xml]这里说了,在applicationContext.xml里面,配置了myaction,但是初始化失败了

qq_37782289
qq_37782289 不好意思 刚才疏忽了 没看到applicationcontext下面的代码没发出来 我发了 能麻烦你帮我看那一下吗
3 年多之前 回复
u011981342
流风Y回雪 你最好把applicationContext.xml文件贴出来,还有myaction这个类
3 年多之前 回复

这是我的applicationcontext
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">

destroy-method="close">





class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- 数据源 -->


cn/jbit/ssh/entity/Poitest.hbm.xml
cn/jbit/ssh/entity/Kind.hbm.xml

cn/jbit/ssh/entity/Xzqh.hbm.xml

cn/jbit/ssh/entity/Chain.hbm.xml
cn/jbit/ssh/entity/Foodtype.hbm.xml





hibernate.dialect=org.hibernate.dialect.Oracle9iDialect


<!--声明事务 -->
<!-- 创建事务管理器 -->
class="org.springframework.orm.hibernate3.HibernateTransactionManager">


<!-- 织入增强 -->

expression="execution(* cn.jbit.ssh.service..*.*(..))" />

/aop:config

<!-- 定义事务 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="save*" propagation="REQUIRED" />
        <tx:method name="del*" propagation="REQUIRED" />
        <tx:method name="update*" propagation="REQUIRED" />
        <tx:method name="find*" read-only="true"/>
        <tx:method name="one*" read-only="true"/>
        <tx:method name="*" propagation="SUPPORTS" read-only="true" />
    </tx:attributes>
</tx:advice>

<!-- 接口注入 -->














<!-- service -->














<!-- action -->






















<!-- service -->














<!-- action -->








图片说明
图片说明
图片说明

这是我的action类
图片说明
图片说明

如果是启动时报错,最好查一下 web.xml的配置,看一下你加载spring时的监听是否有误,

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问