Birt运行时maven工件问题

时间:2015-11-16 09:49:31

标签: java maven report birt

我想在我的项目中使用Birt Api库,所以我将rg.eclipse.birt.runtime 4.5 maven依赖项包含到我的项目中

<dependency>
        <groupId>org.eclipse.birt.runtime</groupId>
        <artifactId>org.eclipse.birt.runtime</artifactId>
        <version>4.5.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.eclipse.birt.runtime</groupId>
                <artifactId>org.eclipse.osgi</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>org.eclipse.osgi</artifactId>
        <version>3.10.100.v20150529-1857</version>
    </dependency>

当我想执行我的报告时,我得到了由&#34; org.eclipse.core.runtime.IExtensionRegistry&#34;引起的堆栈跟踪错误;签名者信息与签名者信息不匹配同一个包中的其他类。以前我使用相同的库Birt Runtime 4.5,但手动下载并附加到我的项目,报告生成成功。

org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
    at org.eclipse.birt.core.framework.Platform.startup(Platform.java:81)
    at org.report.birt.service.BirtApi.getReport(BirtApi.java:33)
    at org.report.birt.endpoint.BirtEndPoint.handleRequest(BirtEndPoint.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.ws.server.endpoint.MethodEndpoint.invoke(MethodEndpoint.java:134)
    at org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.invokeInternal(DefaultMethodEndpointAdapter.java:291)
    at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:55)
    at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:236)
    at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176)
    at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)
    at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)
    at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.SecurityException: class "org.eclipse.core.runtime.IExtensionRegistry"'s signer information does not match signer information of other classes in the same package
    at java.lang.ClassLoader.checkCerts(ClassLoader.java:952)
    at java.lang.ClassLoader.preDefineClass(ClassLoader.java:666)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:794)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1190)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1190)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at org.eclipse.birt.core.framework.jar.ServicePlatform.<init>(ServicePlatform.java:46)
    at org.eclipse.birt.core.framework.jar.ServiceLauncher.startup(ServiceLauncher.java:46)
    at org.eclipse.birt.core.framework.Platform.startup(Platform.java:75)
    ... 35 more

3 个答案:

答案 0 :(得分:2)

Maven Central Repository上提供的

org.eclipse.birt.runtime-4.5.0依赖于使用旧版本和新版本的Eclipse证书签名的JAR,但这些JAR包含来自同一个包的类(在本例中为org.eclipse.core.runtime)。从两个JAR加载类时,由于此签名不一致,JVM会抛出此类SecurityException

例如,可以使用org.eclipse.equinox.common-3.6.200.v20130402-1505.jarorg.eclipse.equinox.registry-3.6.0.v20150318-1503.jar来证明这一点,org.eclipse.birt.runtime-4.5.0包含org.eclipse.core.runtime包中的jarsigner -verify -verbose -certs xxx.jar的依赖关系。 Central Maven Repository上提供的版本使用不同的证书进行签名,如//org.eclipse.equinox.common-3.6.200.v20130402-1505.jar [entry was signed on 09/04/13 15:24] X.509, CN="Eclipse.org Foundation, Inc.", OU=IT, O="Eclipse.org Foundation, Inc.", L=Ottawa, ST=Ontario, C=CA //org.eclipse.equinox.registry-3.6.0.v20150318-1503.jar [entry was signed on 18/03/15 18:14] X.509, CN="Eclipse Foundation, Inc.", OU=IT, O="Eclipse Foundation, Inc.", L=Ottawa, ST=Ontario, C=CA 所示:

SecurityException

因此在尝试从两个JAR加载类时4.6.0-20160607。你可以:

  • 使用版本4.5.0代替Maven
  • 从官方网站手动下载并附加版本 <dependency> <groupId>org.eclipse.birt.runtime</groupId> <artifactId>org.eclipse.birt.runtime</artifactId> <version>4.5.0</version> <exclusions> <exclusion> <groupId>org.eclipse.birt.runtime</groupId> <artifactId>org.eclipse.osgi</artifactId> </exclusion> </exclusions> </dependency> ,该网站与使用最新证书版本签名的JAR一起打包

附注:通过创建具有以下依赖关系的Maven项目可以重现问题:

Class.forName("org.eclipse.core.runtime.Assert").getResource("Assert.class");
Class.forName("org.eclipse.core.runtime.IExtensionRegistry").getResource("IExtensionRegistry.class");

运行一个代码,该代码将加载JAR中包含的类,这些JAR使用上面引用的证书签名,例如:

SecurityException
使用版本4.5.0时,

会产生类似的4.6.0-20160607,但版本return "<?php echo __('" . $a['name'] . "', 'pulsdesign'); ?>";则不会。{/ p>

另一个注意事项: There is a similar issue版本为4.2.0 M7。

答案 1 :(得分:1)

我有2个解决方案。请检查

第一:

使用依赖版本4.5.0a而不是4.5

<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.birt.runtime</artifactId>
<version>4.5.0a</version>
</dependency>

资源链接:https://communities.opentext.com/forums/discussion/comment/217265/#Comment_217265

第二

这里有一步一步的完整教程:

http://wiki.eclipse.org/BirtPOJO_Viewer_WebSphere_Deployment

答案 2 :(得分:0)

我还遇到了“ org.eclipse.core.runtime.IExtensionRegistry”相同的问题,在我的Maven项目中,该类来自“ registry-3.5.400-v20140428-1507.jar”。 提到的jar应该从“ org.eclipse.birt.runtime-4.4.1.jar”加载,但是是从其他由不同证书签名的Maven依赖项加载的。 因此,为解决此问题,我按照以下步骤操作。

  1. 在我的情况下,搜索从中加载“ IExtensionRegistry”的jar,它来自“ registry-3.5.400-v20140428-1507.jar”。
  2. 由于Maven将始终基于先到先得的原则在类路径上加载JAR。
  3. 因此,如果您使用的是maven项目,请确保必须从其父jar“ org.eclipse.birt.runtime-4.4.1.jar”的类路径中加载jar,这样就不会出现证书丢失匹配的问题。
  4. 如果它仍从其他父依赖项加载,请使用正确的版本将“ registry-3.5.400-v20140428-1507.jar”依赖项从maven“ https://mvnrepository.com/artifact/org.eclipse.equinox/registry”添加到pom.xml中,并确保将此依赖项放在从其加载并创建此问题的其他父依赖项之前。