|
From: <php...@li...> - 2008-10-30 16:12:14
|
php...@li... a écrit :
> Hi,
>
>> *Fatal error*: Class 'Java' not found in
>>
> this PHP error message means that you don't have a Java class. Either write your own class or use the one provided by the PHP/Java Bridge. Please see our FAQ for details.
> Regards,
> Jost Boekemeier
>
Hi Jost,
thanks for your help. Following your mail, i have reread a lot of the
forums and the docs.
And it's better :-) !
But not enough... Here I am now, this script :
###
<?php
require_once("java/Java.inc");
java_require("/usr/share/java/ext/");
$compileManager = new
JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
print "<br/>Point 1<br/><br/>";
$report = $compileManager->compileReport("/tmp/jreport/test.jrxml");
print "<br/>Point 2<br/><br/>";
?>
###
gives this error :
###
Point 1
*Fatal error*: Uncaught [[o:Exception]:"java.lang.Exception: Invoke
failed: [[c:JasperCompileManager]]->compileReport((o:String)[o:String]).
Cause: java.lang.ClassNotFoundException: Unresolved external reference:
java.lang.NoClassDefFoundError:
net.sf.jasperreports.engine.xml.JRXmlLoader. -- Unable to call the
method, see the README section "Java platform issues" for details. VM:
1.4.2@http://gcc.gnu.org/java/" at: #-6
php.java.bridge.JavaBridge.getUnresolvedExternalReferenceException(JavaBridge.java:433)
#-5 php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1080) #-4
php.java.bridge.Request.handleRequest(Request.java:409) #0
/usr/share/php/java/Java.inc(300):
java_ThrowExceptionProxyFactory->getProxy(4, 'net.sf.jasperre...',
'Unresolved exte...', true) #1 /usr/share/php/java/Java.inc(454):
java_Arg->getResult(true) #2 /usr/share/php/java/Java.inc(460):
java_Client->getWrappedResult(true) #3
/usr/share/php/java/Java.inc(664): java_Client->getResult() #4
/usr/share/php/java/Java.inc(1779): java_Client->invokeMethod(3, 'compi
in */usr/share/php/java/Java.inc* on line *263*
###
I think the problem comes from my configuration of php-java-bridge, as
net.sf.jasperreports.engine.xml.JRXmlLoader is in the same .jar file
than net.sf.jasperreports.engine.JasperCompileManager. Excepted this
error, everything went smoothly and i haven't noted any other error.
Here is what i did since the beginning :
I am on a debian etch server.
I have installed the gcj php5-dev gcc autoconf libtool automake make
packages.
I have phpized php-java-bridge.
# wget
http://downloads.sourceforge.net/php-java-bridge/php-java-bridge_5.3.2.1.2.orig.tar.gz?modtime=1223900873&big_mirror=0
# tar xzvf php-java-bridge_5.3.2.1.2.orig.tar.gz
# cd php-java-bridge_5.3.2.1.2.orig
# phpize && ./configure && make
I have put Java.Inc in /usr/share/php/java/
I have put my jar files in /usr/share/java/ext/ (even JavaBridge.jar)
I have launched the servlet :
# cd /root/php-java-bridge/php-java-bridge-5.3.2.1.2.orig/modules/
# ./java SERVLET:8080 3 JavaBridge.log
JavaBridge.log says :
Oct 29 12:24:58 JavaBridge INFO : VM :
1.4.2@http://gcc.gnu.org/java/
Oct 29 12:24:58 JavaBridge INFO : logFile : JavaBridge.log
Oct 29 12:24:58 JavaBridge INFO : default logLevel : 3
Oct 29 12:24:58 JavaBridge INFO : socket : SERVLET:8080
Oct 29 12:24:58 JavaBridge INFO : java.ext.dirs : /usr/share/java/ext
Oct 29 12:24:58 JavaBridge INFO : php.java.bridge.base: /root
Oct 29 12:24:58 JavaBridge INFO : thread pool size : 20
Oct 29 12:24:58 JavaBridge INFO : JavaBridgeRunner started on port
INET_LOCAL:8080
Here I have a question : is "php.java.bridge.base: /root" correct or
problematic ?
Another information :
| echo java("java.lang.System")->getProperties();
|in apache gives me (i put it one information per line to make it more
readable) :
{
path.separator=:,
java.vm.name=GNU libgcj,
java.vm.specification.name=Java(tm) Virtual Machine Specification,
java.runtime.version=1.4.2,
java.home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre,
java.vm.specification.version=1.0,
line.separator= ,
java.vm.specification.vendor=Sun Microsystems Inc.,
gnu.classpath.home.url=file:///usr/lib/../lib64,
gnu.gcj.progname=./java,
gnu.classpath.version=0.92,
java.specification.version=1.4,
java.library.path=/usr/lib/../lib64/gcj-4.1:/usr/lib/jni,
gnu.classpath.vm.shortname=libgcj,
java.class.version=48.0,
java.specification.name=Java(tm) Platform API Specification,
os.version=2.6.18-6-amd64,
gnu.classpath.home=/usr,
user.home=/root,
file.encoding=UTF-8,
os.name=Linux,
php.java.bridge.promiscuous=true,
user.name=root,
java.class.path=.,
java.io.tmpdir=/tmp,
os.arch=x86_64,
java.fullversion=GNU libgcj 4.1.2 20061115 (prerelease) (Debian 4.1.1-20),
user.language=en,
java.specification.vendor=Sun Microsystems Inc.,
user.dir=/root/php-java-bridge/php-java-bridge-5.3.2.1.2.orig/modules,
java.vm.info=GNU libgcj 4.1.2 20061115 (prerelease) (Debian 4.1.1-20),
java.version=1.4.2,
java.ext.dirs=/usr/share/java/ext,
sun.boot.class.path=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre/lib/rt.jar,
gnu.gcj.user.realname=root,
java.vm.vendor=Free Software Foundation, Inc.,
java.vendor.url=http://gcc.gnu.org/java/,
java.vendor=Free Software Foundation, Inc.,
file.separator=/,
java.vm.version=4.1.2 20061115 (prerelease) (Debian 4.1.1-20),
http.agent=gnu-classpath/0.92 (libgcj/4.1.2 20061115 (prerelease)
(Debian 4.1.1-20)),
gnu.gcj.precompiled.db.path=/var/lib/../lib64/gcj-4.1/classmap.db,
gnu.cpu.endian=little, user.region=GB,
gnu.gcj.runtime.endorsed.dirs=/usr/share/java/gcj-endorsed
}
Particularly, do you think these lines are coherent ?
java.home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre
java.library.path=/usr/lib/../lib64/gcj-4.1:/usr/lib/jni
user.home=/root,
java.class.path=.,
user.dir=/root/php-java-bridge/php-java-bridge-5.3.2.1.2.orig/modules,
gnu.gcj.user.realname=root,
And finally, would you have any direction for me to look ?
David
|