web-dev-qa-db-fra.com

Tomcat 7 "GRAVE: un conteneur enfant a échoué au démarrage"

En gros, j’ai écrit une application springMVC (avec une approche relativement simpliste en ce qui concerne Spring). Le projet fonctionne bien sur Tomcat 6. Mon serveur Tomcat ne démarre pas et lève l'exception suivante: 

Apr 29, 2012 3:41:00 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: /usr/bin/jdk1.7.0_03/jre/lib/AMD64/server:/usr/bin/jdk1.7.0_03/jre/lib/AMD64:/usr/bin/jdk1.7.0_03/jre/../lib/AMD64:/usr/lib/jvm/Java-6-openjdk/jre/lib/AMD64/server:/usr/lib/jvm/Java-6-openjdk/jre/lib/AMD64:/usr/lib/jvm/Java-6-openjdk/jre/../lib/AMD64:/usr/Java/packages/lib/AMD64:/usr/lib64:/lib64:/lib:/usr/lib
Apr 29, 2012 3:41:00 PM org.Apache.Tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.Eclipse.jst.j2ee.server:spring-security-integration' did not find a matching property.
Apr 29, 2012 3:41:00 PM org.Apache.Tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.Eclipse.jst.jee.server:Spring3Hibernate' did not find a matching property.
Apr 29, 2012 3:41:00 PM org.Apache.Tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.Eclipse.jst.jee.server:assessment' did not find a matching property.
Apr 29, 2012 3:41:00 PM org.Apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Apr 29, 2012 3:41:00 PM org.Apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Apr 29, 2012 3:41:00 PM org.Apache.catalina.startup.Catalina load
INFO: Initialization processed in 654 ms
Apr 29, 2012 3:41:00 PM org.Apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 29, 2012 3:41:00 PM org.Apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Apr 29, 2012 3:41:01 PM org.Apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Sun Apr 29 15:41:01 BST 2012]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3dd5df15: defining beans []; root of factory hierarchy
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 226 ms
Apr 29, 2012 3:41:01 PM org.Apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'appServlet'
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Sun Apr 29 15:41:01 BST 2012]; parent: Root WebApplicationContext
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
INFO : org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@cf10596: defining beans [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver#0,org.springframework.web.servlet.mvc.annotation.ResponseStatusExceptionResolver#0,org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver#0,org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.view.InternalResourceViewResolver#0,dataSource,sessionFactory,homeController,userManagementController,userService,userDao,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.web.servlet.view.ContentNegotiatingViewResolver#0,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@3dd5df15
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public Java.lang.String org.assessme.com.controller.HomeController.home(Java.util.Locale,org.springframework.ui.Model)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/userManagement/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public Java.lang.Object org.assessme.com.controller.UserManagementController.home(Java.util.Locale,org.springframework.ui.Model)
INFO : org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/userManagement/getUser],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.assessme.com.entity.User org.assessme.com.controller.UserManagementController.data(Java.util.Locale,org.springframework.ui.Model)
INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 1846 ms
Apr 29, 2012 3:41:03 PM org.Apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
Java.util.concurrent.ExecutionException: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Spring3Hibernate]]
    at Java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.Java:252)
    at Java.util.concurrent.FutureTask.get(FutureTask.Java:111)
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:1128)
    at org.Apache.catalina.core.StandardHost.startInternal(StandardHost.Java:782)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1566)
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1556)
    at Java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.Java:334)
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:166)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1110)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:603)
    at Java.lang.Thread.run(Thread.Java:722)
Caused by: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Spring3Hibernate]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:154)
    ... 7 more
Caused by: org.Apache.Tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 60
    at org.Apache.Tomcat.util.bcel.classfile.Constant.readConstant(Constant.Java:131)
    at org.Apache.Tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.Java:60)
    at org.Apache.Tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.Java:209)
    at org.Apache.Tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.Java:119)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.Java:2032)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.Java:1923)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.Java:1891)
    at org.Apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.Java:1877)
    at org.Apache.catalina.startup.ContextConfig.webConfig(ContextConfig.Java:1270)
    at org.Apache.catalina.startup.ContextConfig.configureStart(ContextConfig.Java:855)
    at org.Apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.Java:345)
    at org.Apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.Java:119)
    at org.Apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.Java:90)
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5161)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
    ... 7 more

Je ne suis vraiment pas sûr de ce à quoi cela fait référence, je suis plus qu'heureux de montrer n'importe quel code, etc., mais je ne sais pas vraiment de quoi il s'agit. Ci-dessous, mon fichier pom.xml, au cas où cela pourrait être pertinent. 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.Apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0 http://maven.Apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.assessme</groupId>
    <artifactId>com</artifactId>
    <name>assessme</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <Java-version>1.6</Java-version>
        <org.springframework-version>3.1.0.RELEASE</org.springframework-version>
        <org.aspectj-version>1.6.9</org.aspectj-version>
        <org.slf4j-version>1.5.10</org.slf4j-version>
    </properties>
    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>

                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${org.slf4j-version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${org.slf4j-version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.Sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.Sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Persistence -->

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>


        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>3.5.6-Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-annotations</artifactId>
            <version>3.5.6-Final</version>
        </dependency>
        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.11.0.GA</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-Java</artifactId>
            <version>5.1.18</version>
        </dependency>


        <!-- Jackson JSON Mapper -->
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.5</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-Eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.Eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.Eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.Apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

Quelqu'un a-t-il une idée? 

33
david99world

Quand une application servlet 3.0 démarre, le conteneur doit analyser toutes les classes pour les annotations (à moins que metadata-complete = true). Tomcat utilise un fork (sans ajouts, seulement le code inutilisé supprimé) d'Apache Commons BCEL pour effectuer cette analyse. L'application Web ne parvient pas à démarrer car BCEL a rencontré quelque chose qu'elle ne comprend pas.

Si les applications fonctionnent correctement sur Tomcat 6, l'ajout de metadata-complete = "true" dans votre fichier web.xml ou la déclaration de votre application en tant qu'application 2.5 dans le fichier web.xml arrêtera l'analyse des annotations.

Pour le moment, cela ressemble à un problème de la classe en cours d'analyse. Cependant, jusqu'à ce que nous sachions quelle classe est à l'origine du problème et que nous examinions de plus près, nous ne le saurons pas. Il faudra que je modifie Tomcat pour consigner un message d'erreur plus utile qui nomme la classe en question. Vous pouvez suivre les progrès sur ce point à l'adresse suivante: https://issues.Apache.org/bugzilla/show_bug.cgi?id=53161

28
Mark Thomas

vous pouvez le réparer avec: 

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>${servlet-api-version}</version>
    <scope>provided</scope>
</dependency>

fourni résout ce problème

23
Max Sassen

J'ai récemment déménagé sur un nouveau PC tous mes projets Eclipse. J'ai vécu ce problème. Ce que j'ai fait était:

  1. supprimé le projet de Tomcat
  2. nettoyer Tomcat
  3. exécuter le projet dans Tomcat
10
arn-arn

Si vous pensez que précédemment, il fonctionnait correctement et que maintenant, il commençait à montrer le problème particulier. Ensuite, il ne s'agit que d'une méthode à succès et d'essai à résoudre. afin d'obtenir une meilleure solution, vous pouvez suivre les étapes ci-dessous

  1. supprimez votre Tomcat existant, si possible
  2. supprimer votre projet et ajouter votre projet avec une nouvelle construction
  3. ajoutez votre serveur Tomcat
  4. nettoyer le projet et rafraîchir le projet
  5. aller pour le mode en cours d'exécution ou de débogage
3
Ram

C'est généralement le problème avec le fichier descripteur web.xml. Peut-être avez-vous mélangé les annotations et les définitions de description du servlet web.xml. S'il vous plaît vérifier la console pour plus d'informations.

2
Guru

"il n'y a pas de problème avec Tomcat".

J'ai souffert de 4 à 5 jours pour résoudre le problème (même problème que mentionné ci-dessus). Ici, j'utilisais Tomcat 8.5. Enfin, le problème a été résolu, il s’agissait des «fichiers JAR corrompus». Vous devez supprimer tout votre référentiel .m2 (pour moi, C:\Users\Bandham.m2\repository). exécutez la commande "mvn clean install" à partir du dossier de votre projet. 

codage heureux.

Donnez-en un si cela résout votre problème.

1
Bandham Manikanta

Tomcat Server ne parvient pas à démarrer et lève l'exception car, dans la section Deployment Descriptor:MyProyect / Servlet Mappings, des mappages n'existent pas. Supprimer ou corriger ces éléments; puis démarrer le serveur fonctionne sans problèmes.

0
Gabriel

J'ai le même problème il y a quelques mois. Ceci résout mon problème en utilisant Maven au lieu d’une version téléchargée de Spring et de quelques modifications dans le fichier web.xml.

pom.xml

<project xmlns="http://maven.Apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0 http://maven.Apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>SpringWEB1</groupId>
  <artifactId>SpringWEB1</artifactId>
  <version>1</version>
  <packaging>war</packaging>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.2</version>
    </dependency>
  </dependencies>
</project>

Controller.Java

package com.jmtm.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@org.springframework.stereotype.Controller
public class Controller {

    @RequestMapping("/hi")
    public ModelAndView hi(){
        return new ModelAndView("Hello", "msg", "Hello user.");
    }

}

spring-servlet.xml

<?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:c="http://www.springframework.org/schema/c"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:p="http://www.springframework.org/schema/p"
    xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd">

    <context:component-scan base-package="com.jmtm.controller"></context:component-scan>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix">
            <value>/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

</beans>

Et la partie la plus importante de la solution, incluez le chemin du répartiteur de servlets (A.K.A. spring-servlet.xml) dans le fichier web.xml.

<?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" xsi:schemaLocation="http://Java.Sun.com/xml/ns/javaee http://Java.Sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>SpringWEB1</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>spring</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

</web-app>

Quelque chose de bizarre se passe lorsque j'essaie de résoudre ce problème. Toute version téléchargée de Spring à partir de maven.springframework.org/release/org/springframework/spring me donne beaucoup de problèmes (Tomcat n’a pas pu trouver le servlet, Spring l’a arrêté, Eclipse n’a pas pu démarrer le serveur {weird }) donc avec beaucoup de problèmes trouver beaucoup de solutions partielles. J'espère que cela fonctionne pour vous.

À titre d’aide supplémentaire, dans Eclipse, téléchargez l’outil Spring STS pour Eclipse dans Eclipse Marketplace, ce qui vous aidera à créer des fichiers de configuration (servlet.xml) et à écrire le code de la servlet dans le fichier web.xml.

0
Juan Torres

J'ai le même problème, mais dans mon cas, j'ai ajouté par erreur un contexte dans-serveur.xml (rép_install_Tomcat/conf /) et ne déployait pas la guerre correspondante dans webapps (rép. Rép_install_Install/webapps) . Lorsque j'ai supprimé ce contexte et redémarré Tomcat, cela a bien fonctionné.

0
Shiv

C'est ce à quoi je suis confronté depuis longtemps. 

C’est ce qui s’est passé la dernière fois et il est apparu qu’un cas pouvait être un déploiement de mauvaise guerre, qui est survenu après la mise à jour des dépendances bibliothèque/maven sur pom et l’a réinstallé.

SOLUTION: 

right click on the server >  remove the war and 
right click on the server again > clean
make sure the maven dependencies are added to deployment Assembly
right click on the project > Run As > maven clean
right click on the project again > Run As > maven install 
and finally deploy the project on to the server. This helped me to solve the issue  
0
tadtab

pour moi, un cas est que je viens de manquer à maven projet de mise à jour qui a causé le même problème

maven update project et essayez si vous voyez des erreurs dans POM.xml

0

En tant que solution générique, je vous recommande de supprimer toutes les dépendances secondaires et d’exécuter l’application; si cela fonctionnait, de revenir en arrière et de continuer de le faire tant que l’application démarre, vous pourrez enfin identifier la dépendance a causé le problème.

Par exemple, en utilisant la même méthode, j'ai constaté que des dépendances dont l'ID de groupe est: org.Apache.axis2 ont été à l'origine du problème.

 <dependency>
        <groupId>org.Apache.axis2</groupId>
        <artifactId>axis2-transport-local</artifactId>
        <version>1.6.1</version>
 </dependency>
 <dependency>
        <groupId>org.Apache.axis2</groupId>
        <artifactId>axis2-transport-http</artifactId>
        <version>1.6.1</version>
 </dependency>
0
Yazid Erman

Ce même problème s'est produit pour moi et trace de pile 

SEVERE: A child container failed during start
Java.util.concurrent.ExecutionException: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/XXXXSearch]]
    at Java.util.concurrent.FutureTask.report(FutureTask.Java:122)
    at Java.util.concurrent.FutureTask.get(FutureTask.Java:192)
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:1123)
    at org.Apache.catalina.core.StandardHost.startInternal(StandardHost.Java:800)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1559)
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1549)
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:266)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
    at Java.lang.Thread.run(Thread.Java:745)
Caused by: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/XXXXSearch]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:154)
    ... 6 more
Caused by: Java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/XXXXSearch]. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.Java:2109)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.Java:1981)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.Java:1947)
    at org.Apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.Java:1932)
    at org.Apache.catalina.startup.ContextConfig.webConfig(ContextConfig.Java:1326)
    at org.Apache.catalina.startup.ContextConfig.configureStart(ContextConfig.Java:878)
    at org.Apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.Java:369)
    at org.Apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.Java:119)
    at org.Apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.Java:90)
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5179)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
    ... 6 more
Caused by: Java.lang.StackOverflowError
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)
    at org.Apache.catalina.startup.ContextConfig.populateSCIsForCacheEntry(ContextConfig.Java:2269)

Dans mon analyse, ce que j’ai trouvé est que ce problème se produit lorsque des dépendances d’héritage cycliques illégales sont générées pour le traitement des annotations de démarrage Tomcat.

Mais mon projet comportait de nombreux fichiers JAR de dépendance et ne permettait pas de déterminer lequel en était responsable.

Après avoir essayé tant d’approches malheureuses, j’ai mis à jour mon plugin Tomcat pour suivre et exécuté le même scénario,

<plugin>
    <groupId>org.Apache.Tomcat.maven</groupId>
    <artifactId>Tomcat8-maven-plugin</artifactId>
    <version>3.0-r1756463</version>
<\plugin>

Ensuite, j'ai pu trouver quel JAR est causé par ce problème,

Aug 23, 2017 2:32:12 PM org.Apache.catalina.startup.ContextConfig processAnnotationsJar
SEVERE: Unable to process Jar entry [cryptix/test/TestLOKI91.class] from Jar [jar:file:/C:/Users/Tharinda/.m2/repository/cryptix/cryptix/1.2.2/cryptix-1.2.2.jar!/] for annotations
Java.io.EOFException
    at org.Apache.Tomcat.util.bcel.classfile.FastDataInputStream.readUnsignedShort(FastDataInputStream.Java:120)
    at org.Apache.Tomcat.util.bcel.classfile.ClassParser.readAttributes(ClassParser.Java:110)
    at org.Apache.Tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.Java:94)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.Java:1994)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.Java:1944)
    at org.Apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.Java:1919)
    at org.Apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.Java:1880)
    at org.Apache.catalina.startup.ContextConfig.webConfig(ContextConfig.Java:1149)
    at org.Apache.catalina.startup.ContextConfig.configureStart(ContextConfig.Java:771)
    at org.Apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.Java:305)
    at org.Apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.Java:117)
    at org.Apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.Java:90)
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5120)
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1408)
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1398)
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:266)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
    at Java.lang.Thread.run(Thread.Java:745)

Ensuite, résoudre le problème avec cryptix-1.2.2.jar a résolu ce problème.

Je recommande fortement de déplacer Tomcat8-maven-plugin qui semble stable et moins bogué pour le moment.

0
Tharinda_tpw

Ne paniquez pas. Avez-vous copié le code de servlet? D'accord,

@WebServlet("/HelloWord")
public class HelloWorld extends HttpServlet {
private static final long serialVersionUID = 1L;

Vous avez donné le même chemin @WebServlet("/HelloWord") pour les deux servlets avec des noms différents.

Si vous créez un fichier web.xml, cochez la case classpath.

0
Milind

Cela semble que la version de l'API servlet que vous utilisez est plus ancienne que le xsd que vous utilisez dans web.xml, par exemple 3.0

utilisez celui-ci **** http: //Java.Sun.com/xml/ns/javaee/ "id =" IDApp Web "version =" 2.5 "> ****

0
arjun kumar mehta