users@glassfish.java.net

using JPA from OSGI WAB in glassfish 3.1

From: Lena Svetlov <svetloe_at_hotmail.com>
Date: Wed, 2 Feb 2011 16:39:51 +0000

                (I am new in OSGI)


I am trying to access a JPA JAR from OSGI WAB in glassfish 3.1.



When I deploy the OSGI WAB with JPA jar, I get the exception:


[#|2011-02-01T18:29:10.035+0200|SEVERE|glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=17;_ThreadName=Thread-1;|java.lang.RuntimeException:
 java.util.zip.ZipException: duplicate entry:
META-INF/maven/com.test/test-web/pom.properties
    at
org.glassfish.osgijavaeebase.OSGiBundleArchive$1.run(OSGiBundleArchive.java:366)
Caused
 by: java.util.zip.ZipException: duplicate entry:
META-INF/maven/com.test/test-web/pom.properties
    at
java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:175)
    at
java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:92)
    at
org.glassfish.osgijavaeebase.OSGiBundleArchive$1.run(OSGiBundleArchive.java:348)
|#]




More details about my JAR and WAB:

1) When the JPA JAR is included in non-OSGI WAR, it works correctly. However OSGI WAB with this JPA JAR fails in deployment.

2) Below is a part from pom.xml that constructs a WAB:

                    <artifactId>maven-bundle-plugin</artifactId>
                    <version>2.2.0</version>
                    <extensions>true</extensions>
                    <configuration>
                        <instructions>
                            <Web-ContextPath>/testWab</Web-ContextPath>
                            <Webapp-Context>/testWab</Webapp-Context>
                            <Export-Package/>
                            <Export-EJB>all</Export-EJB>
                            <DynamicImport-Package>javax.*, org.xml.sax, org.xml.sax.*, org.w3c.*</DynamicImport-Package>
                            <Bundle-ClassPath>.,WEB-INF/classes/</Bundle-ClassPath>
                            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                            <Embed-Directory>WEB-INF/lib</Embed-Directory>
                            <Embed-Transitive>true</Embed-Transitive>
                            <Import-Package>com.test.integration.service.*;version="1.0.0", com.test.adapter.*;version="1.0.0",org.osgi.framework, org.osgi.util.tracker</Import-Package>
                        </instructions>
                    </configuration>

Please consult