I have created an iReport and want to call it from my PHP application. I have the following code:
[[o:ClassNotFoundException]:"java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap. -- Unable to call the method, see the README section "Java platform issues" for details and DO NOT REPORT THIS PROBLEM TO THE PHP/Java Bridge MAILING LIST!" at: #-6 php.java.bridge.JavaBridge.getUnresolvedExternalReferenceException(JavaBridge.java:422) #-5 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1055) #-4 php.java.bridge.Request.handleRequest(Request.java:417) #-3 php.java.bridge.Request.handleRequests(Request.java:500) #-2 php.java.bridge.http.ContextRunner.run(ContextRunner.java:145) #-1 php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60) #0 http://192.168.1.18:8080/JavaBridge/java/Java.inc(232): java_ExceptionProxyFactory->getProxy(8, 'java.lang.Class...', 'T', true) #1 http://192.168.1.18:8080/JavaBridge/java/Java.inc(360): java_Arg->getResult(true) #2 http://192.168.1.18:8080/JavaBridge/java/Java.inc(366): java_Client->getWrappedResult(true) #3 http://192.168.1.18:8080/JavaBridge/java/Java.inc(560): java_Client->getResult() #4 http://192.168.1.18:8080/JavaBridge/java/Java.inc(1752): java_Client->invokeMethod(7, 'getCause', Array) #5 http://192.168.1.18:8080/JavaBridge/java/Java.inc(2062): java_JavaProxy->__call('getCause', Array) #6 [internal function]: java_exception->__call('getCause', Array) #7 C:\Program Files (x86)\vtigercrm-5.2.1\apache\htdocs\vtigerCRM\iReportTest3.php(101): java_InternalException->getCause() #8 {main}]
[[o:ClassNotFoundException]:"java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.xml.JRXmlDigesterFactory. -- Unable to call the method, see the README section "Java platform issues" for details and DO NOT REPORT THIS PROBLEM TO THE PHP/Java Bridge MAILING LIST!" at: #-6 php.java.bridge.JavaBridge.getUnresolvedExternalReferenceException(JavaBridge.java:422) #-5 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1055) #-4 php.java.bridge.Request.handleRequest(Request.java:417) #-3 php.java.bridge.Request.handleRequests(Request.java:500) #-2 php.java.bridge.http.ContextRunner.run(ContextRunner.java:145) #-1 php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60) #0 http://192.168.1.18:8080/JavaBridge/java/Java.inc(232): java_ExceptionProxyFactory->getProxy(8, 'java.lang.Class...', 'T', true) #1 http://192.168.1.18:8080/JavaBridge/java/Java.inc(360): java_Arg->getResult(true) #2 http://192.168.1.18:8080/JavaBridge/java/Java.inc(366): java_Client->getWrappedResult(true) #3 http://192.168.1.18:8080/JavaBridge/java/Java.inc(560): java_Client->getResult() #4 http://192.168.1.18:8080/JavaBridge/java/Java.inc(1752): java_Client->invokeMethod(7, 'getCause', Array) #5 http://192.168.1.18:8080/JavaBridge/java/Java.inc(2062): java_JavaProxy->__call('getCause', Array) #6 [internal function]: java_exception->__call('getCause', Array) #7 C:\Program Files (x86)\vtigercrm-5.2.1\apache\htdocs\vtigerCRM\iReportTest3.php(101): java_InternalException->getCause() #8 {main}]
I have included the necessary PATH and CLASSPATH, with jasperreport-5.6.0.jar in the \~\WEB-INF\lib. Any idea on how can it be solved?
It's urgent, so any help on this problem would be much appreciate. Thanks in advance.
Toreay
2 Answers:
Ouch.. the PHP-JAVA Bridge, a tough one to troubleshoot... and for the error text I can see how they are tired of users reporting missing dependencies to them as a bug :)
Ok, I think the answer to your question is in the error itself:
java.lang.NoClassDefFoundError: org/apache/commons/collections/map/ReferenceMap. -- Unable to call the method, see the README section "Java platform issues" for details and DO NOT REPORT THIS PROBLEM TO THE PHP/Java Bridge MAILING LIST!"
So the JVM running for the PHP/JAVA bridge was not able to find org.apache.commons in the classpath, so it looks to me that all the JR dependencies are not in your classpath, check the docs (JR Ultimate guide) http://community.jaspersoft.com/documentation/jasperreports-library-ulti... this sample may help http://jasperreports.sourceforge.net/sample.reference/webapp/index.html#...
I will recommend you to first get the report running in a pure java environment (like the sample above) so you can better check for dependencies and then move that to your PHP/JAVA bridge.