[
http://opensource.atlassian.com/projects/hibernate/browse/HV-380?page=com...
]
Hardy Ferentschik commented on HV-380:
--------------------------------------
Seems that you are now hitting HV-374.
Strictly speaking this is not a bug, but a hybrid JPA 1 and 2 specification jar. In my
view such a jar should not have been released.
To dynamically enable the {{JPATraversableResolver}} Hibernate Validator checks whether
the {{PersistenceUtil}} class is on the classpath. This should be an indication of whether
there is a JPA 2 compliant implementation available. Due to this hybrid jar file this test
fails. I will try to improve the test for JPA 2 mentioned in HV-374.
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