Reputation: 7257
I am using Hibernate 3.6.8.Final as part of a project deployed in JBoss 4.3 and found the following stack trace issued during startup:
Caused by: org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
at org.hibernate.cfg.Configuration.applyHibernateValidatorLegacyConstraintsOnDDL(Configuration.java:1681) ~[hibernate-core-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.cfg.Configuration.applyConstraintsToDDL(Configuration.java:1653) ~[hibernate-core-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1445) ~[hibernate-core-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1375) ~[hibernate-core-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1519) ~[hibernate-entitymanager-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:193) ~[hibernate-entitymanager-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1100) ~[hibernate-entitymanager-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:689) ~[hibernate-entitymanager-3.6.8.Final.jar:3.6.8.Final]
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) ~[hibernate-entitymanager-3.6.8.Final.jar:3.6.8.Final]
My project is a self-contained WAR that does not rely on JBoss for persistence.
What can I do to fix it?
Upvotes: 0
Views: 483
Reputation: 7257
Turns out that all it needed was a bit of Hibernate magic dust. The persistence.xml needs to have the following Hibernate properties in place:
<property name="hibernate.validator.autoregister_listeners" value="false" />
<property name="hibernate.validator.apply_to_ddl" value="false" />
Hope this helps someone.
If anyone can explain why I'd appreciate it.
Upvotes: 1