Birt Runtime maven artifact issue第一:第二:

2022-09-04 04:34:05

我想在我的项目中使用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>

当我想执行我的报告时,我得到了以下堆栈跟踪错误,这是由“org.eclipse.core.runtime.IExtensionRegistry”的签名者信息与同一包中其他类的签名者信息不匹配引起的。以前,我使用相同的库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

答案 1

org.eclipse.birt.runtime-4.5.0Maven Central Repository 上的可用取决于使用旧版和新版本的 Eclipse 证书签名的 JAR,但这些 JAR 包含来自同一软件包的类(在本例中)。当从两个 JAR 加载类时,JVM 会因为这种签名不一致而引发此类类。org.eclipse.core.runtimeSecurityException

例如,这可以用 和 作为证据,这两个依赖关系都包含包中的类。中央 Maven 存储库上可用的版本使用不同的证书进行签名,如以下所示:org.eclipse.equinox.common-3.6.200.v20130402-1505.jarorg.eclipse.equinox.registry-3.6.0.v20150318-1503.jarorg.eclipse.birt.runtime-4.5.0org.eclipse.core.runtimejarsigner -verify -verbose -certs xxx.jar

//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

因此,当尝试从两个 JAR 加载类时。您可以:SecurityException

  • 使用版本与 Maven 一起使用4.6.0-20160607
  • 从官方网站手动下载并附加版本,该版本与使用最新证书版本签名的JAR打包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中包含的类,例如:

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

使用版本时将导致类似,但不与版本 。SecurityException4.5.04.6.0-20160607

另一个注意事项:版本4.2.0 M7也存在类似的问题


答案 2

我有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


推荐