|
From: <php...@li...> - 2008-02-04 21:43:36
|
Hi Jost, Thanks for the reply, and sorry for my lack of clarity. > I need to confirm a call to com.dang through Tomcat:8080 without requiring local apache php > load. I am trying to connect my php front-end to my web application in the tomcat backend. I see from the INSTALL.J2EE that I must deploy my "myBackendApp.war", but that the example uses the JavaBridge.jar. I see that I must edit my Java.inc target to reflect this new web context, ie http://127.0.0.1:8080/myBackendApp. Am I to understand that all that is required is the Java.inc in order to access myBackendApp, and that I will not need any deployed JavaBridge.war in order to communicate via the apache php and the tomcat java? Building this particular backend war requires quite a bit of effort, but in addition - much of it includes production-ready deployment scripts, so knowing whether or not I must integrate the JavaBridge into deployment is very important. Thank you for all of your hard work and time, I shall be sure to try and answer some of the posts on the threads as I become more familiar / confident with the package. Thanks again, ~tim |
|
From: <php...@li...> - 2008-02-05 22:19:13
|
Hi Jost, Thanks for the reply, and sorry for my lack of clarity. > I need to confirm a call to com.dang through Tomcat:8080 without requiring local apache php > load. I am trying to connect my php front-end to my web application in the tomcat backend. I see from the INSTALL.J2EE that I must deploy my "myBackendApp.war", and that the example uses the JavaBridge.jar. I see that I must edit my Java.inc target to reflect this new web context, ie http://127.0.0.1:8080/myBackendApp. Am I to understand that all that is required is the Java.inc in order to access myBackendApp, and that I will not need any deployed JavaBridge.war in order to communicate via the apache php and the tomcat java? Building this particular backend war requires quite a bit of effort, but in addition - much of it includes production-ready deployment scripts, so knowing whether or not I must integrate the JavaBridge into deployment is very important. Thank you for all of your hard work and time, I shall be sure to try and answer some of the posts on the threads as I become more familiar / confident with the package. Thanks again, ~tim |
|
From: <php...@li...> - 2008-02-06 11:03:46
|
Hi,
> I am trying to connect my php front-end to my web application in the tomcat backend.
all you need is the PhpJavaServlet in the back end and, if you don't want to call
the back end trough raw PHP fread/fwrite calls, the Java.inc (you can fetch the
Java.inc from the Servlet, or store it locally).
> myBackendApp.war", and that the example uses the
> JavaBridge.jar
It needs JavaBridge.jar and php-servlet.jar and the web.xml which declares the servlet stored
in php-servlet.jar.
You can use the JavaBridge.war as a template; JavaBridge.war is actually just a sample web archive
which contains some PHP examples.
> I will not need any deployed JavaBridge.war
> in order to communicate via the apache php and the tomcat java
Right. Just rename JavaBridge.war to foo.war and change your apache PHP script to
require_once ("http://localhost:8080/foo/java/Java.inc");
:)
> Building this particular backend war requires quite a bit of effort
Just rename JavaBridge.war to myBackendApp.war, add the libraries and/or PHP files you need
to the myBackendApp.war zip archive and you're done.
Note that the Java files are distributed under the MIT License, so you can do whatever you want
with that code.
Regards,
Jost Boekemeier
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go
|
|
From: <php...@li...> - 2008-02-12 20:42:04
|
Hi Jost,
I see the need for JavaBridge.jar and php-servlet.jar (which includes the PhpJavaServlet). I see how it is an example web app, that happens to include the required modules for apache <--> tomcat, as well as a couple of handy files such as test.php.
My JavaBridge.war deployment loads fine, and I can access test.php, as well as settings.php. The JSP's load fine too. The test.php in particular loads, and has all of the java system properties, as well as the "PHP says that Java says: hello PHP from Java!" and php_java_bridge_Util::type()->VERSION
produces 5.0.0 too.
This suggests that it is working fine on Tomcat - however...
The following test.php on apache:
<?php
require_once("http://127.0.0.1:8080/JavaBridge/java/Java.inc");
$System = java("java.lang.System");
echo $System->getProperties();
?>
produces nothing in the page, and::
PHP Warning: require_once(http://127.0.0.1:8080/JavaBridge/java/Java.inc) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: no suitable wrapper could be found in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\test.php on line 2
in the apache error logs.
I am sure I am missing an apache setting, but I have been unable to figure out what.
Please help, thanks so much, and sorry for bothering you with this crap.
~tim
------------------------------
Message: 8
Date: Wed, 6 Feb 2008 12:03:44 +0100 (CET)
From: php...@li...
Subject: Re: [Php-java-bridge-users] bridge setup - missing something
To: php...@li...
Message-ID: <377...@we...>
Content-Type: text/plain; charset=iso-8859-1
Hi,
> I am trying to connect my php front-end to my web application in the tomcat backend.
all you need is the PhpJavaServlet in the back end and, if you don't want to call
the back end trough raw PHP fread/fwrite calls, the Java.inc (you can fetch the
Java.inc from the Servlet, or store it locally).
> myBackendApp.war", and that the example uses the
> JavaBridge.jar
It needs JavaBridge.jar and php-servlet.jar and the web.xml which declares the servlet stored
in php-servlet.jar.
You can use the JavaBridge.war as a template; JavaBridge.war is actually just a sample web archive
which contains some PHP examples.
> I will not need any deployed JavaBridge.war
> in order to communicate via the apache php and the tomcat java
Right. Just rename JavaBridge.war to foo.war and change your apache PHP script to
require_once ("http://localhost:8080/foo/java/Java.inc");
:)
> Building this particular backend war requires quite a bit of effort
Just rename JavaBridge.war to myBackendApp.war, add the libraries and/or PHP files you need
to the myBackendApp.war zip archive and you're done.
Note that the Java files are distributed under the MIT License, so you can do whatever you want
with that code.
Regards,
Jost Boekemeier
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go
|
|
From: <php...@li...> - 2008-02-12 23:11:43
|
I think I got it, but I am still having some trouble getting at my custom java classes.
Despite apache / tomcat being on the same server, it seems promiscuous needs to be on, as well as allow_url_include.
So now I can load the Java.inc via:
require_once("http://192.168.15.62:8080/JavaBridge/java/Java.inc");
But now, I cannot get java_require or java_autoload to get at my classes packaged within my web app.
Do I have to serve up the jar and reference it something like this?
java_require("http://localhost:8080/JavaBridge/myapp.jar");
As I understand it, simply using java_require("myapp.jar") should be able to resolve correctly, considering the context of the Java.inc being within the JavaBridge web app. In other words, if indeed the Java.inc is setup correctly within the JavaBridge web app, by just doing java_require("myapp.jar"), the PhpJavaServlet will be called upon to load up that class from within its local lib, no?
I am almost there!!
Thanks again,
~tim
Message: 8
Date: Tue, 12 Feb 2008 15:41:42 -0500
From: php...@li...
Subject: Re: [Php-java-bridge-users] bridge setup - missing something
To: <php...@li...>
Message-ID: <4BE...@EV...>
Content-Type: text/plain; charset="iso-8859-1"
Hi Jost,
I see the need for JavaBridge.jar and php-servlet.jar (which includes the PhpJavaServlet). I see how it is an example web app, that happens to include the required modules for apache <--> tomcat, as well as a couple of handy files such as test.php.
My JavaBridge.war deployment loads fine, and I can access test.php, as well as settings.php. The JSP's load fine too. The test.php in particular loads, and has all of the java system properties, as well as the "PHP says that Java says: hello PHP from Java!" and php_java_bridge_Util::type()->VERSION
produces 5.0.0 too.
This suggests that it is working fine on Tomcat - however...
The following test.php on apache:
<?php
require_once("http://127.0.0.1:8080/JavaBridge/java/Java.inc");
$System = java("java.lang.System");
echo $System->getProperties();
?>
produces nothing in the page, and::
PHP Warning: require_once(http://127.0.0.1:8080/JavaBridge/java/Java.inc) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: no suitable wrapper could be found in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\test.php on line 2
in the apache error logs.
I am sure I am missing an apache setting, but I have been unable to figure out what.
Please help, thanks so much, and sorry for bothering you with this crap.
~tim
|
|
From: <php...@li...> - 2008-02-13 09:17:24
|
> Despite apache / tomcat being on the same server, it seems promiscuous needs to be on, as well > as allow_url_include. yes, this is documented, I think. :) See also: http://www.ibm.com/developerworks/aix/library/au-javaphpaix5/ > But now, I cannot get java_require or java_autoload to get at my classes packaged within my web > app. Isn't it possible to copy all your libraries to WEB-INF/lib? Basically users should be able to install the bridge with 3 simple steps: 1. Rename JavaBridge.war to myApp.war and add all needed Java and PHP libraries to the myApp.war 2. Copy myApp.war to the J2EE autodeploy folder, wait until the directory myApp appears 3. Copy the directory myApp over to the Apache or IIS document root 4. Browse to http://yourHost.com/myApp and run the PHP/Java applications. Jetzt Mails schnell in einem Vorschaufenster überfliegen. Dies und viel mehr bietet das neue Yahoo! Mail - www.yahoo.de/mail |
|
From: <php...@li...> - 2008-02-13 18:53:42
|
Hi,
> Despite apache / tomcat being on the same server, it seems promiscuous needs to be on, as well
> as allow_url_include.
>
> So now I can load the Java.inc via:
>
> require_once("http://192.168.15.62:8080/JavaBridge/java/Java.inc");
The IP is interesting. However, if you want to connect to a back end running on any other
interface than 127.0.0.1, you need to switch on promiscuous mode, even if 192.168.15.62 resolve to
a local address. If you have disabled the loopback interface, please enable it. It is considerably
faster. (In promiscuous mode the bridge switches off named pipe communication, furthermore some OS
switch on Nagle's algorithm if the communication goes through a real network interface).
> But now, I cannot get java_require or java_autoload to get at my classes packaged within my web
> app.
java_require ("foo.jar") is equivalent to:
$here=getcwd(); java_require("$here/foo.jar");
Otherwise you must use an absolute path or even a URL, for example:
java_autoload("file:///c:/foo.jar;http://php-java-bridge.sf.net/baz.jar");
> java_require("http://localhost:8080/JavaBridge/myapp.jar");
Yes, this will work. Since version 4.1.0 the bridge copies
http://localhost:8080/JavaBridge/myapp.jar to file:/{java.io.tempdir}/myapp.jar and rewrites the
URL to use the local file instead.
> As I understand it, simply using java_require("myapp.jar") should be able to resolve correctly,
> considering the context of the Java.inc being within the JavaBridge web app.
The bridge tries to load myapp.jar from 1) /usr/share/java, 2) from $HOME/lib/ and 3) from
getcwd()/
Regards,
Jost Boekemeier
Heute schon einen Blick in die Zukunft von E-Mails wagen? Versuchen Sie´s mit dem neuen
Yahoo! Mail. www.yahoo.de/mail
Machen Sie Yahoo! zu Ihrer Startseite. Los geht's:
http://de.yahoo.com/set
|
|
From: <php...@li...> - 2008-02-14 23:13:39
|
Hi Jost,
Thanks for your reply. It is certainly possible to copy all of my libraries to WEB-INF/lib. Infact this has been my behavior once I was able to finally package up myapp.jar (a huge pain - not the jar -cvf etc, but the silly java app I am trying to consolidate here).
So with that in mind, I was unaware that myapp (the web app instance of java) needed to be deployed on the "local" apache document root as well. It was my understanding that loading a library via:
java_require("myapp.jar");
would load the java from the Tomcat instance - and then any calls to such classes would of course execute there. Like I say - I have done that - but the java_require / autoload still fails.
For number 3, you indicate copying "myapp" to the apache root, does myapp in that case mean the exploded war, or rather just the PHP myapp - which contains no java binary?
Sorry for the confusion man, I did not get the impression from any documentation that the myapp.jar (in any form) had to be deployed on the apache doc root (or any where else in the apache context) as well.
Thanks,
~tim
> Despite apache / tomcat being on the same server, it seems promiscuous needs to be on, as well
> as allow_url_include.
yes, this is documented, I think. :)
See also: http://www.ibm.com/developerworks/aix/library/au-javaphpaix5/
> But now, I cannot get java_require or java_autoload to get at my classes packaged within my web
> app.
Isn't it possible to copy all your libraries to WEB-INF/lib?
Basically users should be able to install the bridge with 3 simple steps:
1. Rename JavaBridge.war to myApp.war and add all needed Java and PHP libraries to the
myApp.war
2. Copy myApp.war to the J2EE autodeploy folder, wait until the directory myApp appears
3. Copy the directory myApp over to the Apache or IIS document root
4. Browse to http://yourHost.com/myApp and run the PHP/Java applications.
|
|
From: <php...@li...> - 2008-02-15 10:02:56
|
Hi,
> So with that in mind, I was unaware that myapp (the web app instance of java) needed to be
> deployed on the "local" apache document root as well.
unless the PHP option allow_url_include is set to on, php can only access local files.
> would load the java from the Tomcat instance - and then any calls to such classes would of
> course execute there. Like I say - I have done that - but the java_require / autoload still
> fails.
Although there's nothing wrong with the dynamic loader per se, I'd like to remove it in one
of the next releases. I want to get rid of the class loading problems. If Java users have
(the usual) class loading issues, they should contact their AS vendor, not us.
> For number 3, you indicate copying "myapp" to the apache root, does myapp in that case mean the
> exploded war
The directory which contains the myapp web application, yes.
Regards,
Jost Boekemeier
E-Mails jetzt auf Ihrem Handy.
www.yahoo.de/go
|
|
From: <php...@li...> - 2008-02-20 06:19:59
|
Hi Jost, I have done exactly this: >Basically users should be able to install the bridge with 3 simple steps: > >1. Rename JavaBridge.war to myApp.war and add all needed Java and PHP libraries to the > myApp.war > >2. Copy myApp.war to the J2EE autodeploy folder, wait until the directory myApp appears > >3. Copy the directory myApp over to the Apache or IIS document root > >4. Browse to http://yourHost.com/myApp and run the PHP/Java applications. my test.php is like this: <?php echo $_SERVER['SERVER_PORT']."\n"; require_once("http://192.168.15.62:8080/myApp/java/Java.inc"); java_require("Test.jar"); $system = java("java.lang.System"); echo " OS: ".$system->getProperty("os.name")."\n"; $test = java("Test"); echo "plz work \n"; ?> I am trying to run the test.php on apache and the log is this: [Wed Feb 20 01:07:06 2008] [error] [client 192.168.15.62] PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[o:JavaBridge]]->updateJarLibraryPath((o:String)[o:String], (o:String)[o:String], (o:String)[o:String], (o:String)[o:String]). Cause: java.io.IOException: Could not open jar file Test.jar, reason: The system cannot find the file specified Responsible VM: 1.5.0_09@http://java.sun.com/" at:\n#-30 php.java.bridge.DynamicJavaBridgeClassLoader.checkJarFile(DynamicJavaBridgeClassLoader.java:108)\n#-29 php.java.bridge.JarLibraryPath.createUrls(JarLibraryPath.java:193)\n#-28 php.java.bridge.JarLibraryPath.checkURLs(JarLibraryPath.java:118)\n#0 http://192.168.15.62:8080/myApp/java/Java.inc(259): java_ThrowExceptionProxyFactory->getProxy(1, NULL, true)\n#1 http://192.168.15.62:8080/myApp/java/Java.inc(409): java_Arg->getResult(true)\n#2 http://192.168.15.62:8080/myApp/java/Java.inc(415): java_Client->getWrappedResult(true)\n#3 http://192.168.15.62:8080/myApp/java/Java.inc(619): java_Client->getResult()\n#4 http://192.168.15.62:8080/myApp/java/Java.inc(1609): java_Cl in http://192.168.15.62:8080/myApp/java/Java.inc on line 222 before the deployment of the JavaBridge would at least produce the default set of test / example pages but now trying to get at the 192.168.15.62:8080/myApp just hangs - with this at the end of the log Feb 19, 2008 11:19:08 PM org.apache.catalina.core.ApplicationContext log INFO: f892a4@70be88 --> <S v="#0 http://192.168.15.62:8080/myApp/java/Java.inc(259): java_ThrowExceptionProxyFactory->getProxy(1, NULL, true) #1 http://192.168.15.62:8080/myApp/java/Java.inc(409): java_Arg->getResult(true) #2 http://192.168.15.62:8080/myApp/java/Java.inc(415): java_Client->getWrappedResult(true) #3 http://192.168.15.62:8080/myApp/java/Java.inc(619): java_Client->getResult() #4 http://192.168.15.62:8080/myApp/java/Java.inc(1609): java_Client->invokeMethod(0, 'updateJarLibrar...', Array) #5 C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\myApp\test.php(7): java_require('Test.jar') #6 {main}" /> Feb 19, 2008 11:19:08 PM org.apache.catalina.core.ApplicationContext log INFO: f892a4@70be88 --> </Y> Feb 19, 2008 11:19:08 PM org.apache.catalina.core.ApplicationContext log INFO: f892a4@70be88 <-- <S v="W1tvOkV4Y2VwdGlvbl06ImphdmEubGFuZy5FeGNlcHRpb246IEludm9rZSBmYWlsZWQ6IFtbbzpK YXZhQnJpZGdlXV0tPnVwZGF0ZUphckxpYnJhcnlQYXRoKChvOlN0cmluZylbbzpTdHJpbmddLCAo bzpTdHJpbmcpW286U3RyaW5nXSwgKG86U3RyaW5nKVtvOlN0cmluZ10sIChvOlN0cmluZylbbzpT dHJpbmddKS4gQ2F1c2U... i have tried exact as you said - and a whole lot more, i love php AND java and i really need this to work! plz more help :( ~tim |
|
From: <php...@li...> - 2008-02-20 10:39:26
|
Hi,
> java_require("Test.jar");
please do not use java_require(). Please use the standard procedures that your application
server or servlet engine offers.
Please read the documentation of your servlet engine or J2EE application server for details.
-- I'm sorry, but we cannot give you any advice how do deploy your libraries because each VM
and each AS has its own mechanism; on .NET you simply copy the dll files to the GAC, on Tomcat
you can copy some libraries, (but not log4j.jar for example!, see the tomcat RELEASE_NOTES), to
WEB-INF/lib. On WebLogic you can deploy jdbc drivers and other libraries by using a web interface.
If you have further questions concerning Java class loading, please contact your J2EE AS vendor or
please contact the tomcat mailing list.
> (o:String)[o:String], (o:String)[o:String]). Cause: java.io.IOException: Could not open jar file
> Test.jar, reason: The system cannot find the file specified Responsible VM:
The above message means that getcwd()/Test.jar nor java.home/lib/Test.jar nor
/usr/share/java/Test.jar exists or is accessible.
Regards,
Jost Boekemeier
Heute schon einen Blick in die Zukunft von E-Mails wagen? Versuchen Sie´s mit dem neuen Yahoo! Mail. www.yahoo.de/mail
|