Segue, conforme solicitado, o LOG exibido no console ao subir o tomcat: Parece que tem erros. Não mandei antes porque achei que era outro log gerado em ../tomcat 7.0/logs/commoms-daemon ... . Lá não aparece erros.
Set 18, 2015 9:55:17 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:desenvolvimento-web-com-vraptor-4-master' did not find a matching property.
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version: Apache Tomcat/7.0.63
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built: Jun 30 2015 08:08:33 UTC
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number: 7.0.63.0
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name: Windows 7
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version: 6.1
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture: amd64
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Java Home: C:\Program Files\Java\jre7
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version: 1.7.0_79-b15
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor: Oracle Corporation
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE: C:\Users\Robson\workspaceVraptor4.metadata.plugins\org.eclipse.wst.server.core\tmp0
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME: C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\Users\Robson\workspaceVraptor4.metadata.plugins\org.eclipse.wst.server.core\tmp0
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\Users\Robson\workspaceVraptor4.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\endorsed
Set 18, 2015 9:55:17 AM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
Set 18, 2015 9:55:17 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: 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 (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Java\jdk1.7.0_79\bin;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.4 & MySQL Utilities 1.5.4 1.5\Doctrine extensions for PHP\;C:\Program Files (x86)\Brackets\command;C:\apache-ant-1.9.6\bin;C:\apache-maven-3.3.3\bin;.
Set 18, 2015 9:55:30 AM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-bio-8080"]
Set 18, 2015 9:55:30 AM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-bio-8009"]
Set 18, 2015 9:55:30 AM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 14807 ms
Set 18, 2015 9:55:31 AM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
Set 18, 2015 9:55:31 AM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/7.0.63
Set 18, 2015 9:55:34 AM org.apache.catalina.startup.TldConfig execute
INFORMAÇÕES: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
Set 18, 2015 9:55:43 AM org.apache.catalina.core.StandardContext listenerStart
GRAVE: Exception sending context initialized event to listener instance of class org.jboss.weld.environment.servlet.Listener
org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type EntityManager with qualifiers @Default
at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public br.com.caelum.vraptor.dao.ProdutoDao(EntityManager)
at br.com.caelum.vraptor.dao.ProdutoDao.(ProdutoDao.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:361)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:282)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:133)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:507)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
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)
Set 18, 2015 9:55:43 AM org.apache.catalina.core.StandardContext startInternal
GRAVE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Set 18, 2015 9:55:43 AM org.apache.catalina.core.StandardContext startInternal
GRAVE: Context [/vraptor-produtos] startup failed due to previous errors
Set 18, 2015 9:55:43 AM org.apache.catalina.core.StandardContext listenerStop
GRAVE: Exception sending context destroyed event to listener instance of class org.jboss.weld.environment.servlet.Listener
java.lang.NullPointerException
at org.jboss.weld.servlet.WeldInitialListener.contextDestroyed(WeldInitialListener.java:102)
at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.contextDestroyed(ForwardingServletListener.java:30)
at org.jboss.weld.environment.servlet.Listener.contextDestroyed(Listener.java:85)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:5064)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5726)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:160)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
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)
Set 18, 2015 9:55:43 AM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-bio-8080"]
Set 18, 2015 9:55:43 AM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-bio-8009"]
Set 18, 2015 9:55:43 AM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 12541 ms
//=============================================================
Código Fonte : Class ProdutoController
//=============================================================
package br.com.caelum.vraptor.controller;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import br.com.caelum.vraptor.Controller;
import br.com.caelum.vraptor.Delete;
import br.com.caelum.vraptor.Get;
import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Post;
import br.com.caelum.vraptor.Result;
import br.com.caelum.vraptor.dao.ProdutoDao;
import br.com.caelum.vraptor.model.Produto;
import br.com.caelum.vraptor.util.JPAUtil;
import br.com.caelum.vraptor.view.Results;
@Controller
public class ProdutoController {
private final Result result;
private final ProdutoDao dao;
@Inject
public ProdutoController(Result result, ProdutoDao dao) {
this.result = result;
this.dao = dao;
}
public ProdutoController() {
this(null, null);
}
@Get("/")
public void inicio() {
}
@Get
public List lista() {
return dao.lista();
}
@Get
public void listaXML() {
result.use(Results.xml()).from(dao.lista()).serialize();
}
@Get
public void formulario() {
}
@Post
public void adiciona(Produto produto) {
dao.adiciona(produto);;
result.include("mensagem", "Produto adicionado com sucesso!");
result.redirectTo(this).lista();
}
@Get
public void remove(Produto produto){
dao.remove(produto);
result.include("mensagem", "Produto removido com sucesso!");
result.redirectTo(this).lista();
}
}
//=============================================================
Código Fonte : Class ProdutoDao
//=============================================================
package br.com.caelum.vraptor.dao;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import br.com.caelum.vraptor.model.Produto;
public class ProdutoDao {
private final EntityManager em;
@Inject
public ProdutoDao(EntityManager em) {
this.em = em;
}
public ProdutoDao() {
this(null);
}
public void adiciona(Produto produto) {
em.getTransaction().begin();
em.persist(produto);
em.getTransaction().commit();
}
public void remove(Produto produto) {
em.getTransaction().begin();
em.remove(busca(produto));
em.getTransaction().commit();
}
public Produto busca(Produto produto) {
return em.find(Produto.class, produto.getId());
}
@SuppressWarnings("unchecked")
public List lista() {
return em.createQuery("select p from Produto p").getResultList();
}
}
//=============================================================
Código Fonte : Class EntityManagerProducer
//=============================================================
package br.com.caelum.vraptor.util;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.persistence.EntityManager;
public class EntityManagerProducer {
@Produces
public EntityManager criaEM() {
return JPAUtil.criaEntityManager();
}
}