Boa tarde.
Desde já agradeço aos que estão lendo para ajudar e espero que ajude os que estão procurando ajuda.
Estou fazendo a apostila da caelum fj-21 java web e na parte da integração do hibernate com jpa e spring mvc ele pede para declarar tx:annotation-driven/ no arquivo xml de configuração do spring.
Quando eu declaro dá o seguinte erro:
“The prefix “tx” for element “tx:annotation-driven” is not bound.”
Pesquisando achei a seguinte solução:
colocar dentro da declaração do persistence o seguinte:
xmlns:tx=“http://www.springframework.org/schema/tx”
aí o erro muda para:
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ‘tx:annotation-driven’.
Tentei mudar as bibliotecas que importei de spring-orm-4.0.0.RELEASE.jar e spring-tx-4.0.).RELEASE.jar para spring-orm-4.2.5.RELEASE.jar e spring-tx-4.2.5.RELEASE.jar
mas não adiantou, o erro nem modificou
segue meu arquivo de configuração
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="br.com.caelum.tarefas" />
<mvc:annotation-driven />
<mvc:default-servlet-handler/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<mvc:interceptors>
<bean class=
"br.com.caelum.tarefas.interceptor.AutorizadorInterceptor" />
</mvc:interceptors>
<bean id="mysqlDataSource" class="org.apache.commons.dbcp.BasicDataSource" >
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/fj21" />
<property name="username" value="root" />
<property name="password" value="123" />
</bean>
<!-- gerenciamento de jpa pelo spring -->
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="mysqlDataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
</bean>
<!-- gerenciamento da transação pelo spring -->
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven/>
</beans>
Alguma idéia?