Java 无法转换JndiRmiProxyFactoryBean类型的值找不到匹配的编辑器或转换策略
在我的项目中,我已经如下配置了Springbeans。(通过Java 无法转换JndiRmiProxyFactoryBean类型的值找不到匹配的编辑器或转换策略,java,spring,hibernate,spring-context,Java,Spring,Hibernate,Spring Context,在我的项目中,我已经如下配置了Springbeans。(通过JNDI获取DataSource)。当我使用spring3.2.5和hibernate4时,下面的配置工作得很好 <bean id="dataSource" class="org.springframework.remoting.rmi.JndiRmiProxyFactoryBean"> <property name="jndiName" v
JNDI
获取DataSource
)。当我使用spring3.2.5
和hibernate4
时,下面的配置工作得很好
<bean id="dataSource" class="org.springframework.remoting.rmi.JndiRmiProxyFactoryBean">
<property name="jndiName" value="java:/jdbc/mydb"/>
<property name="serviceInterface" value="javax.sql.DataSource"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean" scope="singleton">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan" value="com.abc.core.system_configuration.implGeneral.bean.*"/>
<property name="configLocations" value="implGeneral/sysConfigHibernate.cfg.xml"/>
</bean>
为什么org.springframework.remoting.rmi.jndrirmiproxyfactorybean
不能转换为javax.sql.DataSource
。有人对此有想法吗
更新:
完整的错误日志如下所示
13:59:30,939 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruleCacheControler' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Cannot resolve reference to bean 'ruleHibernatePersister' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruleHibernatePersister' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Cannot resolve reference to bean 'sessionFactory' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Initialization of bean failed;
nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource';
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
你能添加完整的堆栈跟踪吗。此外,升级还需要相当多的版本(4.0、4.1、4.2、4.3、5.0.5.1,范围相当大),因此您可能需要查看所有这些版本的升级说明,以了解发生了什么变化。@M.Deinum感谢您的回复。完整的日志被添加到问题中。应该没有任何东西阻止它工作(除非你忘记了我提到的一些东西)。另外,我强烈建议使用5.1.16作为最新的5.1版本。
13:59:30,939 ERROR [org.springframework.web.context.ContextLoader] Context initialization failed:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruleCacheControler' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Cannot resolve reference to bean 'ruleHibernatePersister' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ruleHibernatePersister' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Cannot resolve reference to bean 'sessionFactory' while setting constructor argument;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [implGeneral/spring-config-systemconfig.xml]: Initialization of bean failed;
nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource';
nested exception is java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.remoting.rmi.JndiRmiProxyFactoryBean' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found