2 Replies Latest reply on Dec 8, 2011 7:40 AM by nikola zifra

    Is embedded Glassfish 3.1.1 ignoring instanceRoot param from arquillian.xml?

    nikola zifra Newbie

      Hi there I have been evaluating Arqullian for last cpl. of days in attempt to unit test my current project on embedded Glassfish 3.1.1 but no luck so far.

      Here are the Maven dependencies I am using:

       

      <dependencyManagement>      

           <dependencies>

                  <dependency>

                      <groupId>org.jboss.arquillian</groupId>

                      <artifactId>arquillian-bom</artifactId>

                      <version>1.0.0.CR6</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

              </dependencies>

          </dependencyManagement>

       

          <dependencies>       

          <dependency>

                   <groupId>org.jboss.arquillian.junit</groupId>

                   <artifactId>arquillian-junit-container</artifactId>            

           </dependency> 

            <dependency>

                  <groupId>org.jboss.arquillian.container</groupId>

                  <artifactId>arquillian-glassfish-embedded-3.1</artifactId>

                  <version>1.0.0.CR2</version>           

            </dependency>

            <dependency>

                  <groupId>org.glassfish.extras</groupId>

                  <artifactId>glassfish-embedded-all</artifactId>

                  <version>3.1.1</version>

                  <scope>provided</scope>

              </dependency>

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.8.2</version>

                  <scope>test</scope>

              </dependency>

          </dependencies>

       

       

      Here is the arqullian.xml i am using with instanceRoot pointing to the existing Glassfish 3.1.1 installation (i also renamed original domain.xml to domain.xml.current)

       

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

      <arquillian

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian-1.0.xsd">

                          <engine>

               <!-- test archives exported to the file system for inspection -->

                                    <property name="deploymentExportPath">d:\\tmp2</property>

                          </engine> 

             <container qualifier="glassfish" default="true">

                          <protocol type="Servlet 3.0">

                 <configuration>

                                       <property name="bindHttpPort">7070</property>

                                       <property name="configurationXml">D:/projects/xplod/xplod-product/conf/DEV_TEST/config/domain.xml</property>

                                       <property name="instanceRoot">d:/apps/glassfish-3.1/glassfish/domains/domain1</property>                                

                 </configuration>

                           </protocol>

             </container>

      </arquillian>

       

      Exception in the console log I see is:

       

      classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)

      SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@1ac659a8

      classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)

      SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@1ac659a8

      [Loaded org.glassfish.deployment.common.Artifacts from file:/C:/Users/nikola.zif

      ra.MOGUL/.m2/repository/org/glassfish/extras/glassfish-embedded-all/3.1.1/glassf

      ish-embedded-all-3.1.1.jar]

      Dec 8, 2011 11:46:56 AM org.glassfish.deployment.admin.DeployCommand execute

      SEVERE: Exception while preparing the app : Invalid resource : jdbc/XplodTest2__

      pm

      com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resou

      rce : jdbc/XplodTest2__pm

              at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceIm

      pl$MyDataSource.validateResource(ConnectorResourceAdminServiceImpl.java:274)

              at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceIm

      pl$MyDataSource.setResourceInfo(ConnectorResourceAdminServiceImpl.java:255)

              at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceIm

      pl.lookupDataSourceInDAS(ConnectorResourceAdminServiceImpl.java:245)

              at com.sun.enterprise.connectors.ConnectorRuntime.lookupDataSourceInDAS(

      ConnectorRuntime.java:538)

              at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(Conne

      ctorRuntime.java:469)

              at org.glassfish.persistence.common.PersistenceHelper.lookupPMResource(P

      ersistenceHelper.java:63)

              at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.looku

      pDataSource(ProviderContainerContractInfoBase.java:71)

              at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(Persiste

      nceUnitInfoImpl.java:108)

              at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(Persistenc

      eUnitLoader.java:154)

              at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(Persistenc

      eUnitLoader.java:119)

              at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java

      :214)

              at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIt

      erator.iteratePUDs(JPADeployer.java:483)

       

       

      Since I turned on the class loading output on i clearly saw that Oracle db driver required for this project is not loaded at all by embedded glassfish

      due to the fact that embedded Glassfish is using the Temp folder as the instance root, ignoring the supplied instanceRoot which contains required driver ojdbc14.jar. Could you pls. help me to find solution for this one or a workaround?

       

      /Nikola