Uploaded image for project: 'Arquillian'
  1. Arquillian
  2. ARQ-379

Arquillian does not allow any configuration of OpenEJB

    Details

      Description

      The OpenEJBContainer in Arquillian only starts a couple basic services with OpenEJB without any configuration or addition of other services and resource adapters. Without Arquillian, one would use a jndi.properties file, for instance, and then create the initial context which would start OpenEJB with all of its configuration options. Without configuration, Arquillian tests cannot be used in real environments.

      As an example, consider the arquillian-samples/jpalab. When Maven is run with the default profile for OpenEJB and OpenJPA, the following log output is produced (excerpt with only OpenEJB startup lines):

      INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
      INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
      INFO - Configuring enterprise application: /tmp/b99ee272-36b3-4d8c-a76a-379064eb1d62/81778d28-0e83-44b5-aecc-ced777c397a6.jar
      INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
      INFO - Auto-creating a container for bean JavaPersistenceHelperBean: Container(type=STATELESS, id=Default Stateless Container)
      INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
      INFO - Auto-creating a container for bean RepositoryBean: Container(type=STATEFUL, id=Default Stateful Container)
      INFO - Configuring PersistenceUnit(name=test)
      INFO - Configuring Service(id=Default JDBC Database, type=Resource, provider-id=Default JDBC Database)
      INFO - Auto-creating a Resource with id 'Default JDBC Database' of type 'DataSource for 'test'.
      INFO - Configuring Service(id=Default Unmanaged JDBC Database, type=Resource, provider-id=Default Unmanaged JDBC Database)
      INFO - Auto-creating a Resource with id 'Default Unmanaged JDBC Database' of type 'DataSource for 'test'.
      INFO - Adjusting PersistenceUnit test <jta-data-source> to Resource ID 'Default JDBC Database' from 'testDatabase'
      INFO - Adjusting PersistenceUnit test <non-jta-data-source> to Resource ID 'Default Unmanaged JDBC Database' from 'null'
      INFO - Enterprise application "/tmp/b99ee272-36b3-4d8c-a76a-379064eb1d62/81778d28-0e83-44b5-aecc-ced777c397a6.jar" loaded.
      INFO - Assembling app: /tmp/b99ee272-36b3-4d8c-a76a-379064eb1d62/81778d28-0e83-44b5-aecc-ced777c397a6.jar
      INFO - PersistenceUnit(name=test, provider=org.apache.openjpa.persistence.PersistenceProviderImpl)
      ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent. See http://openejb.apache.org/3.0/javaagent.html
      INFO - Jndi(name=JavaPersistenceHelperBeanLocal) --> Ejb(deployment-id=JavaPersistenceHelperBean)
      INFO - Jndi(name=RepositoryBeanLocal) --> Ejb(deployment-id=RepositoryBean)
      INFO - Created Ejb(deployment-id=JavaPersistenceHelperBean, ejb-name=JavaPersistenceHelperBean, container=Default Stateless Container)
      INFO - Created Ejb(deployment-id=RepositoryBean, ejb-name=RepositoryBean, container=Default Stateful Container)
      INFO - Deployed Application(path=/tmp/b99ee272-36b3-4d8c-a76a-379064eb1d62/81778d28-0e83-44b5-aecc-ced777c397a6.jar)

      The key items to look at is that only a "Default JDBC Database" data source and its unmanaged complement are created. There is no testDatabase data source being defined, as specified in the jndi.properties file. Also note that the persistence unit was automatically modified to point to the default data source since OpenEJB could not find any testDatabase source.

      I'll show what the log should look like shortly. I have this fixed already and in use on a project.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            dallen6 David Allen added a comment -

            Still need to add something to documentation, but the fix basically appears thus far as at git://github.com/drallen/arquillian.git.

            The log output for comparison should appear as:

            Apache OpenEJB 3.1.4 build: 20101112-03:32
            http://openejb.apache.org/
            INFO - openejb.home = /home/dallen/Source/arquillian-samples/jpalab
            INFO - openejb.base = /home/dallen/Source/arquillian-samples/jpalab
            INFO - Using 'openejb.assembler=org.jboss.arquillian.container.openejb.embedded_3_1.OpenEJBAssembler'
            INFO - Using 'openejb.configurator=org.jboss.shrinkwrap.openejb.config.ShrinkWrapConfigurationFactory'
            INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
            INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
            INFO - Configuring Service(id=testDatabase, type=Resource, provider-id=Default JDBC Database)
            INFO - Using 'openejb.deployments.classpath=false'
            INFO - Configuring enterprise application: /tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar
            FOO moduleName = /tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar
            INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container)
            INFO - Auto-creating a container for bean JavaPersistenceHelperBean: Container(type=STATELESS, id=Default Stateless Container)
            INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container)
            INFO - Auto-creating a container for bean RepositoryBean: Container(type=STATEFUL, id=Default Stateful Container)
            INFO - Configuring PersistenceUnit(name=test)
            INFO - Auto-creating a Resource with id 'testDatabaseNonJta' of type 'DataSource for 'test'.
            INFO - Configuring Service(id=testDatabaseNonJta, type=Resource, provider-id=testDatabase)
            INFO - Adjusting PersistenceUnit test <non-jta-data-source> to Resource ID 'testDatabaseNonJta' from 'null'
            INFO - Enterprise application "/tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar" loaded.
            INFO - Assembling app: /tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar
            ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent. See http://openejb.apache.org/3.0/javaagent.html
            INFO - PersistenceUnit(name=test, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 577ms
            INFO - Jndi(name=JavaPersistenceHelperBeanLocal) --> Ejb(deployment-id=JavaPersistenceHelperBean)
            INFO - Jndi(name=RepositoryBeanLocal) --> Ejb(deployment-id=RepositoryBean)
            INFO - Created Ejb(deployment-id=RepositoryBean, ejb-name=RepositoryBean, container=Default Stateful Container)
            INFO - Created Ejb(deployment-id=JavaPersistenceHelperBean, ejb-name=JavaPersistenceHelperBean, container=Default Stateless Container)

            This time, a third service is configured during startup for the testDatabase, the data source defined in the jndi.properties file. Also there is only one line regarding adjusting the persistence unit. This is for the unmanaged data source connection which was not specified in jndi.properties nor in the persistence.xml file, thus OpenEJB uses defaults. The important thing is that the JTA data source is now changed.

            One final note is that OpenEJB 3.1.4 needs to be used now. The class cast exception many have seen since October somehow now propagates through the Arquillian container and causes the tests to fail with the fix for this bug. The exception was fixed in 3.1.4, so it's no longer a problem.

            Show
            dallen6 David Allen added a comment - Still need to add something to documentation, but the fix basically appears thus far as at git://github.com/drallen/arquillian.git. The log output for comparison should appear as: Apache OpenEJB 3.1.4 build: 20101112-03:32 http://openejb.apache.org/ INFO - openejb.home = /home/dallen/Source/arquillian-samples/jpalab INFO - openejb.base = /home/dallen/Source/arquillian-samples/jpalab INFO - Using 'openejb.assembler=org.jboss.arquillian.container.openejb.embedded_3_1.OpenEJBAssembler' INFO - Using 'openejb.configurator=org.jboss.shrinkwrap.openejb.config.ShrinkWrapConfigurationFactory' INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) INFO - Configuring Service(id=testDatabase, type=Resource, provider-id=Default JDBC Database) INFO - Using 'openejb.deployments.classpath=false' INFO - Configuring enterprise application: /tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar FOO moduleName = /tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar INFO - Configuring Service(id=Default Stateless Container, type=Container, provider-id=Default Stateless Container) INFO - Auto-creating a container for bean JavaPersistenceHelperBean: Container(type=STATELESS, id=Default Stateless Container) INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container) INFO - Auto-creating a container for bean RepositoryBean: Container(type=STATEFUL, id=Default Stateful Container) INFO - Configuring PersistenceUnit(name=test) INFO - Auto-creating a Resource with id 'testDatabaseNonJta' of type 'DataSource for 'test'. INFO - Configuring Service(id=testDatabaseNonJta, type=Resource, provider-id=testDatabase) INFO - Adjusting PersistenceUnit test <non-jta-data-source> to Resource ID 'testDatabaseNonJta' from 'null' INFO - Enterprise application "/tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar" loaded. INFO - Assembling app: /tmp/802897ee-a34c-4552-b58e-869ed6b56299/e9158173-41a7-465b-b933-4d7ddebc6bb7.jar ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent. See http://openejb.apache.org/3.0/javaagent.html INFO - PersistenceUnit(name=test, provider=org.apache.openjpa.persistence.PersistenceProviderImpl) - provider time 577ms INFO - Jndi(name=JavaPersistenceHelperBeanLocal) --> Ejb(deployment-id=JavaPersistenceHelperBean) INFO - Jndi(name=RepositoryBeanLocal) --> Ejb(deployment-id=RepositoryBean) INFO - Created Ejb(deployment-id=RepositoryBean, ejb-name=RepositoryBean, container=Default Stateful Container) INFO - Created Ejb(deployment-id=JavaPersistenceHelperBean, ejb-name=JavaPersistenceHelperBean, container=Default Stateless Container) This time, a third service is configured during startup for the testDatabase, the data source defined in the jndi.properties file. Also there is only one line regarding adjusting the persistence unit. This is for the unmanaged data source connection which was not specified in jndi.properties nor in the persistence.xml file, thus OpenEJB uses defaults. The important thing is that the JTA data source is now changed. One final note is that OpenEJB 3.1.4 needs to be used now. The class cast exception many have seen since October somehow now propagates through the Arquillian container and causes the tests to fail with the fix for this bug. The exception was fixed in 3.1.4, so it's no longer a problem.
            Hide
            dallen6 David Allen added a comment -

            This related issue might be solved. It is now possible to have an XML configuration file for OpenEJB; however, the file must be specified by a property in jndi.properties (openejb.config.file or something similar).

            Show
            dallen6 David Allen added a comment - This related issue might be solved. It is now possible to have an XML configuration file for OpenEJB; however, the file must be specified by a property in jndi.properties (openejb.config.file or something similar).
            Hide
            aslak Aslak Knutsen added a comment -

            pushed upstream master

            Show
            aslak Aslak Knutsen added a comment - pushed upstream master
            Hide
            dallen6 David Allen added a comment -

            I made a mistake on the config property name for the openejb.xml file. I need to fix this and add to the test so that both configurations are verified.

            Show
            dallen6 David Allen added a comment - I made a mistake on the config property name for the openejb.xml file. I need to fix this and add to the test so that both configurations are verified.
            Hide
            dallen6 David Allen added a comment -

            Finished. The property name was changed and additional testing provided to make use of the XML configuration file for OpenEJB. Code is located in same Github branch.

            Show
            dallen6 David Allen added a comment - Finished. The property name was changed and additional testing provided to make use of the XML configuration file for OpenEJB. Code is located in same Github branch.
            Hide
            aslak Aslak Knutsen added a comment -

            pushed upstream

            Show
            aslak Aslak Knutsen added a comment - pushed upstream

              People

              • Assignee:
                dallen6 David Allen
                Reporter:
                dallen6 David Allen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Development