Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-2184

persistence.xml java:comp/env lookup fails during deployment because ContextInitialized is not complete

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • 7.1.0.Beta1
    • 7.0.2.Final
    • Naming
    • None
    • Hide

      Deploy attached JavaCompEnvContextBug.war file in http://community.jboss.org/message/632844#632844 zip attachment. Error is immediate during deployment. Change persistence.xml to point to global datasource, redeploy, run jndiBeans.jsp to verify that the java:comp/env datasource is configured correctly in web.xml and the java:comp/env lookup works OK after app initialization.

      Show
      Deploy attached JavaCompEnvContextBug.war file in http://community.jboss.org/message/632844#632844 zip attachment. Error is immediate during deployment. Change persistence.xml to point to global datasource, redeploy, run jndiBeans.jsp to verify that the java:comp/env datasource is configured correctly in web.xml and the java:comp/env lookup works OK after app initialization.
    • Compatibility/Configuration
    • Workaround Exists
    • Hide

      Use the global JNDI context instead of the application JNDI context in persistence.xml. This means the artifact will not be compatible with other app servers (such as Tomcat) which rely on the java:comp/env context being available to the application during deployment.

      Show
      Use the global JNDI context instead of the application JNDI context in persistence.xml. This means the artifact will not be compatible with other app servers (such as Tomcat) which rely on the java:comp/env context being available to the application during deployment.

      Works in AS5.1 and earlier, fails in AS6.1 and AS 7.0.2. Standard web.xml configuration, no additional listeners.
      Deployment using <jta-data-source>java:comp/env/jdbc/timetracker</jta-data-source> fails because ENC is not initialized when contextInitialized event occurs. Succeeds if lookup is changed to java:jboss/datasources/ExampleDS which is defined in global JNDI.

              smarlow1@redhat.com Scott Marlow
              bobfields Bob Fields (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: