PDA

View Full Version : Quercus with WARs (and JARs)


sidmeister
11-04-2009, 07:46 AM
Hi,

I am investigating the possibility of migrating from PHP/Java Bridge to Quercus for our organisation's web app, and was having some trouble. I do apologise if these questions have appeared previously on the forum, or if I missed something obvious in the documentation.

My questions are:

1. With PHP/Java bridge, I serve the Java libraries as a JAR bound up in a WAR deployed on an AS. I have deployed the same WAR on to Resin, but I unfortunately cannot call the package in the WAR using PHP. When I try to do so, I get the error that the package wasn't found.

2. As I found that Quercus expects packages to be deployed as JARs within the quercus webapp, I deployed the JAR and tried to create an object. This time around, I did not get any errors but the object itself was null, according to the var_dump function, i.e.:
<?
$x = new Java("path.to.my.package",$arg1, $arg2, $arg3);
var_dump($x);
?>

The output produced was:
resource(null)

I was wondering if any body could point me in the right direction to get external Java libraries working on Quercus (other than by using WebBeans).

I look forward to hearing from y'all! Thanks a million!!

sidmeister
11-04-2009, 08:13 AM
I am investigating migration from PHP/Java Bridge to Quercus at my organisation, but was having some trouble. I apologise if this is a duplicate thread, but I could not find any other thread that dealt with this (and the previous thread I just posted myself seems to have disappeared into ether :) ). Anyway here goes:

1. When using PHP/Java bridge, I deploy the Java libraries I require our PHP code to use as JARs packaged within a WAR. The WAR resides on an AS. I tried to get a PHP file in the quercus WAR to call the packages in another WAR that I had also deployed in Resin:
$x = new Java("path.to.my.package",$arg1, $arg2, $arg3);

However, Quercus failed to find the packages I was referring to, giving me the error:
Fatal Error: 'path.to.my.package' class definition not found C:\resin\webapps\quercus\xxx.php:85: Warning: com.caucho.quercus.QuercusErrorException:

I was wondering if there was some way I could get Quercus to look at these.

2. I tried deploying the same JAR into the Quercus WEB-INF/lib directory. This time, I did not get a fatal error, but a var_dump produced a null value.

I would like to use classes which do not extend a Quercus class (as some examples I found on the web show), as these classes are also used by a desktop application. Would somebody be able to advise me as to how I can get this working (without producing WebBeans)? Or do i have to use WebBeans?

Thanks a lot for your patience, and look forward to hearing from you!

emil
11-04-2009, 04:41 PM
1. When using PHP/Java bridge, I deploy the Java libraries I require our PHP code to use as JARs packaged within a WAR. The WAR resides on an AS. I tried to get a PHP file in the quercus WAR to call the packages in another WAR that I had also deployed in Resin:
$x = new Java("path.to.my.package",$arg1, $arg2, $arg3);

Classes deployed in separate .wars are isolated from each other to avoid conflicts. You'll need to have the classes deployed to each war (webapp) for them to be visible to the PHP application.

2. I tried deploying the same JAR into the Quercus WEB-INF/lib directory. This time, I did not get a fatal error, but a var_dump produced a null value.

I would like to use classes which do not extend a Quercus class (as some examples I found on the web show), as these classes are also used by a desktop application. Would somebody be able to advise me as to how I can get this working (without producing WebBeans)? Or do i have to use WebBeans?

Try turning on fine level logging to see what happened with the constructor. It's possible that one of the arguments was incorrect or that the constructor itself failed.

Emil

sidmeister
11-12-2009, 11:04 AM
Dear Emil,

Thank you very much for clarifying the bit about multiple WARs. Re. the JAR, it was my own stupidity, I do apologise. There was a wee error in the PHP file which arose when I moved ito ver from PHP JavaBridge.

Thanks for pointing me in the right direction.