我有一个使用jpa(eclipseLink)的软件包。我和jarsigner签了这个包。如果我在我的glassfish(felix)上部署捆绑包,我会得到以下异常:
[#|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 / enhanced-osgiapp ...”文件夹,此文件夹未签名!
我是否正确?我该如何解决这个问题?
答案 0 :(得分:0)
我将问题追溯到GlassFish使用的osgi-jpa组件。该组件扫描已安装的包以获取JPA内容并编织JPA实体。然后将以下两个条目添加到MANIFEST.MF文件中:
在我看来,这是一个GlassFish错误。我开了一张错误票:https://java.net/jira/browse/GLASSFISH-20859
作为一种解决方法,可以在构建期间编译JPA实体,并且可以在签名包之前添加MANIFEST.MF条目。在这种情况下,osgi-jpa组件会忽略该bundle,并且bundle的签名不会被破坏。