[jboss-jira] [JBoss JIRA] Commented: (JBAS-8687) JPA2 persistence.xml in WEB-INF\classes\META-INF\ not allways deployed before Web context initialisation
Gregoire Botquin (JIRA)
jira-events at lists.jboss.org
Thu Dec 2 08:45:06 EST 2010
[ https://jira.jboss.org/browse/JBAS-8687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567066#comment-12567066 ]
Gregoire Botquin commented on JBAS-8687:
----------------------------------------
I got same kind of problems with ear files.
I'm deploying 2 ear files, the first one seems to deploy correctly and persistence context is created with no problem.
But when deploying second ear file it seems that the jar/war files it contains are deployed before the persistence context has been created.
I tried several things : put the persistence.xml in the META-INF of the ear file, place the persistence.xml in META-INF of the 'first' ejb-module's jar file...
but nothing to do, the persistence context is not deployed correctly en causes the fail of the ear deployment.
Ohter thing, in order to check that the persistence.xml is correct and should be deployed, I replaced the jar/war files by a dummy ejb-module jar
(which don't use the persistence context deployed in second ear).In this case the persistence context is deployed correctly.
> JPA2 persistence.xml in WEB-INF\classes\META-INF\ not allways deployed before Web context initialisation
> --------------------------------------------------------------------------------------------------------
>
> Key: JBAS-8687
> URL: https://jira.jboss.org/browse/JBAS-8687
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: EJB3
> Affects Versions: 6.0.0.CR1
> Environment: JBossAS [6.0.0.20101110-CR1 "Neo"]
> Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
> Java VM: Java HotSpot(TM) 64-Bit Server VM 17.1-b03,Sun Microsystems Inc.
> OS-System: Windows 7 6.1,amd64
> Unchanged default profile, with Oracle DataSource.
> Reporter: Geert Pante
> Assignee: Carlo de Wolf
> Labels: deployer, jpa
> Attachments: persistence.xml
>
>
> I'm trying to run JASig CAS (http://www.jasig.org/cas) using the JpaTicketRegistry. This is done by putting a persistence.xml in WEB-INF\classes\META-INF with:
> <property name="jboss.entity.manager.factory.jndi.name" value="java:jpa/CasEntityManagerFactory"/>
> I refer to it from my Spring applicationContext
> <jee:jndi-lookup id="entityManagerFactory" jndi-name="java:jpa/CasEntityManagerFactory"/>.
> Most of the times this starts up correctly: first deploying and binding the Persistence Unit, and then starting the WebApplicationContext.
> But once every 5 times, it starts in the wrong order: we first get
> 13:13:55,150 INFO [TomcatDeployment] deploy, ctxPath=/cas
> 13:13:55,204 INFO [[/cas]] Initializing Spring root WebApplicationContext
> 13:13:55,204 INFO [ContextLoader] Root WebApplicationContext: initialization started
> 13:13:55,208 INFO [XmlWebApplicationContext] Refreshing Root WebApplicationContext: startup date [Tue Nov 30 13:13:55 CET 2010]; root of context hierarchy
> 13:13:56,039 ERROR [ContextLoader] Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jpa not bound
> [...]
> 13:13:56,088 ERROR [StandardContext] Error filterStart
> 13:13:56,088 ERROR [StandardContext] Context [/cas] startup failed due to previous errors
> 13:13:56,089 INFO [[/cas]] Closing Spring root WebApplicationContext
> 13:13:56,095 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/cas state=Create mode=Manual requiredState=Installed: org.jboss.deployers.spi.DeploymentException: URL file:/D:/Applications/jboss-6.0.0.CR1/server/mbip/deploy/cas-server-webapp-3.4.2.BAYER_7-SNAPSHOT.war/ deployment failed
> And only after this we get:
> 13:13:56,113 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=cas-server-webapp-3.4.2.EBIT_7-SNAPSHOT.war#CasPersistence
> 13:13:56,287 INFO [Version] Hibernate Commons Annotations 3.2.0.Final
> 13:13:56,294 INFO [Environment] Hibernate 3.6.0.Final
> 13:13:56,296 INFO [Environment] hibernate.properties not found
> 13:13:56,300 INFO [Environment] Bytecode provider name : javassist
> 13:13:56,304 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
> 13:13:56,393 INFO [Version] Hibernate EntityManager 3.6.0.Final
> 13:13:56,421 INFO [Ejb3Configuration] Processing PersistenceUnitInfo [
> name: CasPersistence
> ...]
> 13:13:56,928 INFO [SessionFactoryImpl] building session factory
> 13:13:57,137 INFO [SessionFactoryObjectFactory] Factory name: persistence.unit:unitName=cas-server-webapp-3.4.2.EBIT_7-SNAPSHOT.war#CasPersistence
> 13:13:57,139 INFO [NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
> 13:13:57,141 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.unit:unitName=cas-server-webapp-3.4.2.EBIT_7-SNAPSHOT.war#CasPersistence
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list