Solving this problem requires fixing two interrelated issues.
First, there is no java/Java.inc
file deployed in the original JavaBridge.war. It is generated, which is problematic due to the bug, which you've encountered, that lurks inside java/Java.inc
.
Second, the java/Java.inc
file contains a variable that is incremented before it is initialized.
Fix these issues as follows:
- Download the JavaBridge.war file.
- Extract the
java/Java.inc
file by calling: java -cp JavaBridge.war TestInstallation
, as per the documentation.
- Fix any errors that appear (such as a missing php5-cli).
- Edit
java/Java.inc
.
- Go to line 1994.
- Insert the following code immediately above line 1994:
if( empty($client->cancelProxyCreationTag) ) {
$client->cancelProxyCreationTag = 0;
}
The else
block (lines 1989 to 1998) should resemble:
} else {
$result=clone($client->cachedJavaPrototype);
$result->__factory=$cacheEntry->factory;
$result->__java=++$client->asyncCtx;
$result->__signature=$cacheEntry->signature;
// FIX: initialize variable before it is used.
if( empty($client->cancelProxyCreationTag) ) {
$client->cancelProxyCreationTag = 0;
}
$result->__cancelProxyCreationTag=++$client->cancelProxyCreationTag;
return $result;
Save the file.
Next, re-create the .war file as follows:
- Create a new, empty, temporary directory
- Unzip the original JavaBridge war file into the temporary directory.
- Move the
java
directory into the temporary directory; be sure that it includes the updated Java.inc
file!
- Archive the broken
JavaBridge.war
file.
- Create a new version of the JavaBridge.
For example, this might resemble:
mkdir temp
unzip ../JavaBridge.war
mv ../java .
mv ../JavaBridge.war /tmp
zip -r ../JavaBridge.war *
The problem should be resolved.