1 Reply Latest reply: Feb 22, 2012 7:59 AM by Karel Piwko RSS

    How to add ojdbc14.jar to ShrinkWrap: embedded glassfish3.1, seam3, ejb 3.1

    brin jack Newbie

      I want to execute testcases for the project on embedded glassfish3.1, seam3, ejb 3.1, richfaces.

       

      I have followed the JPA2 example, but I need to connect to the oracle database. I made the required changes in test-persistence.xml. But how to add ojdbc14.jar to ShrinkWrap.

        • 1. Re: How to add ojdbc14.jar to ShrinkWrap: embedded glassfish3.1, seam3, ejb 3.1
          Karel Piwko Master

          Hi Brin,

           

          I guess you are using Maven, so you have ojdbc14.jar defined in your pom.xml file.

           

          The easiest think you need to do is to add ShrinkWrap Maven Resolver to your project:

           

           

          <dependencyManagement>
               
               ... <!-- this you should already have in your project -->
          </dependencyManagement>
          
          <dependencies>
               ...
           <!-- ShrinkWrap Resolver -->
                      <dependency>
                          <groupId>org.jboss.shrinkwrap.resolver</groupId>
                          <artifactId>shrinkwrap-resolver-api</artifactId>
                      </dependency>
                      <dependency>
                          <groupId>org.jboss.shrinkwrap.resolver</groupId>
                          <artifactId>shrinkwrap-resolver-api-maven</artifactId>
                      </dependency>
                      <dependency>
                          <groupId>org.jboss.shrinkwrap.resolver</groupId>
                          <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
                      </dependency>
               ...
          </dependencies>
          

           

          Then, you can get the ojdbc dependency from pom.xml file and add it to the WAR/EAR:

           

           

                  WebArchive war = ShrinkWrap.create(WebArchive.class, "myapp.war").addAsLibraries(
                          DependencyResolvers.use(MavenDependencyResolver.class).loadEffectivePom("pom.xml").up()
                                  .artifact("ojdbc-groupId:ojdbc-artifactId").resolveAsFiles());
          
          

           

          Hope that helps,

           

          Karel