2013-10-09 44 views
-1

我有一個使用jpa(eclipseLink)的包。我與jarsigner簽署了捆綁。如果我部署我的GlassFish(菲利克斯)的包,我會得到遵循例外:使用eclipselink的標記包

[#|2013-10-09T12:55:47.521+0200|INFO|glassfish3.1.2|org.glassfish.osgijpa|_ThreadID=17;_ThreadName=Thread-2;|Bundle having id 598 is a JPA bundle|#] 

[#|2013-10-09T12:55:50.314+0200|INFO|glassfish3.1.2|org.glassfish.osgijpa|_ThreadID=17;_ThreadName=Thread-2;|Exploded bundle com.xy.abc [598] at /tmp/osgiapp5163833994507427221 |#] 

[#|2013-10-09T12:55:52.120+0200|INFO|glassfish3.1.2|org.glassfish.osgijpa|_ThreadID=17;_ThreadName=Thread-2;|Source = /tmp/osgiapp5163833994507427221, Target = /tmp/enhanced-osgiapp5359301892972587683|#] 

[#|2013-10-09T12:55:59.019+0200|INFO|glassfish3.1.2|org.glassfish.osgijpa|_ThreadID=17;_ThreadName=Thread-2;|Deleted /tmp/osgiapp5163833994507427221 |#] 

[#|2013-10-09T12:56:01.719+0200|WARNING|glassfish3.1.2|org.glassfish.osgijpa|_ThreadID=17;_ThreadName=Thread-2;|Failed to enhance bundle having id 598 
org.osgi.framework.BundleException: Update of bundle com.xy.abc [598] failed. 
at org.apache.felix.framework.Felix.updateBundle(Felix.java:2251) 
at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:962) 
at org.glassfish.osgijpa.JPAExtender.updateBundle(JPAExtender.java:191) 
at org.glassfish.osgijpa.JPAExtender.enhance(JPAExtender.java:175) 
at org.glassfish.osgijpa.JPAExtender.access$100(JPAExtender.java:64) 
at org.glassfish.osgijpa.JPAExtender$1.run(JPAExtender.java:130) 
at org.glassfish.osgijpa.JPAExtender.executeTask(JPAExtender.java:203) 
at org.glassfish.osgijpa.JPAExtender.bundleChanged(JPAExtender.java:139) 
at org.apache.felix.framework.util.EventDispatcher$3.run(EventDispatcher.java:861) 
at java.security.AccessController.doPrivileged(Native Method) 
at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:858) 
at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789) 
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514) 
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4249) 
at org.apache.felix.framework.Felix.installBundle(Felix.java:2881) 
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:157) 
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:138) 
at org.apache.felix.gogo.command.Basic.start(Basic.java:753) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136) 
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82) 
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469) 
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395) 
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) 
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) 
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) 
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) 
at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:164) 
at org.apache.felix.gogo.shell.Shell.sh(Shell.java:178) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136) 
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82) 
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469) 
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395) 
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) 
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) 
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) 
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) 
at org.apache.felix.gogo.shell.Console.run(Console.java:62) 
at org.apache.felix.gogo.shell.Shell.console(Shell.java:203) 
at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:128) 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
at java.lang.reflect.Method.invoke(Method.java:597) 
at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136) 
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82) 
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469) 
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395) 
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) 
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) 
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) 
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89) 
at org.apache.felix.shell.remote.Shell.startGogoShell(Shell.java:108) 
at org.apache.felix.shell.remote.Shell.run(Shell.java:81) 
at java.lang.Thread.run(Thread.java:662) 
Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes 
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:221) 
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:176) 
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:288) 
at java.util.jar.JarVerifier.update(JarVerifier.java:199) 
at java.util.jar.JarInputStream.read(JarInputStream.java:200) 
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:100) 
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:78) 
at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:130) 
at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:167) 
at org.apache.felix.framework.security.verifier.BundleDNParser.getCertificates(BundleDNParser.java:292) 
at org.apache.felix.framework.security.verifier.BundleDNParser._getDNChains(BundleDNParser.java:240)/tmp/enhanced-osgiapp 
at org.apache.felix.framework.security.verifier.BundleDNParser.checkDNChains(BundleDNParser.java:148) 
at org.apache.felix.framework.SecurityProviderImpl.checkBundle(SecurityProviderImpl.java:64) 
at org.apache.felix.framework.BundleImpl.addRevision(BundleImpl.java:1170) 
at org.apache.felix.framework.BundleImpl.revise(BundleImpl.java:1130) 
at org.apache.felix.framework.Felix.updateBundle(Felix.java:2113) 
... 61 more 

在EclipseLink的,我發現如下的代碼片段:

// We need to explode the bundle if it is not a directory based deployment. 
    // This is because, eclipselink enhancer can only scan file system artifacts. 
    File explodedDir = makeFile(b); 
    boolean dirDeployment = (explodedDir != null) ? explodedDir.isDirectory() : false; 
    try { 
     if (!dirDeployment) { 
      explodedDir = explode(b); 
     } 

     // We need to make a copy of the exploded direactory where the enhanced bytes will be written to. 
     final File enhancedDir = makeTmpDir("enhanced-osgiapp"); 
     FileUtils.copyTree(explodedDir, enhancedDir); 

我想創建的EclipseLink對「/ tmp /增強osgiapp ...「文件夾和此文件夾未簽名!

我對嗎?我該如何解決這個問題?

回答

0

我將問題追溯到GlassFish使用的osgi-jpa組件。該組件掃描已安裝的JPA內容捆綁包並編織JPA實體。此後以下兩個條目添加到MANIFEST.MF文件:

  • 與GlassFish StaticallyWeaved:真
  • DynamicImport-包裝:org.eclipse.persistence *

在我看來,這是一個GlassFish錯誤。我打開了一個bug代碼:https://java.net/jira/browse/GLASSFISH-20859

解決方法JPA實體可以在編譯期間編織,MANIFEST.MF條目可以在簽名之前添加。在這種情況下,osgi-jpa組件會忽略束並且束的簽名沒有被破壞。