glassfish
  1. glassfish
  2. GLASSFISH-11391

[embedded] Exception when doing unit test with Oracle

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: V3
    • Fix Version/s: V3
    • Component/s: other
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Linux

    • Issuezilla Id:
      11,391

      Description

      Here is the stack trace (Full maven project attached and maven output)

      It seems the tests then use JavaDB even though my persistence.xml specs Oracle.

      Jan 6, 2010 9:55:07 AM oracle.jdbc.driver.OracleDriver registerMBeans
      SEVERE: Error while registering Oracle JDBC Diagnosability MBean.
      javax.management.MalformedObjectNameException: Invalid character '
      ' in value part of property
      at javax.management.ObjectName.construct(ObjectName.java:602)
      at javax.management.ObjectName.<init>(ObjectName.java:1403)
      at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:303)
      at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:209)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:247)
      at sun.misc.Service$LazyIterator.next(Service.java:271)
      at java.sql.DriverService.run(DriverManager.java:664)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.sql.DriverManager.loadInitialDrivers(DriverManager.java:506)
      at java.sql.DriverManager.initialize(DriverManager.java:612)
      at java.sql.DriverManager.registerDriver(DriverManager.java:281)
      at org.apache.derby.jdbc.ClientDriver.<clinit>(Unknown Source)
      at org.apache.derby.jdbc.ClientDataSource.getConnection(Unknown Source)
      at
      com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:104)
      at
      com.sun.enterprise.resource.allocator.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:72)
      at
      com.sun.enterprise.resource.pool.ConnectionPool.createSingleResource(ConnectionPool.java:834)
      at
      com.sun.enterprise.resource.pool.ConnectionPool.createResource(ConnectionPool.java:1087)

      1. EmbedException.zip
        19 kB
        rjdkolb
      2. mavenoutput.txt
        14 kB
        rjdkolb
      3. out_se_ant1.6.5
        9 kB
        sherryshen
      4. out_se_ant1.7.1
        16 kB
        sherryshen

        Activity

        Hide
        marina vatkina added a comment -

        @Stateless
        public class StagingUomFacade implements StagingUomFacadeLocal {
        @PersistenceContext(unitName = "EnygmaStaging")
        private EntityManager em;

        Is the Java EE use of the JPA. It needs Java EE setup.

        As documented in the Embedded guide, the Oracle pool must be predefined in the
        domain.xml (via asadmin or admin GUI) to be used with the embedded EJBContainer.

        Show
        marina vatkina added a comment - @Stateless public class StagingUomFacade implements StagingUomFacadeLocal { @PersistenceContext(unitName = "EnygmaStaging") private EntityManager em; Is the Java EE use of the JPA. It needs Java EE setup. As documented in the Embedded guide, the Oracle pool must be predefined in the domain.xml (via asadmin or admin GUI) to be used with the embedded EJBContainer.
        Hide
        rjdkolb added a comment -

        > Is the Java EE use of the JPA. It needs Java EE setup.
        >
        > As documented in the Embedded guide, the Oracle pool must be predefined in the
        > domain.xml (via asadmin or admin GUI) to be used with the embedded EJBContainer.

        Why is a pool required ?
        From the example persistence.xml in the example- There is no pool. This works in
        normal GlassFish but not embedded.

        <property name="javax.persistence.jdbc.url"
        value="jdbc:oracle:thin:@192.168.101.27:1521:dxngmd"/>
        <property name="javax.persistence.jdbc.password" value="x"/>
        <property name="javax.persistence.jdbc.driver"
        value="oracle.jdbc.OracleDriver"/>
        <property name="javax.persistence.jdbc.user" value="DXSETT_STAGING"/>
        <property name="eclipselink.ddl-generation" value="create-tables"/>

        Show
        rjdkolb added a comment - > Is the Java EE use of the JPA. It needs Java EE setup. > > As documented in the Embedded guide, the Oracle pool must be predefined in the > domain.xml (via asadmin or admin GUI) to be used with the embedded EJBContainer. Why is a pool required ? From the example persistence.xml in the example- There is no pool. This works in normal GlassFish but not embedded. <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@192.168.101.27:1521:dxngmd"/> <property name="javax.persistence.jdbc.password" value="x"/> <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <property name="javax.persistence.jdbc.user" value="DXSETT_STAGING"/> <property name="eclipselink.ddl-generation" value="create-tables"/>
        Hide
        marina vatkina added a comment -

        You need to create Oracle pool in normal GlassFish as well.

        (see my explanation above) The jdbc properties are ignored when a
        container-managed EM or EMF is created, and Java EE rules for parsing
        persistence.xml apply, in which case no <jta-data-source> is treated as "use
        default", which is jdbc/__default in GlassFish. So even in normal GlassFish you
        were running against Derby, not Oracle.

        In embedded mode you had problems with Oracle driver in the classpath and that
        brought up further discussions.

        Show
        marina vatkina added a comment - You need to create Oracle pool in normal GlassFish as well. (see my explanation above) The jdbc properties are ignored when a container-managed EM or EMF is created, and Java EE rules for parsing persistence.xml apply, in which case no <jta-data-source> is treated as "use default", which is jdbc/__default in GlassFish. So even in normal GlassFish you were running against Derby, not Oracle. In embedded mode you had problems with Oracle driver in the classpath and that brought up further discussions.
        Hide
        rjdkolb added a comment -

        > (see my explanation above) The jdbc properties are ignored when a
        > container-managed EM or EMF is created, and Java EE rules for parsing
        > persistence.xml apply, in which case no <jta-data-source> is treated as "use
        > default", which is jdbc/__default in GlassFish.

        My apologies, you are correct.
        The way I describe is how Hibernate 3.x works. (If you don't specify a jdbc
        connection it uses the properties)

        Show
        rjdkolb added a comment - > (see my explanation above) The jdbc properties are ignored when a > container-managed EM or EMF is created, and Java EE rules for parsing > persistence.xml apply, in which case no <jta-data-source> is treated as "use > default", which is jdbc/__default in GlassFish. My apologies, you are correct. The way I describe is how Hibernate 3.x works. (If you don't specify a jdbc connection it uses the properties)
        Hide
        rjdkolb added a comment -

        > In embedded mode you had problems with Oracle driver in the classpath and that
        > brought up further discussions.

        It is finally working with Oracle 10g, Maven and DB Unit for test data.
        i.e. it works end to end if I spec
        "org.glassfish.ejb.embedded.glassfish.installation.root" to my GlassFish 3
        installation with the jdbc resource configured

        Show
        rjdkolb added a comment - > In embedded mode you had problems with Oracle driver in the classpath and that > brought up further discussions. It is finally working with Oracle 10g, Maven and DB Unit for test data. i.e. it works end to end if I spec "org.glassfish.ejb.embedded.glassfish.installation.root" to my GlassFish 3 installation with the jdbc resource configured

          People

          • Assignee:
            dochez
            Reporter:
            rjdkolb
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: