Estou precisando de uma grande ajuda! O meu modelo já está pronto e funcionando. Agora o meu projeto web está com esse erro:
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V
Vou postar o log completo, pode está passando algo que eu nao estou conseguindo ver. E vou postar também meus arquivos de configuração do projeto web, todos em WEB-INF…
applicationContext.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:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
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.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- Classe responsável pela gestão das entidades -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="os" />
</bean>
<!-- Identifica os beans anotados com @Service, @Repository, @Controller -->
<context:component-scan base-package="br.com.mfl.controller" />
<!-- Habilita a configuração de beans via anotações
sem a necessidade de usar PersistenceAnnotationBeanPostProcessor,
AutowiredAnnotationBeanPostProcessor e etc
-->
<context:annotation-config />
<!-- Trabalha com a anotação @Autowired
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />
Trabalha com a anotação @Resource
<bean
class="org.springframework.orm.jpa.support.
PersistenceAnnotationBeanPostProcessor" />
-->
<!-- Classe responsável pela gestão das transações -->
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory"
ref="entityManagerFactory" />
</bean>
<!-- Marcação de transações através de anotações -->
<tx:annotation-driven />
<!-- Declaração de Beans no Spring -->
<bean id="ufDao" class="br.com.mfl.dao.imp.UfDaoImp" />
<bean id="empresaDao" class="br.com.mfl.dao.imp.EmpresaDaoImp" />
</beans>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<application>
<!-- Configura o Apache MyFaces Trinidad para utilizar o UploadFile -->
<default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
<!-- Configura o Spring 2.5 para trabalhar com JSF 1.2 -->
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>
<managed-bean>
<managed-bean-name>empresaController</managed-bean-name>
<managed-bean-class>br.com.mfl.controller.EmpresaController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<!-- Navegação de qualquer lugar da administração -->
<navigation-rule>
<from-view-id>/admin/*</from-view-id>
<navigation-case>
<from-outcome>formEmpresa</from-outcome>
<to-view-id>/admin/formEmpresa.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>cancelar</from-outcome>
<to-view-id>/admin/home.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>mostrarEmpresas</from-outcome>
<to-view-id>/admin/mostrarEmpresas.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<!-- Navegação administrativa do cadastro de categoria -->
<navigation-rule>
<from-view-id>/admin/formEmpresa.xhtml</from-view-id>
<navigation-case>
<from-outcome>sucesso</from-outcome>
<to-view-id>/admin/mostrarEmpresas.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
web.xml
<?xml version="1.0"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<description>Facelets StarterKit</description>
<display-name>os</display-name>
<context-param>
<param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.REFRESH_PERIOD</param-name>
<param-value>2</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<filter>
<filter-name>trinidad</filter-name>
<filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>trinidad</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<filter>
<filter-name>openEntityManager</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>openEntityManager</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- resource loader servlet -->
<servlet>
<servlet-name>resources</servlet-name>
<servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
</servlet>
<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>resources</servlet-name>
<url-pattern>/adf/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<security-constraint>
<display-name>Bloqueia o browser de acessar arquivos xhtml</display-name>
<web-resource-collection>
<web-resource-name>xhtml files</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
Como referencia, estou usando o livro do Edson Gonçalves (Dominando JavaServer Faces e Facelets utilizando Spring 2.5, Hibernate e JPA)
Aguardo aos amigos e colegas da área pra me ajudar, desde já obrigado!