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

Tomcat et TomEE Java Discussion :

Spring 2.5.6 +Tomcat


Sujet :

Tomcat et TomEE Java

  1. #1
    Nouveau membre du Club
    Inscrit en
    Juillet 2005
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Juillet 2005
    Messages : 49
    Points : 34
    Points
    34
    Par défaut Spring 2.5.6 +Tomcat
    Bonjour,

    j'avais posé une question similaire qui n'a pas obtenu de réponse. J'ai poursuivi le travail en tentant de corriger les erreurs apparues lors de la compilation. Voici le nouveau message d'erreur et les contenus des fichiers de configuration. Merci pour votre aide.

    -Message d'erreur:

    Code java : 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
    nov. 24, 2011 5:18:56 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\QuickTime\QTSystem\;C:\MinGW\bin\;C:\MinGW\MSYS\1.0\local\bin\;C:\MinGW\MSYS\1.0\bin\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Eclipse\eclipse;;.
    nov. 24, 2011 5:18:56 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringMVC' did not find a matching property.
    nov. 24, 2011 5:18:56 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    nov. 24, 2011 5:18:56 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
    nov. 24, 2011 5:18:56 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 909 ms
    nov. 24, 2011 5:18:56 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    nov. 24, 2011 5:18:56 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/7.0.21
    nov. 24, 2011 5:18:57 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [547] milliseconds.
    nov. 24, 2011 5:18:58 PM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    INFO  ContextLoader                   - Root WebApplicationContext: initialization started
    INFO  XmlWebApplicationContext        - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@192c06d: display name [Root WebApplicationContext]; startup date [Thu Nov 24 17:18:58 EST 2011]; root of context hierarchy
    INFO  XmlBeanDefinitionReader         - Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
    INFO  XmlWebApplicationContext        - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@192c06d]: org.springframework.beans.factory.support.DefaultListableBeanFactory@673ab2
    INFO  DefaultListableBeanFactory      - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@673ab2: defining beans [studentDao,jdbcTemplate,dataSource]; root of factory hierarchy
    INFO  DriverManagerDataSource         - Loaded JDBC driver: com.mysql.jdbc.Driver
    INFO  ContextLoader                   - Root WebApplicationContext: initialization completed in 522 ms
    nov. 24, 2011 5:18:58 PM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet 'springapp'
    INFO  DispatcherServlet               - FrameworkServlet 'springapp': initialization started
    INFO  XmlWebApplicationContext        - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@30b982: display name [WebApplicationContext for namespace 'springapp-servlet']; startup date [Thu Nov 24 17:18:58 EST 2011]; parent: org.springframework.web.context.support.XmlWebApplicationContext@192c06d
    INFO  XmlBeanDefinitionReader         - Loading XML bean definitions from ServletContext resource [/WEB-INF/springapp-servlet.xml]
    INFO  XmlWebApplicationContext        - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@30b982]: org.springframework.beans.factory.support.DefaultListableBeanFactory@8634b1
    INFO  DefaultListableBeanFactory      - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8634b1: defining beans [messageSource,studentListController,studentCreateController,loggingInterceptor,simpleUrlMapping,viewResolver]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@673ab2
    INFO  DispatcherServlet               - FrameworkServlet 'springapp': initialization completed in 220 ms
    nov. 24, 2011 5:18:59 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-bio-8080"]
    nov. 24, 2011 5:18:59 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-bio-8009"]
    nov. 24, 2011 5:18:59 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 2347 ms
    WARN  PageNotFound                    - No mapping found for HTTP request with URI [/SpringMVC/] in DispatcherServlet with name 'springapp'
    -fichier web.xml

    Code java : 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
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns="http://java.sun.com/xml/ns/javaee"
    	xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    	id="WebApp_ID" version="2.5">
    	<display-name>SpringMVC</display-name>
     
    	<!-- The parameter tells about the location of configuration XML. Usually
    	all the data access beans and service layer beans are kept here. You can register
    	more than one XML here. -->
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>WEB-INF/applicationContext.xml</param-value>
    	</context-param>
     
    	<!-- The listener is reponsible for building the spring container. It looks for
    		all configuration XML as defined by parameter contextConfigLocation and also looks 
    		for a configuration which is named as Dispatch Servlet name. In this case it will
    		be named as springapp-servlet.xml -->
    	<listener>
    		<listener-class>
    			org.springframework.web.context.ContextLoaderListener
    		</listener-class>
    	</listener>
     
    	<!-- Dispatcher Servlet which traps all the request targeted for Spring MVC -->
    	<servlet>
    		<servlet-name>springapp</servlet-name>
    		<servlet-class>
    			org.springframework.web.servlet.DispatcherServlet
    		</servlet-class>
    		<load-on-startup>1</load-on-startup>
    	</servlet>
     
    	<!-- Mapping for the request. It can be anything -->
    	<servlet-mapping>
    		<servlet-name>springapp</servlet-name>
    		<url-pattern>*.htm</url-pattern>
    	</servlet-mapping>
    </web-app>
    -fichier applicationContext.xml

    Code java : 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
    <?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">
     
    <!-- The Dao class -->
    <bean id="studentDao" class="com.oyejava.springmvc.StudentJdbcDao">
    	<property name="simpleJdbcTemplate" ref="jdbcTemplate" />
    </bean>
     
    <!-- Template class to access JDBC code -->
    <bean id="jdbcTemplate"
    	class="org.springframework.jdbc.core.simple.SimpleJdbcTemplate">
    	<constructor-arg ref="dataSource" />
    </bean>
     
    <!-- Configuration for the data source -->
    <bean id="dataSource"
    	class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">
    	<property name="driverClassName" value="com.mysql.jdbc.Driver" />
    	<!-- <property name="driverClassName" value="org.hsqldb.jdbcDriver" />-->
    	<property name="url" value="jdbc:mysql://localhost:3306" />
    	<!-- <property name="url" value="jdbc:hsqldb:hsql://localhost" />-->
    	<property name="username" value="root" />
    	<property name="password" value="" />
    </bean>
    </beans>

    -fichier springapp-servlet.xml

    Code java : 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
    <?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">
     
    	<bean id="messageSource"
    		class="org.springframework.context.support.ResourceBundleMessageSource">
    		<property name="basename">
    			<value>messages</value>
    		</property>
    	</bean>
     
    	<bean id="studentListController"
    		class="com.oyejava.springmvc.StudentListController">
    		<property name="studentDao" ref="studentDao" />
    	</bean>
     
    	<!-- command class and command name are used to retrieve and set the 
    	    value as name value pair in HttpRequest and Response. The form view
    	    tells that when the request comes for this Controller than which
    	    form to display in which user input can be taken. -->
     
    	<bean id="studentCreateController"
    		class="com.oyejava.springmvc.StudentCreateController">
    		<property name="studentDao" ref="studentDao" />
    		<property name="formView" value="createStudent" />
    		<property name="commandName" value="student" />
    		<property name="commandClass" value="com.oyejava.springmvc.Student" />
    		<property name="validator">
    			<bean class="com.oyejava.springmvc.StudentValidator" />
    		</property>
    	</bean>
     
    	<bean id="loggingInterceptor"
    		class="com.oyejava.springmvc.LoggingInterceptor" />
     
    	<bean id="simpleUrlMapping"
    		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    		<property name="interceptors">
    			<list>
    				<ref local="loggingInterceptor" />
    			</list>
    		</property>
    		<property name="mappings">
    			<props>
    				<prop key="/studentList.htm">
    					studentListController
    				</prop>
    				<prop key="/createStudent.htm">
    					studentCreateController
    				</prop>
    			</props>
    		</property>
    	</bean>
     
    	<bean id="viewResolver"
    		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix">
    			<value>/WEB-INF/jsp/</value>
    		</property>
    		<property name="suffix">
    			<value>.jsp</value>
    		</property>
    	</bean>
     
    </beans>

  2. #2
    Membre éprouvé
    Avatar de hasalex
    Homme Profil pro
    Développeur Java
    Inscrit en
    Janvier 2009
    Messages
    879
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2009
    Messages : 879
    Points : 1 269
    Points
    1 269
    Par défaut
    Salut à toi,

    Tout d'abord, je ne vois pas de message d'ERROR, mais que du WARN ou WARNING.
    Le premier a l'air d'être lié à une config eclipse. Je serai incapable de t'aider.
    Pour le dernier, est-ce que tu as essayé d'accéder à l'application ? Et avec quelle URL ?

  3. #3
    Nouveau membre du Club
    Inscrit en
    Juillet 2005
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Juillet 2005
    Messages : 49
    Points : 34
    Points
    34
    Par défaut
    Bonjour Hasalex,

    merci pour votre réponse. J'ai exécuté l'application ainsi: «Run on server». J'obtiens l'erreur 404 en tentant d'accéder à l'application à travers l'URL «http://localhost:8080/SpringMVC/».

  4. #4
    Membre éprouvé
    Avatar de hasalex
    Homme Profil pro
    Développeur Java
    Inscrit en
    Janvier 2009
    Messages
    879
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Janvier 2009
    Messages : 879
    Points : 1 269
    Points
    1 269
    Par défaut
    OK. Une erreur 404 ne signifie pas que tu as une erreur dans l'application, mais que tu n'as pas de page pour ton URL.
    Essaie d'ajouter une page index.jsp et teste.

Discussions similaires

  1. Réponses: 4
    Dernier message: 15/06/2011, 00h11
  2. Spring vis à vis projet Tomcat classique
    Par smiles dans le forum Spring
    Réponses: 2
    Dernier message: 13/04/2010, 12h25
  3. Réponses: 1
    Dernier message: 19/11/2008, 14h38
  4. [ spring ] transaction tomcat
    Par hocinema dans le forum Tomcat et TomEE
    Réponses: 3
    Dernier message: 11/10/2005, 21h04
  5. [Tomcat][Spring] Problème utilisation mémoire
    Par Wutintin dans le forum Hibernate
    Réponses: 12
    Dernier message: 08/09/2005, 14h57

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