Vraptor 4 + Tomcat não funciona

1 resposta
C

Boa Noite,

Estou tentando configurar o vraptor 4 com o tomcat 8 mais o mesmo não esta funcionado.
Não estou usando o maven, coloquei todas as libs da distribuição do vraptor no projeto e mesmo assim não funciona.

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://xmlns.jcp.org/xml/ns/javaee"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	id="project-id" version="3.1">

	<session-config>
		<session-timeout>30</session-timeout>
	</session-config>

	<listener>
		<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
	</listener>

	<resource-env-ref>
		<resource-env-ref-name>BeanManager</resource-env-ref-name>
		<resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>
	</resource-env-ref>

	<context-param>
		<param-name>br.com.caelum.vraptor.encoding</param-name>
		<param-value>UTF-8</param-value>
	</context-param>
</web-app>
Erro
GRAVE: Error configuring application listener of class org.jboss.weld.environment.servlet.Listener
java.lang.ClassNotFoundException: org.jboss.weld.environment.servlet.Listener
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)
	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)
	at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:520)
	at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:501)
	at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:120)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4642)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5154)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
	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)

O problema e que quando mudo do tomcat para o wildfly o mesmo funciona sem problema nenhum.

1 Resposta

Rafael_Guerreiro

Coloque o arquivo beans.xml dentro da pasta WEB-INF, com esse conteúdo:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans 	xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
							http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
		version="1.1" bean-discovery-mode="annotated"&gt;

&lt;/beans&gt;
Criado 20 de fevereiro de 2015
Ultima resposta 20 de fev. de 2015
Respostas 1
Participantes 2