|
From: <php...@li...> - 2007-06-20 11:09:11
|
Umm, you just spelled your method name wrong:
=20
public void setHelloWorld(String incoming) {
hw =3D incoming;
}
=20
Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke=20
failed: [[o:HelloWorld]]->setHellowWorld([o:PhpParserString]). Cause:=20
java.lang.NoSuchMethodException: setHellowWorld([o:PhpParserString]).=20
Candidates: [] Responsible VM: 1.5.0_11@http://java.sun.com/ =
<http://java.sun.com/> " at: #-5=20
There's an extra "w" in there.
________________________________
From: php...@li... on behalf of =
php...@li...
Sent: Tue 6/19/2007 1:14 PM
To: php...@li...
Subject: [Php-java-bridge-users] Troubles calling a simple Java app
I am new to the php-java-bridge and am experimenting with it. There=20
is probably something obvious that I am not seeing, but I cannot get=20
a simple example Java to PHP application bridge working. I used the=20
latest Debian packages which are using version 4.0.8a of the php-java-
bridge. I can see via phpinfo() that php-java-bridge is installed and=20
running via Apache2.2 right now. The following application works fine=20
(I got it from the examples page):
Java:
public class HelloWorld {
private String hw =3D "Hello World";
public String getHelloWorld() {
return hw;
}
}
PHP:
<?php
java_require('http://192.168.1.128/java/HelloWorld.jar');
$myObj =3D new Java('HelloWorld');
// display Hello World
echo (String) $myObj->getHelloWorld();
?>
However, if I change the Java and PHP to the following, then I get=20
the following exception output:
Hello World
Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke=20
failed: [[o:HelloWorld]]->setHellowWorld([o:PhpParserString]). Cause:=20
java.lang.NoSuchMethodException: setHellowWorld([o:PhpParserString]).=20
Candidates: [] Responsible VM: 1.5.0_11@http://java.sun.com/" at: #-5=20
php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1106) #-4=20
php.java.bridge.Request.handleRequest(Request.java:342) #-3=20
php.java.bridge.Request.handleRequests(Request.java:388) #0 [internal=20
function]: Java->__call('setHellowWorld', Array) #1 /home/jhodapp/
projects/java_bridge/HelloWorld.php(9): Java->setHellowWorld('Hello=20
world, on...') #2 {main}] thrown in /home/jhodapp/projects/
java_bridge/HelloWorld.php on line 9
Changed Java (throws exception):
public class HelloWorld {
private String hw =3D "Hello World";
public String getHelloWorld() {
return hw;
}
public void setHelloWorld(String incoming) {
hw =3D incoming;
}
}
Changed PHP (throws exception):
<?php
java_require('http://192.168.1.128/java/HelloWorld.jar');
$myObj =3D new Java('HelloWorld');
// display Hello World
echo (String) $myObj->getHelloWorld();
$myObj->setHellowWorld((String) "Hello world, once again.");
?>
Once I add my own method in the Java source, it no longer seems to=20
work. I'm compiling this via "javac HelloWorld.java" and making a jar=20
via: "jar cvf HelloWorld.jar HelloWorld.class"
Is there something wrong with my setup? The site seems to be good at=20
helping you get setup with php-java-bridge for your OS environment,=20
but lacks good documentation from that point.
Thanks,
Jim Hodapp
-------------------------------------------------------------------------=
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
|