通过 PHP 使用 Eclipse BIRT 报表设计器

发布于 2024-10-25 22:21:34 字数 4250 浏览 1 评论 0原文

我想在 php web 项目中使用 Birt Reports。 因此我安装了推荐的 Java Bridge 和 BIRT Runtime 将 JavaBridgeTemplate621.war 和 birt.war 移至我的 Tomcat。

之后,我编写了一个调用 BirtEngine 的简短类:

try {
    $ctx = java_context()->getServletContext();
    $this->birdEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
    java_context()->onShutdown(
        java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook()
    );
} catch (java_InternalException $e) {
    die($e->getMessage());
}

当我认识到 $e->getMessage() 返回 "" 时,我查看了 catalina.out 并在那里我发现了这个异常:

23.03.2011 15:02:43 org.apache.cxf.interceptor.AttachmentInInterceptor handleMessage
INFO: AttachmentInInterceptor skipped in HTTP GET method
23.03.2011 15:02:43 org.apache.cxf.interceptor.StaxInInterceptor handleMessage
INFO: StaxInInterceptor skipped.
23.03.2011 15:02:43 org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor handleMessage
INFO: ReadHeadersInterceptor skipped in HTTP GET method
23.03.2011 15:02:43 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation:
        at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:77)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:285)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:168)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:157)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
java.lang.ClassNotFoundException: org.eclipse.birt.php.birtengine.BirtEngine
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at php.java.bridge.Util.classForName(Util.java:1518)
        at php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:445)
        at php.java.bridge.Request.handleRequest(Request.java:444)
        at php.java.bridge.Request.handleRequests(Request.java:500)
        at php.java.bridge.http.ContextRunner.run(ContextRunner.java:145)
        at php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60)

尤其是这一行引起了我的注意:

java.lang.ClassNotFoundException: org.eclipse.birt.php.birtengine.BirtEngine

但是每次尝试从谷歌和常见网站获取帮助都失败了。 所以我希望这个网站的人可以帮助我。

I want to use Birt Reports in an php webproject.
Therefore I installed the recommend Java Bridge and the BIRT Runtime
by moving JavaBridgeTemplate621.war and birt.war to my Tomcat.

After that I wrote a short class calling the BirtEngine:

try {
    $ctx = java_context()->getServletContext();
    $this->birdEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx);
    java_context()->onShutdown(
        java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook()
    );
} catch (java_InternalException $e) {
    die($e->getMessage());
}

As I recognize that $e->getMessage() returns "" I take a look at the catalina.out and there I found this exception:

23.03.2011 15:02:43 org.apache.cxf.interceptor.AttachmentInInterceptor handleMessage
INFO: AttachmentInInterceptor skipped in HTTP GET method
23.03.2011 15:02:43 org.apache.cxf.interceptor.StaxInInterceptor handleMessage
INFO: StaxInInterceptor skipped.
23.03.2011 15:02:43 org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor handleMessage
INFO: ReadHeadersInterceptor skipped in HTTP GET method
23.03.2011 15:02:43 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: No such operation:
        at org.apache.cxf.interceptor.URIMappingInterceptor.handleMessage(URIMappingInterceptor.java:77)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
        at org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
        at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:285)
        at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:168)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175)
        at org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:157)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
java.lang.ClassNotFoundException: org.eclipse.birt.php.birtengine.BirtEngine
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:247)
        at php.java.bridge.Util.classForName(Util.java:1518)
        at php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:445)
        at php.java.bridge.Request.handleRequest(Request.java:444)
        at php.java.bridge.Request.handleRequests(Request.java:500)
        at php.java.bridge.http.ContextRunner.run(ContextRunner.java:145)
        at php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60)

Especially this line takes my attention:

java.lang.ClassNotFoundException: org.eclipse.birt.php.birtengine.BirtEngine

But each try to get help from google and common websites failed.
So I hope someone from this site can help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蘸点软妹酱 2024-11-01 22:21:34

我知道这是一个老问题,但我确实通过 PHP java 桥成功运行了 BIRT。您的 PHP 代码是正确的。但您使用 WAR 文件的方式却并非如此。

基本上,您的一个 war 文件包含 PHP/JavaBridge 文件和 BIRT + 一个特殊的类,用于在 JAVA 桥中加载 BIRT。

如果您仍然没有解决这个问题,我也许可以提供我正在使用的 WAR 文件。

I know this is an old question, but I do run BIRT through the PHP java bridge successfully. The PHP code you have is correct. But the way that you are using the WAR files is not.

Basically you one war file with both the PHP/JavaBridge files and BIRT + a special class to load BIRT within the JAVA bridge.

If you still haven't solved this problem, I might be able to make the WAR file I'm using available.

蓝天 2024-11-01 22:21:34

如果有人仍然遇到从 php 调用 BIRT 的问题,这里有非常好的教程 这对我帮助很大。

If anyone is still having a problem calling BIRT from php here's very good tutorial that helped me a lot.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文