Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JPA2 / Hibernate on WL 10.3.5: exception in Bean Validation

deadlock_grDec 13 2012
Hi all,

I am deploying on Weblogic 10.3.5. Our application uses JPA 2.0 and our provider is Hibernate 4.1.7. So far this has been working for us without a problem.

My problems started when I tried to add Bean Validation (JSR-303) implemented by the Hibernate Validation, as I get a strange stacktrace where Hibernate Validator looks up the classpach for loaded JPA providers, and instead of Hibernate, OpenJPA comes up, a version that is incompatible with JPA 2.

JPA 2 + Hibernate work properly for months now, so there is no doubt as to whether JPA 2 has been enabled properly.

Apparently, this has been recorded as an issue on Hibernate Jira ( [HV-425|https://hibernate.onjira.com/browse/HV-425] ), but with a different persistence provider and an earlier Weblogic version (10.3.3 and 10.3.4).

Is there something I have mis-configured that is preventing Hibernate to be picked up as my persistence provider?

This is my EJB code where I try to validate my top-level entity:
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public void saveResult() throws ResultInvalidException{
	
	ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
	Validator validator = factory.getValidator();
	Set<ConstraintViolation<FullResultsSet>> violations = validator.validate(result);
	if(!violations.isEmpty()) {
		throw new ResultInvalidException(violations);
	}
	
	result.setCreatedDate(new Date());
	if(result.getRevisionNumber() != null) {
		result.setRevisionNumber(result.getRevisionNumber() + 1);
	} else{
		result.setRevisionNumber(1L);
	}
	if (result.getFullResultsSetId() == null) {
		getEm().persist(result);
	}
	getEm().flush();
}
This is my startWeblogic.cmd (I have added the JSF 2 libraries):
@ECHO OFF

@REM WARNING: This file is created by the Configuration Wizard.
@REM Any changes to this script may be lost when adding extensions to this configuration.

SETLOCAL

set USER_MEM_ARGS=-Xms512m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:ParallelGCThreads=14 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -XX:MaxTenuringThreshold=31 -XX:CMSInitiatingOccupancyFraction=75
set PRODUCTION_MODE=false
set debugFlag=true
set DEBUG_PORT=8453
set JAVA_OPTIONS=%JAVA_OPTIONS% -Djava.compiler=NONE -Djava.awt.headless=true

set DOMAIN_HOME=C:\dbin\WLS103~1\user_projects\domains\eudract_domain

set PRE_CLASSPATH=%MW_HOME%\modules\javax.persistence_1.0.0.0_2-0-0.jar;%MW_HOME%\modules\com.oracle.jpa2support_1.0.0.0_2-0.jar;

call "%DOMAIN_HOME%\bin\startWebLogic.cmd" %*

ENDLOCAL
These are the contents of my .ear/WEB-INF/lib file:
commons-beanutils-1.7.0.jar
commons-collections-3.2.jar
commons-digester-1.8.1.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commons-lang3-3.0.1.jar
commons-logging-1.1.1.jar
commons-validator-1.2.0.jar
YYYYYY-public-domain-1.2.1-SNAPSHOT.jar
YYYYYY-secure2public-1.2.1-SNAPSHOT.jar
dom4j-1.6.1.jar
dozer-5.3.0.jar
ehcache-core-2.3.1.jar
el-api-1.0.jar
el-impl-1.0.jar
el-messages-1.0.jar
XXXXXXX-cache-1.0.0.jar
XXXXXXX-configuration2-1.0.0.jar
XXXXXXX-domain-8.5.0-SNAPSHOT.jar
XXXXXXX-enumerations-8.5.0-SNAPSHOT.jar
XXXXXXX-jsf-tools-8.5.0-SNAPSHOT.jar
XXXXXXX-main-configuration-8.5.0-SNAPSHOT.jar
XXXXXXX-utils-1.0.0.jar
XXXXXXX-xml-model-8.5.0-SNAPSHOT.jar
hibernate-commons-annotations-4.0.1.Final.jar
hibernate-core-4.1.7.Final.jar
hibernate-entitymanager-4.1.7.Final.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate-validator-4.3.1.Final.jar
imaging-01012005.jar
javassist-3.15.0-GA.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final.jar
jcaptcha-1.0.jar
jcaptcha-api-1.0.jar
jsf-api-2.0.jar
jsf-facelets-1.1.15.jar
jsf-impl-2.0.1-FCS.jar
jstl-1.1.2.jar
log4j-1.2.13.jar
oro-2.0.8.jar
quartz-1.5.2.jar
ZZZZZZZ-configuration-0.6-SNAPSHOT.jar
ZZZZZZZ-domain-0.6-SNAPSHOT.jar
ZZZZZZZ-logic-api-0.6-SNAPSHOT.jar
ZZZZZZZ-persistence-0.6-SNAPSHOT.jar
richfaces-api-3.3.3.Final.jar
richfaces-impl-jsf2-3.3.3.Final.jar
richfaces-ui-3.3.3.Final.jar
slf4j-api-1.4.2.jar
slf4j-log4j12-1.4.2.jar
validation-api-1.0.0.GA.jar
velocity-1.7.jar
weblogic-di-10.3.5.jar
xml-apis-1.0.b2.jar
This is the stacktrace:
javax.faces.FacesException: #{ResultBean.saveResult}: javax.ejb.EJBException: EJB Exception: : java.lang.AbstractMethodError: org.apache.openjpa.persistence.PersistenceProviderImpl.getProviderUtil()Ljavax/persistence/spi/ProviderUtil;
	at javax.persistence.Persistence$PersistenceUtilImpl.isLoaded(Unknown Source)
	at org.hibernate.validator.internal.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:57)
	at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:130)
	at org.hibernate.validator.internal.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:46)
	at org.hibernate.validator.internal.engine.ValidatorImpl.isCascadeRequired(ValidatorImpl.java:1250)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateCascadedConstraints(ValidatorImpl.java:463)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:312)
	at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:133)
	at eu.ema.eudract.results.result.ResultStatefulServiceBean.saveResult(ResultStatefulServiceBean.java:79)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
	at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
	at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:54)
	at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
	at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
	at $Proxy252.saveResult(Unknown Source)
	at eu.ema.eudract.results.result.ResultStatefulServiceBean_6puf0g_ResultStatefulServiceImpl.__WL_invoke(Unknown Source)
	at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:39)
	at eu.ema.eudract.results.result.ResultStatefulServiceBean_6puf0g_ResultStatefulServiceImpl.saveResult(Unknown Source)
	at eu.ema.eudract.results.presentation.result.ResultBean.saveResult(ResultBean.java:29)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.sun.el.parser.AstValue.invoke(Unknown Source)
	at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
	at javax.faces.component.UICommand.broadcast(UICommand.java:315)
	at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:329)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
	at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
	at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:90)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312)
	at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
	at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
	at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
	at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
	at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
	at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 10 2013
Added on Dec 13 2012
0 comments
1,645 views