Bug 801406 - Invalid persistent.xml descriptor in the Petclinic example
Invalid persistent.xml descriptor in the Petclinic example
Status: CLOSED INSUFFICIENT_DATA
Product: JBoss Enterprise WFK Platform 2
Classification: JBoss
Component: Spring (Show other bugs)
2.0.0.ER2
Unspecified Unspecified
medium Severity low
: ---
: 2.4.0
Assigned To: Tejas Mehta
Tomas Repel
jbds petclinic
:
: 824380 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-08 08:17 EST by Karel Piwko
Modified: 2013-08-11 21:31 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Known Issue
Doc Text:
When importing the Petclinic example application into JBoss Developer Studio 6, a persistence.xml file with invalid contents is created in the src/main/resources/META-INF/ directory. During deployment , this file has higher priority than the correct src/main/environments/eap-jpa/resources/META-INF/persistence.xml file, and the deployment fails. To work around this issue, remove the invalid src/main/resources/META-INF/persistence.xml file before deploying the application.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-22 15:31:48 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Petclinic war file, WFK2 ER5, build with eap-jpa profile (6.00 MB, application/octet-stream)
2012-05-15 11:25 EDT, Tomas Repel
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFK2-82 Minor Closed Invalid persistent.xml descriptor in the Petclinic example 2014-06-29 18:46:59 EDT

  None (edit)
Description Karel Piwko 2012-03-08 08:17:47 EST
Description of problem:

When Petclinic example is deployed on EAP6, following error is show in console log: 

14:14:22,897 ERROR [org.hibernate.internal.util.xml.ErrorLogger] (MSC service thread 1-1) HHH000196: Error parsing XML (5) : cvc-complex-type.3.1: Value '1.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '2.0'.


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

Distributed petclinic example.

How reproducible:

Always.

Steps to Reproduce:
1. Deploy petclinic
  
Actual results:

Error message.

Expected results:

Parser recovers from the issue, it has no effect on application.

No error message.
Additional info:
Comment 1 Marius Bogoevici 2012-03-08 11:18:37 EST
This is extremely odd. Is that to say that EAP6 is not backwards compatible with JPA 1.0?
Comment 2 Marius Bogoevici 2012-03-08 22:56:56 EST
Trying to reproduce it myself, I don't get the same error against ER3. Rather, there's a NPE when the PU is bound in JNDI from web.xml (the cause of which I cannot really understand).
Comment 3 Marius Bogoevici 2012-03-09 00:22:37 EST
Found https://issues.jboss.org/browse/JBPAPP-8397 which affects the deployment of Petclinic.
Comment 4 Marius Bogoevici 2012-03-09 00:31:49 EST
Reproduced error reported in this ticket.

a) this does not cause the deployment to fail
b) the error message is coming from Hibernate and it's spurious - JPA 1.0 deployment should be allowed 

(tracked by https://issues.jboss.org/browse/JBPAPP-8398)
Comment 5 Karel Piwko 2012-03-12 13:43:54 EDT
Still it causes deployment exception for me:

18:36:43,234 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.persistenceunit."petclinic.war#petclinic": org.jboss.msc.service.StartException in service jboss.persistenceunit."petclinic.war#petclinic": Failed to start service
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_27]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_27]
	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_27]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: petclinic] Unable to build EntityManagerFactory
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
	at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
	at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA-redhat-1.jar:1.0.2.GA-redhat-1]
	... 3 more
Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set
	at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:97)
	at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:67)
	at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:174)
	at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159)
	at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131)
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71)
	at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2273)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2269)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1738)
	at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
	... 9 more

18:36:43,452 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "petclinic.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"petclinic.war#petclinic\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"petclinic.war#petclinic\": Failed to start service"}}
18:36:43,487 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment petclinic.war in 35ms
18:36:43,488 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.persistenceunit."petclinic.war#petclinic": org.jboss.msc.service.StartException in service jboss.persistenceunit."petclinic.war#petclinic": Failed to start service

18:36:43,489 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"petclinic.war#petclinic\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"petclinic.war#petclinic\": Failed to start service"}}}}
Comment 6 Marius Bogoevici 2012-03-12 16:14:53 EDT
Added technical note, assigning to Rebecca
Comment 7 Marius Bogoevici 2012-03-12 16:14:53 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
During the import of the Petclinic project in JBDS, a default persistence.xml file with invalid contents is created under src/main/resources/META-INF. During deployment, this will supersede the correct one, to be found in src/main/environments/eap/resources/META-INF and will cause the deployment to fail. The solution in this case is to remove the src/main/resources/META-INF/persistence.xml file created during import.
Comment 8 Rebecca Newton 2012-03-12 22:31:53 EDT
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-During the import of the Petclinic project in JBDS, a default persistence.xml file with invalid contents is created under src/main/resources/META-INF. During deployment, this will supersede the correct one, to be found in src/main/environments/eap/resources/META-INF and will cause the deployment to fail. The solution in this case is to remove the src/main/resources/META-INF/persistence.xml file created during import.+During the import of the Petclinic project in JBDS, a default persistence.xml file with invalid contents is created under src/main/resources/META-INF. During deployment, this will supersede the correct one, to be found in src/main/environments/eap/resources/META-INF and will cause the deployment to fail. The workaround for this issue is to remove the src/main/resources/META-INF/persistence.xml file created during import.
Comment 9 JBoss JIRA Server 2012-03-13 00:26:11 EDT
Strong Liu <stliu@hibernate.org> made a comment on jira JBPAPP-8398

https://hibernate.onjira.com/browse/HHH-6271
Comment 10 JBoss JIRA Server 2012-03-19 11:40:33 EDT
Strong Liu <stliu@hibernate.org> updated the status of jira JBPAPP-8398 to Resolved
Comment 11 JBoss JIRA Server 2012-04-12 17:59:07 EDT
Scott Marlow <scott.marlow@redhat.com> made a comment on jira JBPAPP-8397

Probably easiest if I recreate locally.
Comment 12 JBoss JIRA Server 2012-04-12 18:27:35 EDT
Scott Marlow <scott.marlow@redhat.com> made a comment on jira JBPAPP-8397

I'm not sure what is causing the race yet.  From the [console output|https://gist.github.com/2002699] I can see the "Read persistence.xml" occurs first as expected (which comes from PersistenceUnitParseProcessor that runs during the PARSE deployment phase).

The NPE comes from the PersistenceRefProcessor which runs during the POST_MODULE phase.

We have our deployment phases providing the expected separation, deployment will complete the parsing of persistence.xml files, before any deployment threads try to read the result of parsing the persistence.xml.

I think its a thread safety bug in PersistenceUnitMetadataHolder.  Not sure why I didn't hit that before.

Can someone attach the petclinic.war to this jira, so I can recreate and then verify the fix.
Comment 13 JBoss JIRA Server 2012-04-12 19:14:28 EDT
Scott Marlow <scott.marlow@redhat.com> made a comment on jira JBPAPP-8397

Created a (AS7-4493) pull request to address the thread safety issue in PersistenceUnitMetadataHolder.
Comment 14 JBoss JIRA Server 2012-04-17 10:52:04 EDT
Scott Marlow <scott.marlow@redhat.com> made a comment on jira JBPAPP-8397

The thread safety fix for AS7-4493 has been merged to AS7 master.
Comment 15 JBoss JIRA Server 2012-05-03 12:21:21 EDT
Shelly McGowan <smcgowan@redhat.com> updated the status of jira JBPAPP-8397 to Resolved
Comment 16 JBoss JIRA Server 2012-05-15 10:58:14 EDT
Zbyněk Roubalík <zroubali@redhat.com> updated the status of jira JBPAPP-8398 to Closed
Comment 17 JBoss JIRA Server 2012-05-15 10:58:14 EDT
Zbyněk Roubalík <zroubali@redhat.com> made a comment on jira JBPAPP-8398

Verified on EAP 6.0.0.ER7
Comment 18 Tomas Repel 2012-05-15 11:25:43 EDT
Created attachment 584693 [details]
Petclinic war file, WFK2 ER5, build with eap-jpa profile
Comment 19 JBoss JIRA Server 2012-05-16 04:24:46 EDT
Zbyněk Roubalík <zroubali@redhat.com> updated the status of jira JBPAPP-8397 to Closed
Comment 20 JBoss JIRA Server 2012-05-16 04:24:46 EDT
Zbyněk Roubalík <zroubali@redhat.com> made a comment on jira JBPAPP-8397

Verified on EAP 6.0.0.ER7
Comment 21 JBoss JIRA Server 2012-06-01 02:29:18 EDT
Misty Stanley-Jones <misty@redhat.com> updated the status of jira JBPAPP-8398 to Reopened
Comment 22 JBoss JIRA Server 2012-06-01 02:29:18 EDT
Misty Stanley-Jones <misty@redhat.com> made a comment on jira JBPAPP-8398

Reopening for release note.
Comment 23 JBoss JIRA Server 2012-06-01 02:29:56 EDT
Misty Stanley-Jones <misty@redhat.com> updated the status of jira JBPAPP-8398 to Resolved
Comment 25 Tomas Repel 2012-06-01 07:49:41 EDT
Verified in WFK2 ER6 using JBDS 5.0.0.Beta3. The workaround described in Technical Notes still has to be used.
Comment 27 Isaac Rooskov 2012-08-12 23:52:04 EDT
Who handles the code examples for WFK? I'd like to get this issue assigned to the correct person so it doesn't get missed for WFK 2.1.

Thanks, 

Isaac
Comment 30 Marek Novotny 2012-10-11 04:42:15 EDT
*** Bug 824380 has been marked as a duplicate of this bug. ***
Comment 32 Tejas Mehta 2013-02-28 14:48:51 EST
Tested with jbdevstudio-product-eap-universal-6.0.0.GA:

JBDS still adds a persistence.xml to src/main/resources/META-INF/ when importing, which continues to prevent pet-clinic from deploying. Workaround to delete the generated file (src/main/resources/META-INF/persistence.xml) works.
Comment 34 Petr Penicka 2013-04-08 11:08:19 EDT
Release note added to WFK 2.2 RN book.

Docs stage URL: https://documentation-devel.engineering.redhat.com/docs/en-US/JBoss_Web_Framework_Kit/2.2/html-single/2.2.0_Release_Notes/index.html

Build: JBoss_Web_Framework_Kit-2.2.0_Release_Notes-2.2-en-US-0-18
Comment 35 Tomas Repel 2013-04-17 07:57:48 EDT
Verified, release note added properly.
Comment 41 Sneha 2013-07-04 08:06:06 EDT
Updated doc text.
Comment 42 Joshua Wilson 2013-07-22 15:31:48 EDT
Migrated to JIRA.

Note You need to log in before you can comment on or make changes to this bug.