Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8687

JPA2 persistence.xml in WEB-INF\classes\META-INF\ not allways deployed before Web context initialisation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • 6.0.0.CR1
    • EJB

      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

              rhn-engineering-cdewolf Carlo de Wolf
              dev.redhat@persgroep.be Geert Pante (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: