From: <php...@li...> - 2004-09-27 20:34:26
|
> Hi, > [please excuse the delay] > > I have just checked a fix into the head of the CVS. > Please use this until the next version 1.0.6 is available. > > I have tested your program against the CVS head: > gcj: 3.2.3 > php: 4.3.4 > > gcj -fjni -oJavaBridge.srv \ > --main=JavaBridge \ > php-java-bridge-1.0.5/modules/JavaBridge.class \ > test/gcjtest.java \ > -L`pwd`/php-java-bridge-1.0.5/modules -lnatcJavaBridge > > su -c "killall -9 java; rm /tmp/.php-java-bridge" > > export LD_LIBRARY_PATH=`pwd`/php-java-bridge-1.0.5/modules > > ./JavaBridge.srv /tmp/.php-java-bridge 1 "" & > php test/gcjtest.php > > ==> 48890 yes.. the my original code used a lots of space chars as padding.. but sourceforge's forum engine shrank it to just one space.. thats why the output length is different... the original class was: public class Test { public String test () { StringBuffer sb = new StringBuffer (); for (int i=0;i<10000;i++) { sb.append (i); sb.append (" "); } return sb.toString (); } } so Test.test() outputs 248890 bytes. I just checkout the cvs and tried and the same problem comes up again. now the pattern is a little different though.. the php script runs fine for like 15 times.. then the same exception comes up in JavaBridge.svr console.. and the php output is this: Warning: java.lang.StringIndexOutOfBoundsException in /home/www/test.php on line 31 then I can just run the script again and it will work.. for 2 or 3 times.. then the exception and the warning come up again.. and this pattern is repeated as many time I try the thing. I compiled with -g so the exception is a bit more verbose: java.lang.StringIndexOutOfBoundsException at java.lang.String.charAt(int) (/usr/lib/libgcj.so.4.0.0) at gnu.gcj.convert.Output_8859_1.write(java.lang.String, int, int, char[]) (/usr/lib/libgcj.so.4.0.0) at java.lang.String.getBytes(java.lang.String) (/usr/lib/libgcj.so.4.0.0) at java.lang.String.getBytes() (/usr/lib/libgcj.so.4.0.0) at JavaBridge.setResult(long, long, java.lang.Object) (/home/Downloads/php-java-bridge/cvs/php-java-bridge/server/JavaBridge.java:114) at JavaBridge.Invoke(java.lang.Object, java.lang.String, java.lang.Object[], long, long) (/home/Downloads/php-java-bridge/cvs/php-java-bridge/server/JavaBridge.java:409) at _Jv_CallAnyMethodA(java.lang.Object, java.lang.Class, _Jv_Method, boolean, java.lang.Class[], jvalue, jvalue) (/usr/lib/libgcj.so.4.0.0) at __clone (/lib/tls/libc-2.3.3.so) > Additional notes regarding gcj: > > 1. GCJ cannot currently handle multiple threads accessing the library > via JNI (CNI might work, not tested). So until this gcj bug is fixed, > please start the bridge via dl() and do *not* hard-code the socketname > option. This starts a new server process for each incoming request. ... what this mean exactly? ... apache is multithreaded.. and thus I can have two php scripts running in different threads and being called at the same time.. so they cannot access the same class.method? or cannot use the php-java-bridge lib at once at all? |