Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

'Starting Tomcat v8.5 Server at localhost' has encountered a problem

Boa tarde

Estou tentando aplicar a estrutura deste curso a outro projeto. A parte de configuração toda é igual, porém usando Maven logo de início.

Quando tento dar start no Tomcat com este novo projeto rodando, ele abre uma janela com essa mensagem de erro e a seguinte exception:

GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/projeto]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/projeto]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    ... 6 more
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject br.com.dominio.projeto.tx.GerenciadorDeTransacao.manager
  at br.com.dominio.projeto.tx.GerenciadorDeTransacao.manager(GerenciadorDeTransacao.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281)
    at org.jboss.weld.bootstrap.Validator.validateInterceptor(Validator.java:556)
    at org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:85)
    at org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:83)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
    ... 4 more

ago 13, 2017 12:49:01 PM org.apache.catalina.core.ContainerBase startInternal
GRAVE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:939)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:656)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:872)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 6 more

ago 13, 2017 12:49:01 PM org.apache.catalina.startup.Catalina start
GRAVE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:656)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:355)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:495)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:793)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:947)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more

Observações:

  • Meu Eclipse se recusa a criar projetos Maven sem a escolha de um archetype, então usai o WebApp
  • Inicialmente ele apenas dava 404 nas minhas páginas (quando resolver o problema do Tomcat, voltarei a este problema).
  • Pesquisando online, algumas pessoas sugeriam dar um clean no Tomcat para resolver o problema do 404. Desde então começou a dar diversos erros.
  • Percebi que o projeto possuía erros com relação ao Dynamic Web Module e a versão do Java. Aparentemente o Maven criou o projeto como sendo Java 1.5 por algum motivo.
  • Mudei nos Facets pra Java 1.8, DWM 3.0
  • No Compiler eu desmarquei o Enable project specific settings
  • No Build Path eu removi o Java 1.5 e adicionei o 1.8.
  • Depois dessas alterações, o Tomcat começou a dar este erro.
  • Fui de volta olhar, e quando eu dou um update project no Maven, ele marca de novo o enable project specific settings e desmarca o Java 1.8 no Build Path (pelo menos não bota o 1.5 de volta).
  • O projeto da livraria, sem Maven, não causa este erro no Tomcat
  • Segue abaixo minha estrutura de diretórios:
    src
    \__main
       \__java
          |__br
          |  \__...
          \__META-INF
             \__persistence.xml
    WebContent
    |__META-INF
    |  |__context.xml
    |  \__MANIFEST.MF
    |__WEB-INF
    |  |__beans.xml
    |  |__faces-config.xml
    |  \__web.xml
    \__paginas.xhtml
  • Segue abaixo, meu 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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>br.com.dominio</groupId>
      <artifactId>projeto</artifactId>
      <packaging>war</packaging>
      <version>0.0.1-SNAPSHOT</version>
      <name>projeto Maven Webapp</name>
      <url>http://maven.apache.org</url>
      <properties>
          <maven.compiler.source>1.8</maven.compiler.source>
          <maven.compiler.target>1.8</maven.compiler.target>
      </properties>
      <dependencies>
          <dependency>
              <groupId>junit</groupId>
              <artifactId>junit</artifactId>
              <version>3.8.1</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.jboss.weld.servlet</groupId>
              <artifactId>weld-servlet</artifactId>
              <version>2.3.3.Final</version>
          </dependency>
          <dependency>
              <groupId>javax.validation</groupId>
              <artifactId>validation-api</artifactId>
              <version>1.1.0.Final</version>
          </dependency>
          <dependency>
              <groupId>org.primefaces</groupId>
              <artifactId>primefaces</artifactId>
              <version>5.3</version>
          </dependency>
          <dependency>
              <groupId>org.primefaces.themes</groupId>
              <artifactId>all-themes</artifactId>
              <version>1.0.10</version>
          </dependency>
          <dependency>
              <groupId>mysql</groupId>
              <artifactId>mysql-connector-java</artifactId>
              <version>5.1.38</version>
          </dependency>
          <dependency>
              <groupId>org.hibernate</groupId>
              <artifactId>hibernate-entitymanager</artifactId>
              <version>5.1.0.Final</version>
          </dependency>
          <dependency>
              <groupId>com.sun.faces</groupId>
              <artifactId>jsf-api</artifactId>
              <version>2.2.13</version>
          </dependency>
          <dependency>
              <groupId>com.sun.faces</groupId>
              <artifactId>jsf-impl</artifactId>
              <version>2.2.13</version>
          </dependency>
      </dependencies>
      <repositories>
          <repository>
              <id>prime-repo</id>
              <name>PrimeFaces Maven Repository</name>
              <url>http://repository.primefaces.org</url>
              <layout>default</layout>
          </repository>
      </repositories>
      <build>
          <finalName>projeto</finalName>
      </build>
    </project>

O que posso estar fazendo de errado?

Obrigado!

2 respostas

Fala Guilherme, tudo bem?

O problema esta no WELD e EntityManager:

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject br.com.dominio.projeto.tx.GerenciadorDeTransacao.manager
  at br.com.dominio.projeto.tx.GerenciadorDeTransacao.manager(GerenciadorDeTransacao.java:0)

Tenta adicionar essas dependências no seu POM:

<dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
</dependency>
<dependency>
      <groupId>org.jboss.weld</groupId>
      <artifactId>weld-core-impl</artifactId>
</dependency>
<dependency>
      <groupId>org.jboss.weld.servlet</groupId>
      <artifactId>weld-servlet</artifactId>
</dependency>

caso não funcione, no curso de CDI é usado o mesmo projeto porém com Maven, você pode pegar o pom desse projeto e aplicar no seu.

Espero ter ajudado =)

solução!

Olá, Samir. Obrigado pela tua resposta.

Descobri onde estava o meu problema. Estava no momento em que ele usava o @Inject em alguns lugares, pois estava com uma classe mal estruturada.