Exception trouvé org.springframework.beans.factory.NoSuchBeanDefinitionException
Je suis entrain de developper une application utilisant spring et jsf.
J'utilise la notion de facade et les dao ce que j'ai c'est ceci
1- 8 Interfaces fascade1, fascade2 ....
2- 8 classe les implémentant fascade1Impl,....
1- 8 Interfaces dao1, dao2 ....
2- 8 classe les implémentant dao1Impl,....
Ensuite j'utilise les injection de dépendance pour connecter ma fascade au dao
Mon pb est maintenant cette exception
Citation:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AdresseDAO': Injection of resource fields failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.transaction.UserTransaction] is defined: Unsatisfied dependency of type [interface javax.transaction.UserTransaction]: expected at least 1 matching bean
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:292)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:671)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:610)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:499)
... 89 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.transaction.UserTransaction] is defined: Unsatisfied dependency of type [interface javax.transaction.UserTransaction]: expected at least 1 matching bean
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:431)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:537)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:180)
at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessAfterInstantiation(CommonAnnotationBeanPostProcessor.java:289)
... 102 more
|#]
[#|2009-01-14T00:40:07.925+0000|SEVERE|sun-appserver9.1|org.apache.catalina.core.StandardContext|_ThreadID=18;_ThreadName=httpWorkerThread-4848-0;_RequestID=b4a0d34b-2bfa-4503-9e0f-6b814b174920;|PWC1306: Startup of context /xeweul failed due to previous errors|#]
[#|2009-01-14T00:40:07.940+0000|INFO|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=18;_ThreadName=httpWorkerThread-4848-0;|PWC1412: WebModule[/xeweul] ServletContext.log():Closing Spring root WebApplicationContext|#]
Voici mon applicationContext
Comme vous me l'avez demandé voici mon applicationContext
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
<a href="http://www.springframework.org/schema/aop" target="_blank">http://www.springframework.org/schema/aop</a> <a href="http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" target="_blank">http://www.springframework.org/schem...ng-aop-2.5.xsd</a>
<a href="http://www.springframework.org/schema/beans" target="_blank">http://www.springframework.org/schema/beans</a> <a href="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" target="_blank">http://www.springframework.org/schem...-beans-2.5.xsd</a>
<a href="http://www.springframework.org/schema/context" target="_blank">http://www.springframework.org/schema/context</a> <a href="http://www.springframework.org/schema/context/spring-context-2.5.xsd" target="_blank">http://www.springframework.org/schem...ontext-2.5.xsd</a>
<a href="http://www.springframework.org/schema/jee" target="_blank">http://www.springframework.org/schema/jee</a> <a href="http://www.springframework.org/schema/jee/spring-jee-2.5.xsd" target="_blank">http://www.springframework.org/schem...ng-jee-2.5.xsd</a>
<a href="http://www.springframework.org/schema/tx" target="_blank">http://www.springframework.org/schema/tx</a> http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="/WEB-INF/jdbc.properties" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="dataSource">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter"
p:databasePlatform="${jpa.databasePlatform}" p:showSql="${jpa.showSql}"/>
</property>
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.glassfish.GlassFishLoadTimeWeaver"/>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:driverClassName="${jdbc.driverClassName}"
p:url="${jdbc.url}"
p:username="${jdbc.username}"
p:password="${jdbc.password}" />
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager" />
<tx:annotation-driven />
<context:annotation-config/>
<aop:aspectj-autoproxy/>
<bean id="FacadeAdresse" class="service.fascade.FacadeAdresseImpl"/>
<bean id="FacadeAnnonce" class="service.fascade.FacadeAnnonceImpl"/>
<bean id="FacadeCategorie" class="service.fascade.FacadeCategorieImpl"/>
<bean id="FacadeClient" class="service.fascade.FacadeClientImpl"/>
<bean id="FacadeMessage" class="service.fascade.FacadeMessageImpl"/>
<bean id="FacadePays" class="service.fascade.FacadePaysImpl"/>
<bean id="FacadePhoto" class="service.fascade.FacadePhotoImpl"/>
<bean id="FacadeSequence" class="service.fascade.FacadeSequenceImpl"/>
<bean id="FacadeVille" class="service.fascade.FacadeVilleImpl"/>
<bean id="AdresseDAO" class="service.dao.AdresseDAOImpl"/>
<bean id="AnnonceDAO" class="service.dao.AnnonceDAOImpl"/>
<bean id="CategorieDAO" class="service.dao.CategorieDAOImpl"/>
<bean id="ClientDAO" class="service.dao.ClientDAOImpl"/>
<bean id="MessageDAO" class="service.dao.MessageDAOImpl"/>
<bean id="PaysDAO" class="service.dao.PaysDAOImpl"/>
<bean id="PhotoDAO" class="service.dao.PhotoDAOImpl"/>
<bean id="SequenceDAO" class="service.dao.SequenceDAOImpl"/>
<bean id="VilleDAO" class="service.dao.VilleDAOImpl"/>
</beans> |