[
http://opensource.atlassian.com/projects/hibernate/browse/HV-380?page=com...
]
Archie Cobbs commented on HV-380:
---------------------------------
Thanks for the clarification. One remaining question though.
If I change the test case as follows:
{noformat}
--- build.xml.orig 2010-10-01 08:50:37.000000000 -0500
+++ build.xml 2010-10-01 08:50:39.000000000 -0500
@@ -33,7 +33,7 @@
<pathelement location="slf4j-log4j12-1.6.1.jar"/>
<pathelement location="log4j-1.2.16.jar"/>
<pathelement location="eclipselink-1.2.0.jar"/>
<!-- remove this and it starts working -->
- <pathelement location="persistence-api-2.0.jar"/>
<!-- required by eclipselink -->
+ <pathelement location="persistence-api-1.0.jar"/>
<!-- required by eclipselink -->
</classpath>
</java>
</target>
{noformat}
then this happens:
{noformat}
java.lang.NoSuchMethodError:
javax.persistence.Persistence.getPersistenceUtil()Ljavax/persistence/PersistenceUtil;
at
org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:62)
at
org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:94)
at
org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
at
org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:757)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:324)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:273)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:256)
at
org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:210)
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
at Foo.main(Foo.java:23)
{noformat}
Is the Hibernate Validator supposed to work in the presence of a non-Hibernate JPA 1.0
implementation? If not, then this would be expected. If so, then there is still an issue.
Thanks.
Validator fails when a non-Hibernate persistence layer is in the
classpath
--------------------------------------------------------------------------
Key: HV-380
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HV-380
Project: Hibernate Validator
Issue Type: Bug
Components: engine
Affects Versions: 4.1.0.Final
Reporter: Archie Cobbs
Assignee: Hardy Ferentschik
Attachments: HIBVALIDBUG.tar.bz2
The documentation for the Hibernate Validator states:
{quote}
The API is not tied to a specific application tier or programming model. It is
specifically not tied to either the web tier or the persistence tier, and is available for
both server-side application programming, as well as rich client Swing application
developer.
{quote}
However, this doesn't seem to be the case. It is true that validation can be
performed without any persistence layer being present. However, simply by having a
non-Hibernate persistence layer such as EclipseLink in the classpath, validation fails as
follows:
{noformat}
javax.validation.ValidationException: Call to TraversableResolver.isReachable() threw an
exception
at
org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:766)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:324)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForRedefinedDefaultGroup(ValidatorImpl.java:273)
at
org.hibernate.validator.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:256)
at
org.hibernate.validator.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:210)
at org.hibernate.validator.engine.ValidatorImpl.validate(ValidatorImpl.java:119)
at Foo.main(Foo.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Caused by: java.lang.NullPointerException
at javax.persistence.Persistence$1.isLoaded(Persistence.java:78)
at
org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:62)
at
org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:94)
at
org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
at
org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:757)
... 33 more
{noformat}
I've attached a test case. Run "ant" to see the problem. Edit {{build.xml}}
to remove {{eclipselink-1.2.0.jar}} from the runtime classpath, re-run "ant",
and the problem goes away.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira