Here's an issue I'm stuck with for multiple hours already, and by now I feel quite desperate. I migrated our application from Spring 2.5/Hiberante 3.3 to Spring 3.0.5/Hibernate 3.6. The following was done:
The error I still have when launching from Eclipse IDE after different minor fixes and tunes, is as following:
Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/tx]
I looked through the other threads, and realized that such a problem arises when the specific lib (in this case spring-tx) not found in classpath, but I clearly see it in my Maven dependencies.
The next thing I did, I built the WAR as I did it for previous versions, deployed it on Tomcat, and the app worked fine!
By this I can make a conclusion that something is missing in Eclipse environment configuration. What's interesting that all complains are about spring-tx,- when I removed the single line utilizing tx namespace
<tx:annotation-driven transaction-manager="transactionManager" />
.. application started fine without complains about other namespaces (of course, it didn't work fine, but at least there were no complains during the init).
Some summary about my IDE/project setup:
The formal question would be: what are the possible reasons why the project launch from IDE results with such errors after migrating to Spring 3x (and works fine deployed as built WAR)?
I don't expect straight answers (unless someone had exactly the same environment & problem), but guidelines, advices would be of great help!
EDIT Forgot to mention that during app startup from IDE, I have bunch of warnings like these:
[WARN] Server class 'javax.persistence.EntityManagerFactory' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/D:/maven/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar' to the web app classpath for this session
[WARN] Server class 'org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/D:/maven/repository/org/springframework/spring-orm/3.0.5.RELEASE/spring-orm-3.0.5.RELEASE.jar' to the web app classpath for this session
.. so maybe spring-tx also is not found in web-app (and found on the system classpath), but it's not added like that happened with the others? What would be the reason of this behavior?
When developing with Maven, you should launch the DevMode from your target/${project.finalName}
folder, after a call to mvn package
or simply mvn war:exploded
(which will copy your dependencies to the WEB-INF/lib
there).
See http://code.google.com/eclipse/docs/faq.html#gwt_with_maven and http://code.google.com/p/google-web-toolkit/issues/detail?id=6619
If you have multiple spring dependencies on your classpath, then you may be running into this issue with maven:
When using mulitple Spring dependencies, the files from META-INF (from the Spring jars) overwrite each other in an executable jar-with-dependencies
To fix this, see the comment from Chris Wilkes. You need to copy the spring.handlers and spring.schemas into your META-INF directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With