问题
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.
回答1:
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.
回答2:
If anyone is still having a problem calling BIRT from php here's very good tutorial that helped me a lot.
来源:https://stackoverflow.com/questions/5416141/using-eclipse-birt-report-designer-via-php