IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

Business pas reconnu


Sujet :

Spring Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 61
    Par défaut Business pas reconnu
    Bonjour,
    J'ai une application avec struts, spring et hibernate. Lors de l'exécution, j'ai un message d'erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'piloteBusiness' is defined
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:388)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:976)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:245)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:163)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
    	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1210)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:978)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:462)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:404)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:375)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:282)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:184)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:167)
    	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:885)
    	at org.springframework.web.struts.DelegatingActionProxy.getDelegateAction(DelegatingActionProxy.java:127)
    	at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:109)
    	at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    	at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	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:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Thread.java:619)
    Dans web.xml il y'a :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/hibernate-spring-config.xml
    		</param-value>
    	</context-param>

    Dans hibernate-spring-config.xml, il y a :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    <?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: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.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">
     
    	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="location"><value>/WEB-INF/jdbc.properties</value></property>
    	</bean>
     
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName"><value>${jdbc.driverClassName}</value></property>
    		<property name="url"><value>${jdbc.url}</value></property>
    		<property name="username"><value>${jdbc.username}</value></property>
    		<property name="password"><value>${jdbc.password}</value></property>
    	</bean>
     
     
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource"><ref local="dataSource"/></property>
    		<property name="mappingResources">
    			<list>
    				<value>com/mapping/entities/Pilote.hbm.xml</value>
    			</list>
    		</property>
     
    	</bean>
     
        <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
            <property name="sessionFactory" ref="sessionFactory"/>
        </bean>
     
      	<bean id="loggingInterceptor" class="com.myapp.common.LoggingInterceptor" />
     
    	<bean id="txProxyTemplate" abstract="true"
    		class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
     
    		<property name="preInterceptors" ref="loggingInterceptor" />
    		<property name="transactionManager" ref="transactionManager" />
    		<property name="transactionAttributes">
    			<props>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="delete*">PROPAGATION_REQUIRED</prop>
    				<prop key="create*">PROPAGATION_REQUIRED</prop>
    				<prop key="add*">PROPAGATION_REQUIRED</prop>
    				<prop key="*">PROPAGATION_SUPPORTS, readOnly</prop>
    			</props>
    		</property>
    	</bean>
     
    	<!-- BUSINESS OBJECT -->
         <bean id="piloteBusiness" parent="txProxyTemplate">
            <property name="target">
                <bean class="com.myapp.business.PiloteBusiness">
                    <property name="piloteDAO">
                        <ref bean="PiloteDAO" />
                    </property>
                </bean>
            </property>
        </bean> 
     
     
       <!-- DAO -->
     <bean id="PiloteDAO" class="com.mapping.dao.PiloteDAO">
     	<property name="sessionFactory" ref="sessionFactory"/>
     	<property name="transactionManager" ref="transactionManager" />
     </bean> 
     
    </beans>

    Dans struts-config.xml, il y a :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    <action path="/listPilotes"
    	 		type="org.springframework.web.struts.DelegatingActionProxy" 
    			scope="request"> 
    	 		<forward name="success" path="/WEB-INF/jsp/pilote_list.jsp" />
    	 	</action> 
     
    <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
            <set-property property="contextConfigLocation" 
               value="/WEB-INF/spring-struts-beans.xml"/>
        </plug-in>

    Dans spring-struts-beans.xml, il y a :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
        "http://www.springframework.org/dtd/spring-beans.dtd">
     
    <beans>
    	<!-- =================== bean action config ==========================-->
        <bean name="/login" class="com.myapp.action.LoginAction" singleton="false">
     
        </bean>
     
        <bean name="/listPilotes" class="com.myapp.action.PiloteAction" singleton="false">
            <property name="piloteBusiness"><ref bean="piloteBusiness"/></property>
        </bean>
     
    </beans>

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 61
    Par défaut presque résolu
    J'ai trouvé une solution qui n'est pas propre, en faisant un import dans le fichier spring-struts-beans.xml :

    <import resource="hibernate-spring-config.xml"/>

    Donc ce n'est toujours pas vraiment résolu

  3. #3
    Membre Expert
    Avatar de Patriarch24
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Septembre 2003
    Messages
    1 047
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Industrie

    Informations forums :
    Inscription : Septembre 2003
    Messages : 1 047
    Par défaut
    Il te faut charger les deux fichiers de configuration Spring pour avoir le contexte complet :
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    /WEB-INF/hibernate-spring-config.xml
    /WEB-INF/spring-struts-beans.xml
    </param-value>
    </context-param>

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    61
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 61
    Par défaut
    Merci pour la réponse et désolé de te répondre que maintenant.

    J'ai essayé, ça ne marche toujours pas sans l'import !

Discussions similaires

  1. DOS: la commande 'more' n'est pas reconnue...
    Par billoum dans le forum Windows Serveur
    Réponses: 8
    Dernier message: 02/05/2006, 17h11
  2. [xmlrad] fichier vbs ou vb pas reconnu
    Par ekmule dans le forum XMLRAD
    Réponses: 17
    Dernier message: 01/02/2006, 16h23
  3. Répertoire Temporary Internet Files pas reconnu par Dir
    Par Cupidon dans le forum VB 6 et antérieur
    Réponses: 10
    Dernier message: 09/11/2005, 11h55
  4. Fiche créée mais pas reconnue par l'application ??
    Par Leesox dans le forum Langage
    Réponses: 8
    Dernier message: 30/10/2005, 15h10
  5. Réponses: 8
    Dernier message: 04/08/2004, 14h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo