Problemas com JSF e CDI

Boa tarde pessoal!

Estou tendo dificuldades em solucionar um erro:

Informações: Server startup in 10047 ms
Dez 18, 2012 4:02:49 PM org.apache.catalina.core.StandardWrapperValve invoke
Grave: Servlet.service() for servlet [Faces Servlet] in context with path [/bbcanais] threw exception [org.jboss.weld.exceptions.WeldException: by java.lang.ClassFormatError: Illegal class name "org/jboss/seam/transaction/org$jboss$seam$solder$bean$defaultbean$DefaultBean-org$jboss$weld$bean-flat-ManagedBean-org$jboss$seam$transaction$TransactionManagerSynchronizations[@javax$enterprise$context$ApplicationScoped()@org$jboss$seam$solder$bean$defaultbean$DefaultBean(value=interface_org$jboss$seam$transaction$Synchronizations)@org$jboss$seam$solder$reflection$Synthetic(index=1,namespace=org$jboss$seam$solder$defaultbean)]{org$jboss$seam$transaction$TransactionManagerSynchronizations$beanManager[@javax$inject$Inject()]$}_$$_WeldClientProxy" in class file org/jboss/seam/transaction/org$jboss$seam$solder$bean$defaultbean$DefaultBean-org$jboss$weld$bean-flat-ManagedBean-org$jboss$seam$transaction$TransactionManagerSynchronizations[@javax$enterprise$context$ApplicationScoped()@org$jboss$seam$solder$bean$defaultbean$DefaultBean(value=interface_org$jboss$seam$transaction$Synchronizations)@org$jboss$seam$solder$reflection$Synthetic(index=1,namespace=org$jboss$seam$solder$defaultbean)]{org$j] with root cause
java.lang.ClassFormatError: Illegal class name "org/jboss/seam/transaction/org$jboss$seam$solder$bean$defaultbean$DefaultBean-org$jboss$weld$bean-flat-ManagedBean-org$jboss$seam$transaction$TransactionManagerSynchronizations[@javax$enterprise$context$ApplicationScoped()@org$jboss$seam$solder$bean$defaultbean$DefaultBean(value=interface_org$jboss$seam$transaction$Synchronizations)@org$jboss$seam$solder$reflection$Synthetic(index=1,namespace=org$jboss$seam$solder$defaultbean)]{org$jboss$seam$transaction$TransactionManagerSynchronizations$beanManager[@javax$inject$Inject()]$}_$$_WeldClientProxy" in class file org/jboss/seam/transaction/org$jboss$seam$solder$bean$defaultbean$DefaultBean-org$jboss$weld$bean-flat-ManagedBean-org$jboss$seam$transaction$TransactionManagerSynchronizations[@javax$enterprise$context$ApplicationScoped()@org$jboss$seam$solder$bean$defaultbean$DefaultBean(value=interface_org$jboss$seam$transaction$Synchronizations)@org$jboss$seam$solder$reflection$Synthetic(index=1,namespace=org$jboss$seam$solder$defaultbean)]{org$j
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:143)
	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:109)
	at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:402)

Dao

import java.io.Serializable;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaQuery;

public class Dao<T> implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 870070493918233265L;
	private final Class<T> classe;
	EntityManager em;

	public Dao(Class<T> classe, EntityManager em) {
		this.classe = classe;
		this.em = em;
	}

	public void adiciona(T t) {
		//persiste o objeto
		em.persist(t);	
	}

	public void remove(T t) {	

		em.remove(em.merge(t));	
	}

	public void atualiza(T t) {

		em.merge(t);	
	}

	public List<T> listaTodos() {
		CriteriaQuery<T> query = em.getCriteriaBuilder().createQuery(classe);
		query.select(query.from(classe));

		List<T> lista = em.createQuery(query).getResultList();

		return lista;
	}
	
	public T buscaPorId(Long id) {
		T instancia = em.find(classe, id);
		return instancia;
	}
	
	public int contaTodos() {
		long result = (Long) em.createQuery("select count(n) from " + classe.getName() + " n").getSingleResult();
		
		return (int) result;
	}

	public List<T> listaTodosPaginada(int firstResult, int maxResults) {
		CriteriaQuery<T> query = em.getCriteriaBuilder().createQuery(classe);
		query.select(query.from(classe));

		List<T> lista = em.createQuery(query).setFirstResult(firstResult)
				.setMaxResults(maxResults).getResultList();

		return lista;
	}

}

daofactory

import java.io.Serializable;
import java.lang.reflect.ParameterizedType;

import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.inject.Inject;
import javax.persistence.EntityManager;


public class DAOFactory implements Serializable {	
	
	private static final long serialVersionUID = -7037203882724352660L;
	@Inject
	EntityManager em;

	@Produces
	public Dao createDAO(InjectionPoint injectPoint){
		ParameterizedType type = (ParameterizedType) injectPoint.getType();
		Class classe = (Class) type.getActualTypeArguments()[0];
		return new Dao(classe,em);
		
	}
	
}

model

import java.io.Serializable;
import java.util.List;

import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

import br.com.bb.bbcanais.Dao.InauguracaoDao;
import br.com.bb.bbcanais.Model.Inauguracao;


@SessionScoped
@Named
public class InauguracaoBean implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -2369280086738770700L;

	private Inauguracao inauguracao = new Inauguracao();

	private List<Object[]> tipologias;

	private List<Object[]> inauguradas;

	private List<Object[]> inauguracoes;

	public Inauguracao getInauguracao() {
		return inauguracao;
	}

	public void setInauguracao(Inauguracao inauguracao) {
		this.inauguracao = inauguracao;
	}

	public List<Object[]> getInauguracoes() {
		if (inauguracoes == null) {
			inauguracoes = new InauguracaoDao().BuscarPorOrdem();
		}
		return inauguracoes;
	}

	public void setInauguracoes(List<Object[]> inauguracoes) {
		this.inauguracoes = inauguracoes;
	}

	public void setTipologias(List<Object[]> tipologias) {
		this.tipologias = tipologias;
	}

	public void setInauguradas(List<Object[]> inauguradas) {
		this.inauguradas = inauguradas;
	}

	public List<Object[]> getInauguradas() {
		if (inauguradas == null) {
			System.out.println("Carregando as inauguradas do dia...");
			inauguradas = new InauguracaoDao().BuscarInauguradas();
		}
		return inauguradas;
	}

	public List<Object[]> getTipologias() {
		if (tipologias == null) {
			System.out.println("Carregando as tipologias...");
			tipologias = new InauguracaoDao().BuscarTodos();
		}
		return tipologias;
	}
}

bean


import java.io.Serializable;
import java.util.List;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import br.com.bb.bbcanais.Dao.InauguracaoDao;
import br.com.bb.bbcanais.Model.Inauguracao;

@SessionScoped
@Named
public class InauguracaoBean implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -2369280086738770700L;

	private Inauguracao inauguracao = new Inauguracao();

	private List<Object[]> tipologias;

	private List<Object[]> inauguradas;

	private List<Object[]> inauguracoes;

	public Inauguracao getInauguracao() {
		return inauguracao;
	}

	public void setInauguracao(Inauguracao inauguracao) {
		this.inauguracao = inauguracao;
	}

	public List<Object[]> getInauguracoes() {
		if (inauguracoes == null) {
			inauguracoes = new InauguracaoDao().BuscarPorOrdem();
		}
		return inauguracoes;
	}

	public void setInauguracoes(List<Object[]> inauguracoes) {
		this.inauguracoes = inauguracoes;
	}

	public void setTipologias(List<Object[]> tipologias) {
		this.tipologias = tipologias;
	}

	public void setInauguradas(List<Object[]> inauguradas) {
		this.inauguradas = inauguradas;
	}

	public List<Object[]> getInauguradas() {
		if (inauguradas == null) {
			System.out.println("Carregando as inauguradas do dia...");
			inauguradas = new InauguracaoDao().BuscarInauguradas();
		}
		return inauguradas;
	}

	public List<Object[]> getTipologias() {
		if (tipologias == null) {
			System.out.println("Carregando as tipologias...");
			tipologias = new InauguracaoDao().BuscarTodos();
		}
		return tipologias;
	}
}

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" 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_3_0.xsd"
	id="WebApp_ID" version="3.0">
	<display-name>bbcanais</display-name>
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.jsf</url-pattern>
	</servlet-mapping>
	<context-param>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>server</param-value>
	</context-param>
	<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>primefaces.THEME</param-name>
		<param-value>sam</param-value>
	</context-param>

	<!-- <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> 
		<welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> 
		<welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> 
		</welcome-file-list> -->


</web-app>

Galera fiz o context.xml na pasta META-INF

<Context>
<Resource
name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory"/>
</Context>

Essas são as configurações. Se alguém já solucionou esse tipo de erro.

Oi joelson123

Até onde eu utilizei o CDI, eu sempre criei uma interface para uma determinada classe que eu precisaria injetar.

No que eu vi, você tem uma classe DAO sendo que deveria ter uma Interface, pois o CDI (Weld) pega a sua interface e criar um objeto encapsulando a sua classe que implementa a interface, isso em tempo de execução.

Modifique a estrutura do seu sistema para

interface DAO > class DAOImpl > e no DAOFactory, você retorna a interface, mas cria o DAOImpl.

E onde for utilizar, o dao, você deveria ter um @Inject para a classe que precisa.