glassfish
  1. glassfish
  2. GLASSFISH-20944

@DataSourceDefinition defined data source can't be used in persistence.xml

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: entity-persistence
    • Labels:
      None

      Description

      Defining a data source from within the application using either @DataSourceDefinition on a class or the data-source element in web.xml, and then using this in persistence.xml will cause a deployment failure.

      E.g.

      web.xml
      <data-source>
          <name>java:app/MyApp/MyDS</name>
          <class-name>org.h2.jdbcx.JdbcDataSource</class-name>
          <url>jdbc:h2:mem:test</url>
      </data-source>
      

      and

      persistence.xml
      <persistence-unit name="testPU">
          <jta-data-source>java:app/MyApp/MyDS</jta-data-source>
      </persistence-unit>
      

      will result in:

      org.omg.CORBA.INTERNAL: JTS5031: Exception [org.omg.CORBA.INTERNAL:   vmcid: 0x0  minor code: 0 completed: Maybe] on Resource [rollback] operation.  vmcid: 0x0  minor code: 0  completed: No
      	at com.sun.jts.CosTransactions.RegisteredResources.distributeRollback(RegisteredResources.java:1187)
      	at com.sun.jts.CosTransactions.TopCoordinator.rollback(TopCoordinator.java:2291)
      	at com.sun.jts.CosTransactions.CoordinatorTerm.rollback(CoordinatorTerm.java:530)
      	at com.sun.jts.CosTransactions.TerminatorImpl.rollback(TerminatorImpl.java:286)
      	at com.sun.jts.jta.TransactionImpl.rollback(TransactionImpl.java:162)
      	... 126 more
      
      WARNING: RAR5035:Unexpected exception while destroying resource from pool __SYSTEM/pools/__datasource_definition/5f110772-6547-4c6e-9d56-1a437f052bd8/java:app/MyApp/MyDS. Exception message: This web container has not yet been started
      

      I provided two test cases that demonstrate the issue for the Java EE samples project: https://github.com/javaee-samples/javaee7-samples/pull/188

      Running these will immediately reproduce the issue.

        Activity

        Hide
        Ed Bratt added a comment -

        Assigned FYI.

        Show
        Ed Bratt added a comment - Assigned FYI.

          People

          • Assignee:
            Srini
            Reporter:
            arjan tijms
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: