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 :

Démarage d'une application sous tomcat


Sujet :

Spring Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    204
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 204
    Points : 64
    Points
    64
    Par défaut Démarage d'une application sous tomcat
    Bonjour,

    J'ai un souci avec un Listner qui n'arrive à démarrer, je m'explique :

    Je suis entraine de suivre un tutorial sur Spring MVC et Hibernate, le context de l'application(un fichier applicationContext.xml qui definisse les beans à charger) doit être démarrer via un Listner mais le probléme c'est que ce Listner n'arrive pas lui aussi de démarrer

    voilà Mon fichier web.xml

    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
    40
    41
    42
    <?xml version="1.0" encoding="UTF-8"?>
     
    <web-app 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" >
     
    	<context-param>
    	  <param-name>contextConfigLocation</param-name>
    	  <param-value>/war/WEB-INF/applicationContext.xml</param-value>
    	</context-param>
    	<listener>
       		 <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      	</listener>
     
    	<!-- The dispatcher that will control all our requests -->
    	<servlet>
    	    <servlet-name>springapp</servlet-name>
    	    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    	    <load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<!-- all requests terminated by .htm will be controlled  by the dispatcher above-->
    	<servlet-mapping>
    	  <servlet-name>springapp</servlet-name>
    	  <url-pattern>*.htm</url-pattern>
    	</servlet-mapping>
     
    	<!-- Declaration of my welcome page -->
    	<welcome-file-list>
        	<welcome-file>index.jsp</welcome-file>
      	</welcome-file-list>
     
    	<jsp-config>
        	<taglib>
          		<taglib-uri>/spring</taglib-uri>
          		<taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
        	</taglib>
      </jsp-config>
     
    </web-app>
    et voilà mon fichier applicationContext.xml:

    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
            xsi:schemaLocation="http://www.springframework.org/schema/beans 
            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> 
     
        <!-- a dao bean --> 
    	<bean id="userDao" class="springapp.dao.UserDaoImpl">
            <property name="sessionFactory">
    			<ref bean="sessionFactory" />
    		</property>
        </bean>
     
        <!-- a business bean --> 
        <bean id="userManager" class="springapp.service.UserManagerImpl">
            <property name="userDao">
    			<ref bean="userDaoTarget" />
    		</property>
        </bean>
     
        <!-- the session factory for the dao bean inheriting  from HibernateDaoSupport-->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="configLocation">
    			<value>classpath:hibernate.cfg.xml</value>
    		</property>
    		<property  name="configurationClass">
      			 <value>org.hibernate.cfg.AnnotationConfiguration</value>
    		</property>
    	</bean>
     
    	<!-- declaration of the transaction  -->
    	<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory"/>
    	</bean>
     
    	<!-- declaration of the general proxy for transaction that the all transactional beans must inherit from   -->
    	<bean id="transactionProxy" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
    		<property name="transactionManager">
    			<ref bean="transactionManager"/>
    		</property>
    		<property name="transactionAttributes">
    			<props>
    				<prop key="insert*">PROPAGATION_REQUIRED</prop>
    				<prop key="update*">PROPAGATION_REQUIRED</prop>
    				<prop key="save*">PROPAGATION_REQUIRED</prop>
    				<prop key="*">PROPAGATION_REQUIRED, readOnly</prop>
    			</props>
    		</property>
    	</bean>
     
    	<!-- making the dao as a transactional bean -->
    	<bean id="userDaoTarget" parent="transactionProxy">
    		<property name="target">
    			<ref bean="userDao"/>
    		</property>
    		<property name="transactionAttributeSource">
    			<bean class="org.springframework.transaction.annotation.AnnotationTransactionAttributeSource"/>
    		</property>
    	</bean>
    </beans>
    et Voilà la trace de demarrage de tomcat (Sous Linux Mandriva):

    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
    11 mars 2009 14:41:53 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/client:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
    11 mars 2009 14:41:54 org.apache.coyote.http11.Http11BaseProtocol init
    INFO: Initialisation de Coyote HTTP/1.1 sur http-8080
    11 mars 2009 14:41:54 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1398 ms
    11 mars 2009 14:41:54 org.apache.catalina.core.StandardService start
    INFO: Démarrage du service Catalina
    11 mars 2009 14:41:54 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.27
    11 mars 2009 14:41:54 org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    11 mars 2009 14:41:55 org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(/opt/tomcat/webapps/springapp/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    11 mars 2009 14:41:56 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    11 mars 2009 14:41:56 org.apache.catalina.core.StandardContext start
    GRAVE: Erreur de démarrage du contexte [/springapp] suite aux erreurs précédentes
    11 mars 2009 14:41:57 org.apache.coyote.http11.Http11BaseProtocol start
    INFO: Démarrage de Coyote HTTP/1.1 sur http-8080
    11 mars 2009 14:41:58 org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    11 mars 2009 14:41:58 org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/111  config=null
    11 mars 2009 14:41:58 org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource
    11 mars 2009 14:41:58 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4330 ms
    ~
    Merci de votre aide

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    204
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 204
    Points : 64
    Points
    64
    Par défaut
    La partie qui peut vous interesser le plus de la trace de demarrage de tomcat est la suivante

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    11 mars 2009 14:41:56 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    11 mars 2009 14:41:56 org.apache.catalina.core.StandardContext start
    GRAVE: Erreur de démarrage du contexte [/springapp] suite aux erreurs précédentes
    Merci

  3. #3
    Expert éminent
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Points : 7 679
    Points
    7 679
    Par défaut
    Salut,
    Cette partie m'ai l'air suspecte :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <context-param>
    	  <param-name>contextConfigLocation</param-name>
    	  <param-value>/war/WEB-INF/applicationContext.xml</param-value>
    	</context-param>
    Il faut virer la partie war au début et porcdéder comme décrit dans la http://java.developpez.com/faq/sprin...ebconfigspring

  4. #4
    Expert éminent
    Avatar de _skip
    Homme Profil pro
    Développeur d'applications
    Inscrit en
    Novembre 2005
    Messages
    2 898
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Suisse

    Informations professionnelles :
    Activité : Développeur d'applications
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Novembre 2005
    Messages : 2 898
    Points : 7 752
    Points
    7 752
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    11 mars 2009 14:41:55 org.apache.catalina.loader.WebappClassLoader validateJarFile
    INFO: validateJarFile(/opt/tomcat/webapps/springapp/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
    11 mars 2009 14:41:56 org.apache.catalina.core.StandardContext start
    Je ne suis pas sûr mais il me semble que tomcat avait fait souci à un des gars de notre équipe justement à cause de ce servlet.jar.
    Tu peux vérifier que c'est la bonne version?

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    204
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 204
    Points : 64
    Points
    64
    Par défaut
    Salut,

    Moi je pense que c'est lié effectivement au fait que le fichier servlet.jar n'a pas été chargé,

    Pour mon environnement j'utilise tomcat 5.5.27 et spring 2.2.5 et Hibernate3.2 quel version de servlet.jar je dois utiliser ?

    Merci

  6. #6
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    204
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 204
    Points : 64
    Points
    64
    Par défaut
    Salut,

    Ben ce que je croyais ce n'était pas la cause du problème, j'ai récupéré le jar servlet-api.jar de tomcat qui existe sous : /opt/tomcat/common/lib et lors du démarage je ne vois plus le message qui dit que le servlet.jar n'a pas été chargé, mais par contre je n'arrive toujours pas à initialisé le listner pour qu'il me charge le context de l'application

    voilà la trace du démarrage du serveur :

    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
    12 mars 2009 10:49:14 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/client:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
    12 mars 2009 10:49:14 org.apache.coyote.http11.Http11BaseProtocol init
    INFO: Initialisation de Coyote HTTP/1.1 sur http-8080
    12 mars 2009 10:49:14 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 1392 ms
    12 mars 2009 10:49:14 org.apache.catalina.core.StandardService start
    INFO: Démarrage du service Catalina
    12 mars 2009 10:49:14 org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.27
    12 mars 2009 10:49:14 org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
    log4j:WARN Please initialize the log4j system properly.
    12 mars 2009 10:49:17 org.apache.catalina.core.StandardContext start
    GRAVE: Error listenerStart
    12 mars 2009 10:49:17 org.apache.catalina.core.StandardContext start
    GRAVE: Erreur de démarrage du contexte [/springapp] suite aux erreurs précédentes
    12 mars 2009 10:49:18 org.apache.coyote.http11.Http11BaseProtocol start
    INFO: Démarrage de Coyote HTTP/1.1 sur http-8080
    12 mars 2009 10:49:18 org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    12 mars 2009 10:49:18 org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/127  config=null
    12 mars 2009 10:49:18 org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource
    12 mars 2009 10:49:18 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4258 ms
    ~                                                                                                                                                            
    ~                                                                                                                                                            
    ~                                                                                                                                                            
    ~
    Merci.

  7. #7
    Expert éminent
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Points : 7 679
    Points
    7 679
    Par défaut
    T'as essayé avec ça au moins ?

    Citation Envoyé par djo.mos Voir le message
    Salut,
    Cette partie m'ai l'air suspecte :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <context-param>
    	  <param-name>contextConfigLocation</param-name>
    	  <param-value>/war/WEB-INF/applicationContext.xml</param-value>
    	</context-param>
    Il faut virer la partie war au début et porcdéder comme décrit dans la http://java.developpez.com/faq/sprin...ebconfigspring

  8. #8
    Membre du Club
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    204
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 204
    Points : 64
    Points
    64
    Par défaut
    Oui j'ai essayé avec ça mais ça ne marche toujours pas,
    voilà mon fichier web.xml:
    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
    40
    41
    42
    43
    44
    <?xml version="1.0" encoding="UTF-8"?>
     
    <web-app 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" >
     
    	<context-param>
    	  <param-name>contextConfigLocation</param-name>
    	  <param-value>/WEB-INF/applicationContext.xml</param-value>
    	</context-param>
    	<listener> 
    	  <listener-class> 
    	    org.springframework.web.context.ContextLoaderListener 
    	  </listener-class> 
    	</listener> 
     
    	<!-- The dispatcher that will control all our requests -->
    	<servlet>
    	    <servlet-name>springapp</servlet-name>
    	    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    	    <load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<!-- all requests terminated by .htm will be controlled  by the dispatcher above-->
    	<servlet-mapping>
    	  <servlet-name>springapp</servlet-name>
    	  <url-pattern>*.htm</url-pattern>
    	</servlet-mapping>
     
    	<!-- Declaration of my welcome page -->
    	<welcome-file-list>
        	<welcome-file>index.jsp</welcome-file>
      	</welcome-file-list>
     
    	<jsp-config>
        	<taglib>
          		<taglib-uri>/spring</taglib-uri>
          		<taglib-location>/WEB-INF/tld/spring-form.tld</taglib-location>
        	</taglib>
      </jsp-config>
     
    </web-app>
    Merci

Discussions similaires

  1. Modifier numéro de port et lien pour une application sous Tomcat
    Par djanahana dans le forum Tomcat et TomEE
    Réponses: 3
    Dernier message: 29/05/2013, 07h05
  2. Déploiement d'une Application sous Tomcat
    Par boubafanta dans le forum Tomcat et TomEE
    Réponses: 2
    Dernier message: 31/01/2010, 16h14
  3. Affichage des images générées par une application sous tomcat
    Par don'de dans le forum Tomcat et TomEE
    Réponses: 9
    Dernier message: 09/01/2007, 11h24
  4. [tomcat] pb arreter une application sous tomcat
    Par ruppert62 dans le forum Tomcat et TomEE
    Réponses: 2
    Dernier message: 28/02/2005, 19h12

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