|
From: <php...@li...> - 2008-11-07 16:53:08
|
Hello! We are running an Ubuntu 8.04 server with a backend daemon program written in PHP that uses the PHP-Java-Bridge v5.3.2.1.2 for communicating with an external Java API. When we attempt to call up the PHP-Java-Bridge, we are at seemingly random, frequent intervals greeted by a friendly die() coming from line 784 in the Java.inc-file. The error message is: "Protocol error; , Invalid document end at col 10. Check the back end log for details." Sadly, I do not know where to find the back end log. The problem seems to be related to the error described in this previous thread: http://sourceforge.net/mailarchive/forum.php?thread_name=48B6FC13.4030406%40federatedmedia.net&forum_name=php-java-bridge-users Like in the above thread, the error seems to spring up merely by doing require_once("http://localhost:8080/JavaBridge/java/Java.inc"); .. which we do in a single place only when we need to communicate with the external Java API. Since in our case, the program calling JavaBridge functions is a single-threaded backend program, I do not believe that the problem of running out of threads should be an issue. We have tried running the JavaBridge both as a Tomcat web app (using Tomcat 6.x and Java/Sun 1.5.0_15) and as standalone: java -jar JavaBridge.jar SERVLET_LOCAL:8080 3 /var/log/javabridge.log The problem is there in both cases. In addition, even though the log file is specified explicitly in the standalone case, there are no error messages to be had there.. Any clues about how to resolve this problem? At the moment, our whole backend is crashing quite resolutely due to this issue. Best regards, Johannes Staffans itCampus GmbH |
|
From: <php...@li...> - 2008-11-07 18:36:43
|
Hi, > seemingly random, frequent intervals greeted by a friendly > "Protocol error; , Invalid document end at col 10. > Check the back end log for details." Can you please open a ticket (please use http://sourceforge.net/tracker/?func=add&group_id=117793&atid=679233), set the log level to 4 or above and attach the log at the end of the ticket? Please start tomcat with the option -Dphp.java.bridge.default_log_level=4 JAVA_OPTS=-Dphp.java.bridge.default_log_level=4 /opt/tomcat/catalina.sh run > Sadly, I do not know where to find the back end log. Unless you have log4j ("chainsaw") running, errors appear in the tomcat log file. Look for OutOfMemoryErrors or something. > The problem seems to be related to the error described in > this previous thread: No. The protocol error mentioned there was caused by "GNU Java", a buggy "Java" implementation which was popular until Sun has released Java as open source. > The problem is there in both cases. In addition, even > though the log file is specified explicitly in the > standalone case, there are no error messages to be had > there.. Well, over a year ago I have committed a change which suppresses all exceptions on default_log_level <= 3. Since the bridge code was mature I didn't think this may become an issue. However, the trace is still useful when a broken Java implementation is used or the back end reflects bugs in PHP itself (see http://bugs.php.net/bug.php?id=46451, which translates into a NullPointerException in the back end and a connection abort). > Any clues about how to resolve this problem? The communication failure can be caused by System.exit() as well as by a OutOfMemoryError. The details will be in the log file; we'll see. Regards, Jost Boekemeier |
|
From: <php...@li...> - 2008-11-13 11:07:17
|
Just a quick update on this issue: >> seemingly random, frequent intervals greeted by a friendly >> "Protocol error; , Invalid document end at col 10. >> Check the back end log for details." > Can you please open a ticket (please use http://sourceforge.net/tracker/?func=add&group_id=117793&atid=679233), > set the log level to 4 or above and attach the log at the end of the ticket? > Please start tomcat with the option -Dphp.java.bridge.default_log_level=4 > JAVA_OPTS=-Dphp.java.bridge.default_log_level=4 /opt/tomcat/catalina.sh run We are currently doing this, but in the last several days, the error has not reappeared. Maybe setting log_level to 4 fixes it :-) I will return to this issue when we have more information. For the time being, we are getting another error for which I am opening a new thread. Best regards, Johannes Staffans itCampus GmbH |
|
From: <php...@li...> - 2008-11-13 19:23:13
|
Hi,
please see my other mail which explains the problem.
Until version 5.3.3 is released please add a java() dummy statement to your script:
java(...)
// workaround for a 5.3.2 bug which must execute the second java statement within 30 seconds
java(...)
wait(...)
java(...)
...
However, I am curious why the wait() for more than 30 seconds is necessary?
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2008-11-13 21:23:13
|
Hi,
to fix this problem please add the following line to your Java.inc (or Protocol.inc):
$this->protocol->handler = $this->protocol->socketHandler;
+ $this->protocol->flush(); // don't wait for the next statement
}
This fix will be in PHP/Java Bridge version 5.3.3.
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2008-11-14 09:23:39
|
Hello!
Thanks for your reply and your explanation of the problem. We are looking forward to 5.3.3 :-)
> java(...)
> // workaround for a 5.3.2 bug which must execute the second java statement within 30 seconds
> java(...)
> wait(...)
> java(...)
> However, I am curious why the wait() for more than 30 seconds is necessary?
I can think of two possible explanations in our current setup.
Firstly, we are making use of the JavaBridge in a backend daemon PHP script which runs indefinitely polling a message queue at regular intervals. Handling a message usually involves making one or more java()-calls. The interval between java()-calls is therefore dependent on the message frequency. Using PHP for this kind of backend business logic is of course a rather bad idea, but having to work with an existing architecture, we don't really have an option.
Maybe this issue could be resolved on the user level by flushing the JavaBridge somehow before the daemon goes back to sleep waiting for its next message?
Secondly, the external Java API which we are calling using the JavaBridge is at times very, very slow (response times of up to several minutes). For example:
function getExternalObjectName($externalObjectId)
{
$externalObject = java('...')->getObject($externalObjectId);
// the script stalls for one minute waiting for the above call to finish
return java_values($externalObject->getName());
}
Best regards,
Johannes Staffans
itCampus GmbH
|
|
From: <php...@li...> - 2008-11-14 11:42:56
|
Hi, the current download already contains the fix: => http://downloads.sourceforge.net/php-java-bridge/php-java-bridge_5.3.3_j2ee.zip?use_mirror= Regards, Jost Bökemeier |