I am trying to configure JSF+Spring+hibernate and I\'m tying to run a test but when I use this \"tx:annotation-driven\" on my application-context.xml file, I get this error:
FWIW I had this same issue. Turned out my xsi:schemaLocation entries were incorrect, so I went to the official docs and pasted theirs into mine:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html section 16.5.6
I had to add a couple more but that was ok. Next up is to find out why this fixed the problem...
I'm learning from udemy. I followed every step that my instructor show me to do. In spring mvc crud section while setting up the devlopment environment i had the same error for:
<mvc:annotation-driven/> and <tx:annotation-driven transaction-manager="myTransactionManager" />
then i just replaced
http://www.springframework.org/schema/mvc/spring-mvc.xsd
with
http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
and
http://www.springframework.org/schema/tx/spring-tx.xsd
with
http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
actually i visited these two sites http://www.springframework.org/schema/mvc/ and http://www.springframework.org/schema/tx/ and just added the latest version of spring-mvc and spring-tx i.e, spring-mvc-4.2.xsd and spring-tx-4.2.xsd
So, i suggest to try this. Hope this helps. Thank you.
For me the thing that worked was the order in which the namespaces were defined in the xsi:schemaLocation tag : [ since the version was all good and also it was transaction-manager already ]
The error was with :
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
AND RESOLVED WITH :
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
One extra forward slash (/) in front of tx and the *.xml file troubled me for 8 hours!!
My mistake:
http://www.springframework.org/schema/tx/ http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
Correction:
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
Indeed one character less/more manages to keep programmers busy for hours!
You have some errors in your appcontext.xml:
Use *-2.5.xsd
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
Typos in tx:annotation-driven
and context:component-scan
(. instead of -)
<tx:annotation-driven transaction-manager="transactionManager" />
<context:component-scan base-package="com.mmycompany" />
Make sure that Spring version and xsd version both are same.In my case I am using Spring 4.1.1 so my all xsd should be version *-4.1.xsd