Bug 804143

Summary: Hibernate 2nd level cache is not configured properly in Petclinic example
Product: [Retired] JBoss Enterprise WFK Platform 2 Reporter: Tomas Repel <trepel>
Component: Spring, ExamplesAssignee: Marius Bogoevici <mariusb>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0.0.ER3CC: kpiwko, mnovotny, rruss
Target Milestone: ---   
Target Release: 2.0.0.ER5   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: petclinic
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-22 11:10:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Tomas Repel 2012-03-16 16:00:04 UTC
Description of problem:

Deployment of Petclinic example using applicationContextHibernate.xml with modification of path to jdbc.properties due to https://bugzilla.redhat.com/show_bug.cgi?id=804140 fails due to some hibernate 2nd level cache problem.

Version-Release number of selected component (if applicable):

WFK2 Beta1
EAP6 Beta

How reproducible:

Always.

Steps to Reproduce:
1. modify src/main/environments/eap/webapp/WEB-INF/web.xml to use applicationContextHibernate.xml
2. change location of jdbc.properties (replace '/' by ':') in applicationContextHibernate.xml
3. deploy on EAP6
  
Actual results:

5:59:37,579 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-5) Context initialization failed: java.lang.NoClassDefFoundError: Lorg/hibernate/cache/CacheProvider;
	at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_22]
	at java.lang.Class.privateGetDeclaredFields(Class.java:2308) [rt.jar:1.6.0_22]
	at java.lang.Class.getDeclaredFields(Class.java:1760) [rt.jar:1.6.0_22]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:372) [spring-orm-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:320) [spring-orm-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:797) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:492) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567) [spring-beans-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895) [spring-context-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425) [spring-context-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47) [spring-web-3.0.7.RELEASE.jar:3.0.7.RELEASE]
	at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.10.Final-redhat-1.jar:]
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.10.Final-redhat-1.jar:]
	at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.0.Final-redhat-1.jar:7.1.0.Final-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_22]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_22]
	at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_22]
Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.CacheProvider from [Module "deployment.petclinic.war:main" from Service Module Loader]
	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
	... 26 more

Expected results:

It deploys.

Comment 5 Marius Bogoevici 2012-04-13 03:58:52 UTC
To be fixed post ER4.

This seems to requires introducing distinct profiles for Hibernate and JPA in this example.

Comment 6 Marius Bogoevici 2012-04-24 21:18:44 UTC
Note to QA:

Replaced 'eap' profile with 3 distinct profiles per variant:

- eap-jpa
- eap-hibernate
- eap-jdbc

This accounts for configuration and dependency differences.

Comment 7 Tomas Repel 2012-05-14 11:46:45 UTC
Verified in WFK2 ER5.

Comment 8 Karel Piwko 2012-06-22 11:10:49 UTC
These example related issues are fixed in WFK 2.0.0. Documenting them as fixed issues is not required.