[hibernate-issues] [Hibernate-JIRA] Commented: (HV-374) NoSuchMethodError on Persistence.getPersistenceUtil() on WebLogic 10.3.3 (11g)
Vitaly Polonetsky (JIRA)
noreply at atlassian.com
Wed Nov 17 08:03:13 EST 2010
[ http://opensource.atlassian.com/projects/hibernate/browse/HV-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39133#action_39133 ]
Vitaly Polonetsky commented on HV-374:
--------------------------------------
When I think about it again,
what is someone has the API for JPA2, but no implementation for it in the classpath ?
Wouldn't it be better to check for successful invocation of Persistence.getPersistenceUtil() ?
> NoSuchMethodError on Persistence.getPersistenceUtil() on WebLogic 10.3.3 (11g)
> ------------------------------------------------------------------------------
>
> Key: HV-374
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HV-374
> Project: Hibernate Validator
> Issue Type: Bug
> Components: engine
> Affects Versions: 4.1.0.Final
> Environment: WebLogic 10.3.3 (11g)
> Reporter: Vitaly Polonetsky
> Assignee: Hardy Ferentschik
> Fix For: 4.2.0.Beta1
>
> Attachments: HV-374.patch
>
> Original Estimate: 8h
> Remaining Estimate: 8h
>
> The latest WebLogic comes with hybrid configuration of JPA 1.0 with some features of JPA 2.0:
> https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&doctype=FAQ&id=1091853.1
> This causes a problem with the way Hibernate Validator checks for existence of JPA 2.0:
> org.hibernate.validator.engine.resolver.DefaultTraversableResolver.detectJPA() checks for existance of javax.persistence.PersistenceUtil class (which exists only in JPA 2.0), but org.hibernate.validator.engine.resolver.JPATraversableResolver will not use it directly, instead it will use javax.persistence.Persistence.getPersistenceUtil() (the class exists for JPA 1.0, but the method is available only at JPA 2.0).
> This check is good for situations where either full JPA 1.0 or full 2.0 implementation is available, but is cases like we have in WebLogic it leads to an Error:
> {code}
> 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)
> ...
> {code}
> I would suggest a possible way to overcome this situation in Hibernate Validator:
> To check for existence of JPA 2.0, check the existence of Persistence.getPersistenceUtil() method, instead of checking for the existence of PersistenceUtil class. This will disable the use of JPA 2.0 features inside HV when the method is not available.
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list