From: <php...@li...> - 2007-03-16 15:51:52
|
Hi there, I' just downloaded and installed php/java bridge on a RH4, Apache 2.0, PHP 5.1.4 environment and I'm trying to make it work. I just tried with a short script and I'm getting troubles to make it work. I'd appreciate any help. This is my java file: class Test { public Test () { System.out.println("Hi, Im the constructor"); } public String saySth () { return "Something stupid"; } public static void main (String[] args) { System.out.println("This is the main"); System.exit(0); } } I compiled it with javac and made the Test.jar file. I tried putting the jar file on: - /usr/local/apache2/htdocs/tests_java/ =DF my document root - /usr/shared/java/ I even added the first path to mi CLASSPATH environment variable using php'= s putenv function. Nothing seems to work. This is my PHP file: <? $CLASSPATH =3D getenv('CLASSPATH'); echo "LA ORIGINAL: <br>"; echo $CLASSPATH; echo "AGREGO EL PATH <br>"; $CLASSPATH .=3D ":/usr/local/apache2/htdocs/tests_java/test.jar"; putenv("CLASSPATH=3D".$CLASSPATH); $CLASSPATH =3D getenv('CLASSPATH'); echo "LA POSTA: <br>"; echo $CLASSPATH; @java_reset(); echo "<p><strong>Ejemplos de por ahi con clases propias de JAVA: </strong></p>"; // get instance of Java class java.lang.System in PHP $system =3D new Java('java.lang.System'); // demonstrate property access echo 'Java version=3D' . $system->getProperty('java.version') . '<br />'; echo 'Java vendor=3D' . $system->getProperty('java.vendor') . '<br />'; echo 'OS=3D' . $system->getProperty('os.name') . ' ' . $system->getProperty('os.version') . ' on ' . $system->getProperty('os.arch') . ' <br />'; // java.util.Date example $formatter =3D new Java('java.text.SimpleDateFormat', "EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz"); echo java_values($formatter->format(new Java('java.util.Date'))); @java_reset(); echo "<p><strong>Gusto? Bueno, aca viene lo complicado... levantar MI clase</strong><p>"; try { java_require("http://172.16.0.75/tests_java/Test.jar"); }catch (JavaException $e) { if ($ex =3D java_last_exception_get()) { echo "<strong>JAVA EXCEPTION: NO PUDE LEVANTAR EL JAR </strong><br />"; echo java_values($ex->getMessage())."<br />"; } } try { $o =3D new Java("Test"); echo (string) $o->saySth(); } catch (JavaException $e) { if($ex=3Djava_last_exception_get()) { echo "<strong>JAVA EXCEPTION: </strong><br />"; echo java_values($ex->getMessage())."<br />"; } } @java_reset(); echo "<p><strong>A ver que pasa con IpuConfig</strong></p>"; try { $o =3D new Java("com.intraway.framework.IpuConfig"); $o->showXML(); } catch (JavaException $e) { if($ex =3D java_last_exception_get()) { echo "<strong>JAVA EXCEPTION: </strong><br />"; echo java_values($ex->getMessage())."<br />"; } } @java_reset(); ?> When I open that on my browser I get this: LA ORIGINAL: .:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/bin:/usr/= local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss- 4.0.1/client/jboss- client.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/= jboss-4.0.1/client/jboss-common-client.jar:/usr/local/apache2/htdocs/Intraw= ayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/jboss-j2ee.jar:/usr/loca= l/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/j= np-client.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-= um/jboss-4.0.1/client/log4j.jar:/usr/local/apache2/htdocs/IntrawayWS/client= s/ip-unity/mereon-um/jboss-4.0.1/client/jaas.jar:/usr/local/apache2/htdocs/= IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/jbosssx-client.jar= :/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.= 1/client/jboss-transaction-client.jar:/usr/local/apache2/htdocs/IntrawayWS/= clients/ip-unity/mereon-um/jboss-4.0.1/client/jbossall-client.jar:/usr/loca= l/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/= UM-MP_WEB-3_1_5_1-0005_webmail_classes.jar:/usr/local/apache2/htdocs/Intraw= ayWS/clients/ip-unity/mereon-um/ipunity_web_classes/ipucommon.jar:/usr/loca= l/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/= mailAdmin.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-= um/ipunity_web_classes/mail.jar:/usr/local/apache2/htdocs/IntrawayWS/client= s/ip-unity/mereon-um/ipunity_web_classes/um.jar:/usr/local/apache2/htdocs/I= ntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/ipunity_fw.jar:/us= r/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_cl= asses/ipunity_api.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity= /mereon-um/ipunity_web_classes/classes12.jar:/usr/local/apache2/htdocs/Intr= awayWS/clients/ip-unity/mereon-um/ipunity_web_classes/activation.jar:/usr/l= ocal/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_class= es/servlet.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon= -um/ipunity_web_classes/xalan.jar:/usr/local/apache2/htdocs/IntrawayWS/clie= nts/ip-unity/mereon-um/ipunity_web_classes/jazzy-core.jar:/usr/local/apache= 2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/conf:/opt/oracle/product/10.= 2.0/jdbc/lib/classes12.zip:.:/usr/local/apache2/htdocs/IntrawayWS/clients/i= p-unity/mereon-um/bin:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity= /mereon-um/jboss-4.0.1/client/jboss-client.jar:/usr/local/apache2/htdocs/In= trawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/jboss-common-client.= jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4= .0.1/client/jboss-j2ee.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-= unity/mereon-um/jboss-4.0.1/client/jnp-client.jar:/usr/local/apache2/htdocs= /IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/log4j.jar:/usr/lo= cal/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client= /jaas.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/j= boss-4.0.1/client/jbosssx-client.jar:/usr/local/apache2/htdocs/IntrawayWS/c= lients/ip-unity/mereon-um/jboss-4.0.1/client/jboss-transaction-client.jar:/= usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/= client/jbossall-client.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-= unity/mereon-um/ipunity_web_classes/UM-MP_WEB-3_1_5_1-0005_webmail_classes.= jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity= _web_classes/ipucommon.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-= unity/mereon-um/ipunity_web_classes/mailAdmin.jar:/usr/local/apache2/htdocs= /IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/mail.jar:/usr/lo= cal/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classe= s/um.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ip= unity_web_classes/ipunity_fw.jar:/usr/local/apache2/htdocs/IntrawayWS/clien= ts/ip-unity/mereon-um/ipunity_web_classes/ipunity_api.jar:/usr/local/apache= 2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/classes1= 2.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipuni= ty_web_classes/activation.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/= ip-unity/mereon-um/ipunity_web_classes/servlet.jar:/usr/local/apache2/htdoc= s/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/xalan.jar:/usr/= local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_clas= ses/jazzy-core.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/me= reon-um/conf:/opt/oracle/product/10.2.0/jdbc/lib/classes12.zipAGREGOEL PATH LA POSTA: .:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/bin:/usr/= local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss- 4.0.1/client/jboss- client.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/= jboss-4.0.1/client/jboss-common-client.jar:/usr/local/apache2/htdocs/Intraw= ayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/jboss-j2ee.jar:/usr/loca= l/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/j= np-client.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-= um/jboss-4.0.1/client/log4j.jar:/usr/local/apache2/htdocs/IntrawayWS/client= s/ip-unity/mereon-um/jboss-4.0.1/client/jaas.jar:/usr/local/apache2/htdocs/= IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/jbosssx-client.jar= :/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.= 1/client/jboss-transaction-client.jar:/usr/local/apache2/htdocs/IntrawayWS/= clients/ip-unity/mereon-um/jboss-4.0.1/client/jbossall-client.jar:/usr/loca= l/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/= UM-MP_WEB-3_1_5_1-0005_webmail_classes.jar:/usr/local/apache2/htdocs/Intraw= ayWS/clients/ip-unity/mereon-um/ipunity_web_classes/ipucommon.jar:/usr/loca= l/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/= mailAdmin.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-= um/ipunity_web_classes/mail.jar:/usr/local/apache2/htdocs/IntrawayWS/client= s/ip-unity/mereon-um/ipunity_web_classes/um.jar:/usr/local/apache2/htdocs/I= ntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/ipunity_fw.jar:/us= r/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_cl= asses/ipunity_api.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity= /mereon-um/ipunity_web_classes/classes12.jar:/usr/local/apache2/htdocs/Intr= awayWS/clients/ip-unity/mereon-um/ipunity_web_classes/activation.jar:/usr/l= ocal/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_class= es/servlet.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon= -um/ipunity_web_classes/xalan.jar:/usr/local/apache2/htdocs/IntrawayWS/clie= nts/ip-unity/mereon-um/ipunity_web_classes/jazzy-core.jar:/usr/local/apache= 2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/conf:/opt/oracle/product/10.= 2.0/jdbc/lib/classes12.zip:.:/usr/local/apache2/htdocs/IntrawayWS/clients/i= p-unity/mereon-um/bin:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity= /mereon-um/jboss-4.0.1/client/jboss-client.jar:/usr/local/apache2/htdocs/In= trawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/jboss-common-client.= jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4= .0.1/client/jboss-j2ee.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-= unity/mereon-um/jboss-4.0.1/client/jnp-client.jar:/usr/local/apache2/htdocs= /IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client/log4j.jar:/usr/lo= cal/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/client= /jaas.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/j= boss-4.0.1/client/jbosssx-client.jar:/usr/local/apache2/htdocs/IntrawayWS/c= lients/ip-unity/mereon-um/jboss-4.0.1/client/jboss-transaction-client.jar:/= usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/jboss-4.0.1/= client/jbossall-client.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-= unity/mereon-um/ipunity_web_classes/UM-MP_WEB-3_1_5_1-0005_webmail_classes.= jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity= _web_classes/ipucommon.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-= unity/mereon-um/ipunity_web_classes/mailAdmin.jar:/usr/local/apache2/htdocs= /IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/mail.jar:/usr/lo= cal/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classe= s/um.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ip= unity_web_classes/ipunity_fw.jar:/usr/local/apache2/htdocs/IntrawayWS/clien= ts/ip-unity/mereon-um/ipunity_web_classes/ipunity_api.jar:/usr/local/apache= 2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/classes1= 2.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipuni= ty_web_classes/activation.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/= ip-unity/mereon-um/ipunity_web_classes/servlet.jar:/usr/local/apache2/htdoc= s/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_classes/xalan.jar:/usr/= local/apache2/htdocs/IntrawayWS/clients/ip-unity/mereon-um/ipunity_web_clas= ses/jazzy-core.jar:/usr/local/apache2/htdocs/IntrawayWS/clients/ip-unity/me= reon-um/conf:/opt/oracle/product/10.2.0/jdbc/lib/classes12.zip:/usr/local/a= pache2/htdocs/tests_java/test.jar *Ejemplos de por ahi con clases propias de JAVA: * Java version=3D3.4.3 Java vendor=3DFree Software Foundation, Inc. OS=3DLinux 2.6.9-5.EL on i686 Friday, March 16, 2007 at 12:28:45 PM GMT-03:00 *Gusto? Bueno, aca viene lo complicado... levantar MI clase* *JAVA EXCEPTION: * CreateInstance failed: new Test. Cause: java.lang.ClassNotFoundException: Test Responsible VM: 3.4.3@http://gcc.gnu.org/java/ *A ver que pasa con IpuConfig* *JAVA EXCEPTION: * CreateInstance failed: new com.intraway.framework.IpuConfig. Cause: java.lang.ClassNotFoundException: com.intraway.framework.IpuConfigResponsible VM: 3.4.3@http://gcc.gnu.org/java/ So=85 the extension works fine. I can use java's own classes, but the probl= em comes when I want to use my own. I'm not much of a Java programmer but I've been working with PHP for quite = a long time now. Could you give me any hint on how to get this to work? Thanx Andr=E9s Gattinoni |
From: <php...@li...> - 2007-03-17 11:39:29
|
Hi, which problems do you have with the PHP/Java Bridge? > java.lang.ClassNotFoundException: > com.intraway.framework.IpuConfigResponsible Well, just locate the Java library which exports the above class and then require it and its dependencies using the java require syntax. > VM: 3.4.3@http://gcc.gnu.org/java/ Also check if you Java VM can interpret the Java library (GNU java is not fully compatible with Java 1.4). If not, switch to IBM or Sun Java. In any case, please do not use @java_reset(), the CLASSPATH. In which documentation have you found this? Also it should never ever be necessary to create a wrapper Java library. The PHP/Java Bridge protocol is efficient enough so that these wrappers are *entirely* obsolete. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
From: <php...@li...> - 2007-03-17 18:10:02
|
Hi, first of all, thanks a lot for your help. which problems do you have with the PHP/Java Bridge? I think the most important problem I'm having is importing my libraries. For example, with the easiest exacmple I tried to use (my class Test), I don't understand how should I import the jar file that I made. I tried using for example: java_require("file://usr/local/apache2/htdocs/tests_java/Test.jar"); java_require("http://localhost/tests_java/Test.jar"); java_require("http://172.16.0.75/tests_java/Test.jar"); java_require("Test.jar"); And none of them seemed to work. Which would be the most appropiate way? > > > > VM: 3.4.3@http://gcc.gnu.org/java/ Where should I define the VM that php/java bridge will work with? I actually installed the Java J2SE JDK from Sun on my box on /opt/jdk_ ... and that path is the one I set on the java.ini file. In any case, please do not use @java_reset(), the > CLASSPATH. In which documentation have you found this? > > Also it should never ever be necessary to create a > wrapper Java library. The PHP/Java Bridge protocol is > efficient enough so that these wrappers are *entirely* > obsolete. Ok, I'll remove the java_reset() calls. I read about php/java bridge in man= y places and tried to 'mix' the examples I got. I shouldn't touch the CLASSPATH, right? I'm not sure about what you mean when you say wrappers. Thanks for your support. Regards, Andr=E9s Gattinoni |
From: <php...@li...> - 2007-03-18 16:14:06
|
Hi Andrés, >java_require("file://usr/local/apache2/htdocs/tests_java/Test.jar"); > java_require("http://localhost/tests_java/Test.jar"); > java_require("http://172.16.0.75/tests_java/Test.jar"); > java_require("Test.jar"); > > And none of them seemed to work. All of the above examples should work. Which error message do you get? Note that most modern Linux systems come with Security Enhanced Linux enabled. This means that the folders tests_java, DOCUMENT_ROOT/tests_java and htdocs must be tagged appropriately. Furthermore the back end runs in a sand box which can only access files and directories which belong to httpd (or the "apache" user on RedHat linux). Please see the readme the documentation on php-java-bridge.sf.net for details. > Which would be the most appropiate way? Copy Test.jar into {php.java.bridge.base}/lib and use java_require("Test.jar"); If you have installed from RPM, this directory is tagged as lib_t and has the correct permissions. > > > VM: 3.4.3@http://gcc.gnu.org/java/ > > Where should I define the VM that php/java bridge > will work with? It depends on how you start Java. As a sub component of Apache or IIS? In this case the bridge uses the java.java option from the php.ini. > I actually installed the Java J2SE JDK from Sun on > my box on /opt/jdk_ ... > and that path is the one I set on the java.ini file. The phpinfo() or the test.php page should display the settings. Probably your system uses another .ini file than you expect. > Ok, I'll remove the java_reset() calls. Most back ends ignore the java_reset() calls anyway. Only the standalone container honors it. I thought java_reset() generates enough noise so that people don't use it in their scripts. Unfortunately it is possible to suppress the warnings with the @operator. > I shouldn't touch the CLASSPATH, right? You can set it to any value you want. Java and the PHP/Java Bridge don't care. > I'm not sure about what you mean when you say > wrappers. I think hiding the libraries behind a facade is a bad idea; people shouldn't write unnatural code. If you have deployed your libraries into a J2EE back end, use the libraries directly: <?php require_once("http://hostname:8080/JavaBridge/java/Java.inc"); java_require("foo.jar;bar.jar;..."); .. call your libraries .. ?> If it turns out that some procedures should be optimized, encapsulate the PHP code with the java_begin_document()/java_end_document() pair. This sends and executes the PHP code on the server side. This is nearly as fast as Java code. Regards, Jost Boekemeier ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de |
From: <php...@li...> - 2007-03-18 17:23:56
|
Hi Andrés, I just saw that you use a recent version of PHP anyway. So please use the pure PHP implementation instead of the C based implementation started as a sub component of Apache. Type: /opt/jdkXXX/bin/java -jar JavaBridge.jar SERVLET:8080 And then use your java from your scripts as follows: <?php require_once("http://localhost:8080/JavaBridge/java/Java.inc"); java_require("all.jar;my.jar;library.jar;files.jar"); ... ?> If this works and you really want to run Java as a sub component of Apache, you can think about where to store your libraries and how to set the security policy in a second step. Regards, Jost Boekemeier ___________________________________________________________ Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de |
From: <php...@li...> - 2007-03-19 13:26:16
|
Hi Jost, Let me thank you again for all the help you've been giving me. First of all I will answer the questions from your previous mail. java_require("file://usr/local/apache2/htdocs/tests_java/Test.jar"); java_require("http://localhost/tests_java/Test.jar"); java_require("http://172.16.0.75/tests_java/Test.jar"); java_require("Test.jar"); And none of them seemed to work. All of the above examples should work. Which error message do you get? The error I was getting was that it couldn't find the class. I checked the JVM that it was using and it was wrong, as you suggested. So I changed it and now it's working with the JRE I just installed. But now I've got a different error: CreateInstance failed: new Test. Cause: java.lang.IllegalAccessException: Class php.java.bridge.JavaBridge can not access a member of class Test with modifiers "public" Responsible VM: 1.5.0_11@http://java.sun.com/ This is my java code: class Test { public Test () { System.out.println("Hi, I'm the constructor"); } public String saySth () { return "Something stupid"; } public static void main (String[] args) { System.out.println("This is the main"); System.exit(0); } } All methods are public. Regarding Security Enhanced Linux, I had seen the warning on your site so I checked it before but it is not enabled in this box. Besides, I installed the PHP/Java Bridge from its source because the RPM package didn't work for me as the Apache and PHP were also compiled and installed *manually*, so th= e RPM would say that I needed some dependecies such as httpd... Anyway, I think that now that you've shown me this error I had on my configuration I'm closer to making it work. As for the PHP Implementation does that imply that I should run Apache/Tomcat? Because I was required not to use Tomcat in this case. However, as I said in another mail, I don't have much experience with Java nor Tomcat, so I'm not sure what are the advantages or disavantages does that have. Thanks again for your help. Regards, Andr=E9s On 3/18/07, php...@li... < php...@li...> wrote: > > Hi Andr=E9s, > > I just saw that you use a recent version of PHP > anyway. > > So please use the pure PHP implementation instead of > the C based implementation started as a sub component > of Apache. > > Type: > > /opt/jdkXXX/bin/java -jar JavaBridge.jar > SERVLET:8080 > > And then use your java from your scripts as follows: > > <?php > require_once("http://localhost:8080/JavaBridge/java/Java.inc"); > java_require("all.jar;my.jar;library.jar;files.jar"); > ... > ?> > > If this works and you really want to run Java as a sub > component of Apache, you can think about where to > store your libraries and how to set the security > policy in a second step. > > > Regards, > Jost Boekemeier > > > > > > > > ___________________________________________________________ > Der fr=FChe Vogel f=E4ngt den Wurm. Hier gelangen Sie zum neuen Yahoo! Ma= il: > http://mail.yahoo.de > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > --=20 Andr=E9s Gattinoni (=AF`=B7._.=B7[El Barto(r)]=B7._.=B7=B4=AF) (...) |
From: <php...@li...> - 2007-03-19 15:03:58
|
Hi, > The error I was getting was that it couldn't find > the class. I don't think so. Can you please open a problem report, please use http://sourceforge.net/tracker/?func=add&group_id=117793&atid=679233 set the log level to 4 and attach the server log there. > But now I've got a > different error: > CreateInstance failed: new Test. Cause: > java.lang.IllegalAccessException: > Class php.java.bridge.JavaBridge can not access a > member of class Test with > modifiers "public" Responsible VM: > 1.5.0_11@http://java.sun.com/ Ah, now we're are at something. So your problem isn't that the class could not be found. The problem is that the wrapper Java class you've written throws exceptions or even errors. -- Most likely a NoClassDefFoundError. > This is my java code: > > class Test This will not work, because your class is not public. > All methods are public. Irrelevant. > Besides, I installed > the PHP/Java Bridge from its source because the RPM > package didn't work for > me I don't know what Andr'e and Jon think about this, but I think we should discontinue the source distribution. I think it causes too much trouble. We could keep the (source-) RPM and debian packages. Everyone else should use the generic binary or pull the source code from the CVS. > Apache/Tomcat? Because I was required not to use > Tomcat in this case. You need to start a Java process as a service on the computer. Which other program can start Java as a system service? And what's the problem with tomcat? Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |
From: <php...@li...> - 2007-03-19 15:36:35
|
> > > > The error I was getting was that it couldn't find > > the class. > > I don't think so. Can you please open a problem > report, > please use > http://sourceforge.net/tracker/?func=3Dadd&group_id=3D117793&atid=3D67923= 3 > > set the log level to 4 and attach the server log > there. What I meant is that I got the error Java throws when it cannot find the class that you're trying to instanciate. It is the error I had pasted on my first e-mail: CreateInstance failed: new Test. Cause: java.lang.ClassNotFoundException: Test Responsible VM: 3.4.3@http://gcc.gnu.org/java/ > But now I've got a > > different error: > > CreateInstance failed: new Test. Cause: > > java.lang.IllegalAccessException: > > Class php.java.bridge.JavaBridge can not access a > > member of class Test with > > modifiers "public" Responsible VM: > > 1.5.0_11@http://java.sun.com/ > > Ah, now we're are at something. So your problem isn't > that the class could not be found. The problem is that > the wrapper Java class you've written throws > exceptions or even errors. -- Most likely a > NoClassDefFoundError. > > > > This is my java code: > > > > class Test > > This will not work, because your class is not public. Great! That was it! Now it is working! Just another question... I had to restart Apache so that it would load the new jar file... why is that? cache? I will keep on trying with other things (now I have to get my *real* java programs to work) and will keep you posted of any other problem I might get= . > Besides, I installed > > the PHP/Java Bridge from its source because the RPM > > package didn't work for > > me > > I don't know what Andr'e and Jon think about this, but > I think we should discontinue the source distribution. > I think it causes too much trouble. We could keep the (source-) RPM and debian packages. > Everyone else should use the generic binary or pull > the source code from the CVS. In my opinion, it's always useful to have a stable release of the source code for those who don't use RPM or Debian packages. I'm working with this at he company where I work, and I have to work with RedHat so I could use the RPM binaries if it wasn't for the dependecies problems I got (as I said, I installed Apache and PHP *manually* from its source). Nevertheless I would probably want to install PHP/Java Bridge on m= y web server at home where I'm running Slackware and I would definitely need to use the source package there. > Apache/Tomcat? Because I was required not to use > > Tomcat in this case. > > You need to start a Java process as a service on the > computer. Which other program can start Java as a > system service? And what's the problem with tomcat? This was mostly curiosity, as I said I haven't work much with Java nor JSP... but if it's the way to go, so be it. Thank you very much again for your support. I hope that I can get this to work and use it in many other places. I would be glad to help you enrich th= e documentation with my experience installing it, and I'm at your service for anything else that I could be useful. Regards, Andr=E9s Gattinoni |
From: <php...@li...> - 2007-03-19 17:37:22
|
I just came up with two new questions. I'm sorry, I don't mean to be annoying, but here is the only place where I can get the help I need. 1) When I run the install.sh script it overwrites my php.ini with the PHP/Java Bridge configuration. It does not bother me right now because I'm not using any special configuration, but when I go on production I will need my php.ini file. The problem is that if I append the lines of the php.ini file that the install.sh created to my original php.ini, the extension just doesn't load. Is there any consideration that I should take into account before merging both ini files? 2) In a previous email, Jost told me that PHP/Java Bridge does not care about CLASSPATH variable, and here comes my problem. I have to implement an API which uses some XML files for its configuration. The xml is loaded using th= e getSystemResource method of the ClassLoader, which looks for a certain file on the classpath as I understand. So, how should I indicate where those files are using PHP/Java Bridge? Right now I just added the path to the conf/ folder to the CLASSPATH and everything worked. Thanks Andr=E9s Gattinoni |