You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(6) |
Nov
(8) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(19) |
Feb
(15) |
Mar
(10) |
Apr
(8) |
May
(7) |
Jun
(9) |
Jul
(13) |
Aug
(31) |
Sep
(111) |
Oct
(52) |
Nov
(72) |
Dec
(42) |
| 2006 |
Jan
(21) |
Feb
(32) |
Mar
(33) |
Apr
(24) |
May
(15) |
Jun
(40) |
Jul
(32) |
Aug
(19) |
Sep
(38) |
Oct
(37) |
Nov
(63) |
Dec
(37) |
| 2007 |
Jan
(18) |
Feb
(39) |
Mar
(69) |
Apr
(49) |
May
(71) |
Jun
(59) |
Jul
(71) |
Aug
(85) |
Sep
(46) |
Oct
(14) |
Nov
(25) |
Dec
(56) |
| 2008 |
Jan
(24) |
Feb
(77) |
Mar
(104) |
Apr
(44) |
May
(41) |
Jun
(11) |
Jul
(31) |
Aug
(59) |
Sep
(44) |
Oct
(86) |
Nov
(66) |
Dec
(93) |
| 2009 |
Jan
(88) |
Feb
(41) |
Mar
(49) |
Apr
(135) |
May
(22) |
Jun
(31) |
Jul
(60) |
Aug
(71) |
Sep
(76) |
Oct
(18) |
Nov
(52) |
Dec
(20) |
| 2010 |
Jan
(8) |
Feb
(50) |
Mar
(35) |
Apr
(48) |
May
(46) |
Jun
(84) |
Jul
(38) |
Aug
(61) |
Sep
(51) |
Oct
(31) |
Nov
(17) |
Dec
(18) |
| 2011 |
Jan
(51) |
Feb
(14) |
Mar
(17) |
Apr
(23) |
May
(15) |
Jun
(11) |
Jul
(5) |
Aug
(5) |
Sep
(15) |
Oct
(8) |
Nov
(5) |
Dec
(25) |
| 2012 |
Jan
(2) |
Feb
(4) |
Mar
(6) |
Apr
(9) |
May
(27) |
Jun
(32) |
Jul
(36) |
Aug
(10) |
Sep
(16) |
Oct
(3) |
Nov
(13) |
Dec
(7) |
| 2013 |
Jan
(1) |
Feb
(4) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
(1) |
Sep
(4) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(9) |
Jul
(5) |
Aug
(2) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
| 2015 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(3) |
May
(1) |
Jun
(2) |
Jul
|
Aug
(2) |
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
(5) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
|
Mar
|
Apr
(10) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2018 |
Jan
(2) |
Feb
(5) |
Mar
|
Apr
|
May
(1) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2021 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2023 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <php...@li...> - 2008-10-06 19:27:19
|
Hello, Bringing back the PhpScriptContextFactory.java file allowed the compilation. Regards. Andre Felipe |
|
From: <php...@li...> - 2008-10-06 18:00:55
|
Hello, Jost
Many thanks for your answer.
>
> Can you please remove them from the CVS?
done at cvs repository.
But now, there is still other stops:
gcc -g -O2 -o RunJavaBridge RunJavaBridge.o -lrt
/usr/lib/jvm/java-6-sun/bin/javac -source 1.4 -target 1.4 -classpath
.:../unsupported/servlet-api.jar php/java/script/*.java
php/java/script/servlet/*.java php/java/bridge/http/*.java
php/java/bridge/*.java php/java/servlet/*.java
php/java/servlet/fastcgi/*.java
php/java/script/SimplePhpScriptEngine.java:161: cannot find symbol
symbol : variable PhpScriptContextFactory
location: class php.java.script.SimplePhpScriptEngine
ctx = PhpScriptContextFactory.addNew((IContext)context);
^
Note: php/java/servlet/RemoteHttpServletResponse.java uses or overrides a
deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
make[2]: ** [php-servlet.jar] Erro 1
make[2]: Saindo do diretório
`/home/andremachado/projetos/php-java-bridge/server'
make[1]: ** [/home/andremachado/projetos/php-java-bridge/modules/stamp]
Erro 2
make[1]: Saindo do diretório `/home/andremachado/projetos/php-java-bridge'
make: ** [build-stamp] Erro 2
debuild: fatal error at line 1228:
dpkg-buildpackage -rfakeroot -D -us -uc failed
Do you have suggestions?
Regards.
Andre Felipe
|
|
From: <php...@li...> - 2008-10-06 16:15:51
|
Hi,
> 1) What all things I can remove from JavaBridge directory
> on Apache as I
> dont want to put un-required stuff on Apache WebServer.
Only the java/Java.inc is neccessary.
> 2) What all things I can remove from JavaBridge directory
> on Tomcat?
Everything except WEB-INF/web.xml, WEB-INF/lib/{JavaBridge*,*php*}.jar
If you want to run PHP scripts directly from servlets, you need to keep the WEB-INF/cgi directory.
> 3) Do I need to setup mod_jk between Apache WebServer and
> Tomcat , or bridge
> will take care of communication by itself.
I would use mod_proxy instead of mod_jk. mod_proxy also supports load balancing, if you need it. Please see our FAQ for details.
> 4) When I develope my Java Classes where I need to put jar
> file?
> is it JavaBridge/WEB-INF/lib? , will it automatically
> put in classpath?
Yes. If you touch the WEB-INF/web.xml, the web context automatically
reloads all libraries.
> 5) Can I also develop seperate WebApplication and deploy on
> Tomcat and still
> can access from PHP in Apache WebServer?
You can copy JavaBridge to MyWebApp and access that. Both applications will be separated. If you want to hard-code all requests to MyWebApp, just fetch the Java.inc from MyWebApp or hard-code the string in java/Java.inc or use a define(...) before including Java.inc.
Please see our FAQ for details
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2008-10-06 16:00:48
|
Hi Andre, sorry about that. I forgot to "cvs remove" these files: * server/php/java/script/EngineFactory.java,server/php/java/script/InvocablePhpServletContextFactory.java,server/php/java/script/InvocablePhpServletLocalScriptEngine.java,server/php/java/script/InvocablePhpServletScriptEngine.java,server/php/java/script/PhpServletContextFactory.java,server/php/java/script/PhpServletLocalScriptEngine.java,server/php/java/script/PhpServletScriptEngine.java,server/php/java/script/PhpSimpleHttpScriptContext.java,server/php/java/script/ScriptFileReader.java: Removed the reason for the change is in the ChangeLog: http://php-java-bridge.cvs.sourceforge.net/viewvc/php-java-bridge/php-java-bridge/ChangeLog?revision=1.189&view=markup Can you please remove them from the CVS? The bridge uses certain API's which are deprecated since Java 6. But removing them is not possible at the moment because it would break backward compatibility with Java 1.4. But I will have a look at this issue this evening. Regards, Jost Boekemeier |
|
From: <php...@li...> - 2008-10-06 15:40:48
|
Hello,
I am trying to generate the debian packages and found that
php-java-bridge/server/Makefile.am at line 81 has a "java" entry
that gives a full stop.
Well, for trying to go ahead, I removed that java entry and
now it stops at:
gcc -g -O2 -o RunJavaBridge RunJavaBridge.o -lrt
/usr/lib/jvm/java-6-sun/bin/javac -source 1.4 -target 1.4 -classpath
.:../unsupported/servlet-api.jar php/java/script/*.java
php/java/script/servlet/*.java php/java/bridge/http/*.java
php/java/bridge/*.java php/java/servlet/*.java
php/java/servlet/fastcgi/*.java
php/java/script/InvocablePhpServletLocalScriptEngine.java:127: cannot find
symbol
symbol : variable scriptException
location: class php.java.script.InvocablePhpServletLocalScriptEngine
throw this.scriptException = new PhpScriptException("Could
not evaluate script", e);
^
php/java/script/InvocablePhpServletLocalScriptEngine.java:129: cannot find
symbol
symbol : variable scriptException
location: class php.java.script.InvocablePhpServletLocalScriptEngine
try { localReader.close(); localReader=null; } catch
(IOException e) {throw this.scriptException = new PhpScriptException("Could
not close script", e);}
^
php/java/script/InvocablePhpServletScriptEngine.java:107: cannot find
symbol
symbol : variable scriptException
location: class php.java.script.InvocablePhpServletScriptEngine
throw this.scriptException = new PhpScriptException("Could
not evaluate script", e);
^
php/java/script/InvocablePhpServletScriptEngine.java:109: cannot find
symbol
symbol : variable scriptException
location: class php.java.script.InvocablePhpServletScriptEngine
try { localReader.close(); localReader=null; } catch
(IOException e) {throw this.scriptException = new PhpScriptException("Could
not close script", e);}
^
php/java/script/PhpServletLocalScriptEngine.java:126: cannot find symbol
symbol : variable scriptException
location: class php.java.script.PhpServletLocalScriptEngine
throw this.scriptException = new PhpScriptException("Could
not evaluate script", e);
^
php/java/script/PhpServletLocalScriptEngine.java:128: cannot find symbol
symbol : variable scriptException
location: class php.java.script.PhpServletLocalScriptEngine
try { localReader.close(); localReader=null; } catch
(IOException e) {throw this.scriptException = new PhpScriptException("Could
not close script", e);}
^
php/java/script/PhpServletScriptEngine.java:91: cannot find symbol
symbol : variable scriptException
location: class php.java.script.PhpServletScriptEngine
throw this.scriptException = new PhpScriptException("Could
not evaluate script", e);
^
php/java/script/PhpServletScriptEngine.java:93: cannot find symbol
symbol : variable scriptException
location: class php.java.script.PhpServletScriptEngine
try { localReader.close(); localReader=null; } catch
(IOException e) {throw this.scriptException = new PhpScriptException("Could
not close script", e);}
^
Note: php/java/servlet/RemoteHttpServletResponse.java uses or overrides a
deprecated API.
Note: Recompile with -Xlint:deprecation for details.
8 errors
make[2]: ** [php-servlet.jar] Erro 1
do you have suggestions?
Regards.
Andre Felipe
|
|
From: <php...@li...> - 2008-10-06 15:35:11
|
Hi ,
thanks for developing this bridge. I;m new here and want to use this to call
Java from PHP and vice versa.
I have deployed Java Bridge on Tomcat and copied the same on Apache. Also
able to access numberguess php from Apache WebServer. It means I am able to
configure it well.
Now my concern is.
1) What all things I can remove from JavaBridge directory on Apache as I
dont want to put un-required stuff on Apache WebServer.
--- I have tried removing everything except "java" directory from
JavaBridge directory and still it worked. Is it okie to just keep "java"
directory on Apache WebServer.
2) What all things I can remove from JavaBridge directory on Tomcat? As it
contains samples which wont be useful for my application.
3) Do I need to setup mod_jk between Apache WebServer and Tomcat , or bridge
will take care of communication by itself.
4) When I develope my Java Classes where I need to put jar file?
is it JavaBridge/WEB-INF/lib? , will it automatically put in classpath?
or do I need to do any specific configuration?
5) Can I also develop seperate WebApplication and deploy on Tomcat and still
can access from PHP in Apache WebServer?
thanks in advance.
have a nice day,
M>...
|
|
From: <php...@li...> - 2008-10-06 13:55:38
|
Hi,
> Do I have to keep tomcat running as well?
without a running java VM a java extension would not make any sense, I think.
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2008-10-06 13:45:21
|
Hi, Thanks for the quick response. > 1. Copy JavaBridge.war to tomcat's autodeploy folder > 2. Copy the created webapps/JavaBridge directory over to the IIS/Apache doc root This might be a very stupid question but Do I have to keep tomcat running as well? Or just copying it in doc root of apache is sufficient? Thanks On Mon, Oct 6, 2008 at 10:19 PM, <php...@li...> wrote: > Hi, > > >> - Which is the suggested way of deploying php-java bridge? > > 1. Copy JavaBridge.war to tomcat's autodeploy folder > 2. Copy the created webapps/JavaBridge directory over to the IIS/Apache doc root > > >> separate process >> and we end up having lots of java processes. Are we using > > The java.so or php_java.dll start a Java process in minit and destroy it in mshutdown. minit/mshutdown are called when IIS or Apache starts/stops. Or when the CGI or CLI binary is invoked/terminated, which happens for every request. > > Java threads from a thread pool show up as processes in old Linux kernels or psutils. > > > Regards, > Jost Boekemeier |
|
From: <php...@li...> - 2008-10-06 13:23:26
|
Hi,
> - Which is the suggested way of deploying php-java bridge?
1. Copy JavaBridge.war to tomcat's autodeploy folder
2. Copy the created webapps/JavaBridge directory over to the IIS/Apache doc root
> separate process
> and we end up having lots of java processes. Are we using
The java.so or php_java.dll start a Java process in minit and destroy it in mshutdown. minit/mshutdown are called when IIS or Apache starts/stops. Or when the CGI or CLI binary is invoked/terminated, which happens for every request.
Java threads from a thread pool show up as processes in old Linux kernels or psutils.
Regards,
Jost Boekemeier
|
|
From: <php...@li...> - 2008-10-06 09:45:33
|
Hi,
thanks for all the advise. I tried your solution of copying php-cgi.exe and
php5ts.dll to my local working directory. That indeed
solved the issue of the Stackoverflow I got on the command prompt with the
interactive php engine.
I am attempting now to resolve the problems I described using the bridge
from Netbeans. I'll keep you posted on the outcome, though
it may take some time (sometime next week likely) before I can get back to
you.
Thanks already!
Bart
On Fri, Sep 26, 2008 at 8:51 PM, <
php...@li...> wrote:
> Hi,
>
> > Java 1.6.0.6 with PHP 5.2.2 [..] bridge version 5.2.2
>
> I am sorry, but I cannot reproduce this problem using the above software.
>
> * downloaded PHP/Java Bridge version 5.2.2 and extracted it into c:\
>
> * downloaded Java 1.6.0_06 and installed it
>
> * downloaded PHP 5.2.2 and copied php-cgi.exe and php5ts.dll to
> C:\php-java-bridge_5.2.2.4_j2ee\JAVA.STANDALONE
>
>
>
> C:\php-java-bridge_5.2.2.4_j2ee\JAVA.STANDALONE>c:\programme\java\jdk1.6.0_06\bin\jrunscript
> -classpath JavaBridge.jar -l php-interactive
> php-interactive> echo 1+2
> 3
> php-interactive> java_autoload();
>
> php-interactive> echo
> java_lang_System::type()->getProperty("java.version");
> 1.6.0_06
> php-interactive> echo phpversion();
> 5.2.2
> php-interactive> echo php_java_bridge_Util::type()->VERSION;
> 5.2.2.4
> php-interactive>
>
>
>
> > Exception in thread "main"
> > java.lang.StackOverflowError
>
> php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:89)
>
> The StackOverflowError usually happens when a simple "<?php ?>" call fails.
>
> Please check your PHP installation. Remove it, if necessary, and copy
> the php-cgi.exe and php5ts.dll into the local working directory.
>
> Check which extension breaks your system PHP installation. Most likely you
> use an old Java extension or the Java extension from Zend. Both don't work
> correctly (at least not with JSR223).
>
>
> Regards,
> Jost Boekemeier
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz
> gegen Massenmails.
> http://mail.yahoo.com
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
>
--
The new is always the old. Everything that's old was once new, and
everything that's new will one day be old. The oldest thing of all is the
present, because there's never been anything else but the present. No one
has ever lived in the past, and no one lives in the future, either.
|
|
From: <php...@li...> - 2008-10-06 02:21:47
|
Hi, We have a php web application which will be accessing a third party Java API (in form of jars) what is the suggested deployment method? I have tried following: 1. Compiled the source which results in java.so and then include it in php.ini using 'extension=java.so' 2. Start the servlet engine explicitly using java commend 'java -jar JavaBridge.jar SERVLET:8080 3 javabridge_servlet.log' inside JAVA.STANDALONE folder. I have couple of questions. - Which is the suggested way of deploying php-java bridge? - The servlet engine which is part of the JavaBridge.jar is it stable enough for production? - Good thing about option 1 is that I do not have to start any separate process it gets started with apache but we have experienced that for some reason for every call it was creating a separate process and we end up having lots of java processes. Are we using it incorrectly? Thanks for the help. Regards, Amit. |
|
From: <php...@li...> - 2008-09-26 19:22:18
|
Hi,
> the 'thiz' object is null and this is why the proxy
> part fails.
this happens if the script could not call into the Java continuation.
"Invocable" scripts are evaluated in three parts:
part 1 load Java.inc/php_java.dll
part 2 is your script code
part 3 is the call back into Java (if your code did not call into Java)
The full script looks like this:
<?php require("http://<localhost>:dynamicPort/JavaBridge/java/Java.inc")?>
<?php ... your PHP code ... ?>
<?php java_context()->call(java_closure());
When a php_java.dll exists, part#1 will not be called. In this case we assume that your PHP installation already uses the PHP/Java Bridge.
If the asumption is false, and the php_java.dll does not export java_context(), part#3 will fail and Java will not be able to get- and call the PHP continuation.
Regards,
Jost Boekemeier
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
|
|
From: <php...@li...> - 2008-09-26 18:51:54
|
Hi,
> Java 1.6.0.6 with PHP 5.2.2 [..] bridge version 5.2.2
I am sorry, but I cannot reproduce this problem using the above software.
* downloaded PHP/Java Bridge version 5.2.2 and extracted it into c:\
* downloaded Java 1.6.0_06 and installed it
* downloaded PHP 5.2.2 and copied php-cgi.exe and php5ts.dll to
C:\php-java-bridge_5.2.2.4_j2ee\JAVA.STANDALONE
C:\php-java-bridge_5.2.2.4_j2ee\JAVA.STANDALONE>c:\programme\java\jdk1.6.0_06\bin\jrunscript -classpath JavaBridge.jar -l php-interactive
php-interactive> echo 1+2
3
php-interactive> java_autoload();
php-interactive> echo java_lang_System::type()->getProperty("java.version");
1.6.0_06
php-interactive> echo phpversion();
5.2.2
php-interactive> echo php_java_bridge_Util::type()->VERSION;
5.2.2.4
php-interactive>
> Exception in thread "main"
> java.lang.StackOverflowError
php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:89)
The StackOverflowError usually happens when a simple "<?php ?>" call fails.
Please check your PHP installation. Remove it, if necessary, and copy
the php-cgi.exe and php5ts.dll into the local working directory.
Check which extension breaks your system PHP installation. Most likely you use an old Java extension or the Java extension from Zend. Both don't work correctly (at least not with JSR223).
Regards,
Jost Boekemeier
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
|
|
From: <php...@li...> - 2008-09-26 15:43:26
|
Hi,
For example:
>
> jrunscript -classpath JavaBridge.jar -l php-interactive
> > function toString() {return "hello Java, I am PHP";}
> > echo java_closure();
> => hello Java, I am PHP
>
> [to run the above example make sure that JavaBridge.jar and php-script.jar
> is in the current working directory and that jre/lib/ext does not contain
> JavaBridge.jar and php-script.jar -- Java doesn't have a module system,
> please
> see our README section Java Platform Issues for details. Use .NET or Mono
> if you
> don't like how Java works around that problem... ]
>
Removed the files from the jre/lib/ext directory. Ran the script. I get the
prompt. I enter the first line and hit enter. Result is a stack overflow
error traced back to line 89 of the InteractivePhpScriptEngine.java file (in
which the entered script is trimmed and a ';' is added as far as I can tell
by checking the source code):
Exception in thread "main" java.lang.StackOverflowError
at java.lang.String.<init>(String.java:216)
at java.lang.StringBuffer.toString(StringBuffer.java:585)
at
php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:89)
at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:97)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
at
php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:91)
at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:97)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
at
php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:91)
at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
(this goes on for a while)
Looking at the code what is happening (as far as I can see) is that it
attempts an eval call in InteractivePhpScriptEngine:
try {o=((Invocable)this).invokeFunction("javabridge_eval", new
Object[]{script});}catch(NoSuchMethodException ex){/*ignore*/};
For this it calls invokeFunction in InvocablePhpScriptEngine, which calls
invoke(String methodName, Object[] args) in InvocablePhpScriptEngine. This
method attempts if(scriptClosure==null) eval("<?php ?>") in line 97. This
eval call then leads to a repeat of the cycle until at some point it fails
at line 89 of the InteractivePhpScriptEngine with the stackoverlfowexception
since the stack is full. So somehow the evaluation of any input script fails
(including the "<?php ?>) until the stack is full. Any thoughts on what
might be causing this?
===================================================================================================
I also tried your example via Netbeans by adding the jar files directly to
the project (not onto the overall classpath by putting them in the
jre/lib/ext directory).
Your example to which I added a few debug lines using System.out.println:
package test;
>
> import java.io.Reader;
> import java.io.StringReader;
>
> import javax.script.Invocable;
>
> import php.java.script.InvocablePhpScriptEngine;
>
> public class HelloWorld {
>
> public static void main(String[] args) {
>
> String l = "3";
> System.setProperty("php.java.bridge.default_log_level", l);
> System.setProperty("php.java.bridge.default_log_file", "");
> System.setProperty("php.java.bridge.php_exec", "php-cgi");
>
> try {
> InvocablePhpScriptEngine engine = new InvocablePhpScriptEngine();
> String s = "<?php echo 'HelloWorld!\n'; ?>";
> System.out.println("here");
> engine.eval(new StringReader(s));
> System.out.println("here2");
> String name = (String)
> ((Invocable)engine).invokeFunction("java_get_server_name", new Object[]{});
> System.out.println("PHP/Java communication port: " + name);
>
> engine.eval((Reader)null);
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
>
> The result:
>
> PHP/Java communication port: 127.0.0.1:9267
> HelloWorld!
My result:
here
here2
java.lang.NullPointerException
at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:636)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:116)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:100)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
Here it seems the actual invoke is never reached in method invoke(Object
thiz, String methodName, Object[] args) as it fails while obtaining the
invocation handler through the Proxy class; and thus before calling the
invoke method on the phpscriptprocedure object. My best guess would be that
the 'thiz' object is null and this is why the proxy part fails.
InvokeFunction calls invoke(String methodName, Object[] args), which
contains the part
if(scriptClosure==null) eval("<?php ?>");
try {
return invoke(scriptClosure, methodName, args);
}
This call then invokes invoke(Object thiz, String methodName, Object[]
args), which leads to the null pointer exception at line 116. As you said
already, clearly also here the eval part either fails and returns null (just
like with the jrunscript test I did), or it is never performed.
The question is why. Any thoughts on why this is the case?
Kind regards,
Bart
p.s: thanks a lot for all your patience and efforts to help with this.
|
|
From: <php...@li...> - 2008-09-25 19:39:12
|
Hi,
> I am short on time right now to sort out the PUT
> permission. I'll take
Just deinstall mod_jk and it should work.
> to re-configure PHP
> to support PUT requests.
Not really. Tomcat and the PHPJavaServlet do support put, get and post requests. However, when mod_jk is installed, which is a deprecated method to connect apache with tomcat, the back end denies PUT requests in order to disallow internet clients to modify the web content.
> java-related code; where the php based front end calls a
> JAVA based backend.
You have two options: either start the built-in servlet engine with java -jar JavaBridge.jar or use a real servlet engine, for example tomcat, jetty, Oracle, IBM WebSphere, ...
[the other way 'round...]
> - I have an existing PHP based application, both backend
> and frontend.
> - I want to create a JAVA based front end that can talk to
> the PHP based
> backend
That's trivial, if you use the JSR 223 API.
For example:
jrunscript -classpath JavaBridge.jar -l php-interactive
> function toString() {return "hello Java, I am PHP";}
> echo java_closure();
=> hello Java, I am PHP
[to run the above example make sure that JavaBridge.jar and php-script.jar
is in the current working directory and that jre/lib/ext does not contain
JavaBridge.jar and php-script.jar -- Java doesn't have a module system, please
see our README section Java Platform Issues for details. Use .NET or Mono if you
don't like how Java works around that problem... ]
> * Copied the created "JavaBridge.jar" and
> "php-script.jar" from the
> "ext" folder to the J2SE library path
> (specifically the 'jre/lib/ext'
> directory)
Right.
> * opened Netbeans IDE
[...]
> public class HelloWorld {
>
> public static void main(String[] args) {
>
> String l = "3";
>
> System.setProperty("php.java.bridge.default_log_level",
> l);
>
> System.setProperty("php.java.bridge.default_log_file",
> "");
>
> System.setProperty("php.java.bridge.php_exec",
> "php-cgi");
>
> try {
> InvocablePhpScriptEngine engine = new
> InvocablePhpScriptEngine();
> String s = "<?php
> extension_loaded('java')||@dl('java.so')||@dl('php_java.dll');
> echo
> 'HelloWorld!\n';
> java_context()->call(java_closure())
> ||die('oops!');?>";
>
> engine.eval(new StringReader(s));
> String name = (String)
> ((Invocable)engine).invokeFunction("java_get_server_name",
> new Object[]{});
> System.out.println("PHP/Java communication
> port: " + name);
>
> }
>
> //engine.release();
> engine.eval((Reader)null);
>
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
> }
> * Compiled the code, which went fine
The above example contains a try/catch statement with two closing braces. Either netbeans is a really bad programming editor or the above example is not the code you've tested.
I fixed the error and ran the following code in eclipse:
package test;
import java.io.Reader;
import java.io.StringReader;
import javax.script.Invocable;
import php.java.script.InvocablePhpScriptEngine;
public class HelloWorld {
public static void main(String[] args) {
String l = "3";
System.setProperty("php.java.bridge.default_log_level", l);
System.setProperty("php.java.bridge.default_log_file", "");
System.setProperty("php.java.bridge.php_exec", "php-cgi");
try {
InvocablePhpScriptEngine engine = new InvocablePhpScriptEngine();
String s = "<?php echo 'HelloWorld!\n'; ?>";
engine.eval(new StringReader(s));
String name = (String)
((Invocable)engine).invokeFunction("java_get_server_name", new Object[]{});
System.out.println("PHP/Java communication port: " + name);
engine.eval((Reader)null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
The result:
PHP/Java communication port: 127.0.0.1:9267
HelloWorld!
> java.lang.NullPointerException
The null pointer exception is because the eval failed. Or eval has never been called.
Regards,
Jost Boekemeier
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
|
|
From: <php...@li...> - 2008-09-25 15:06:30
|
Hi,
I am short on time right now to sort out the PUT permission. I'll take
another look at it when I can. I AM using a standard tomcat installation to
which I deployed the war file, but obviously I'll need to re-configure PHP
to support PUT requests.
Putting that aside for a moment though, my main intention for using the
bridge would not be to write new PHP files containing a mix of php and
java-related code; where the php based front end calls a JAVA based backend.
I am solely interested really in the following:
- I have an existing PHP based application, both backend and frontend.
- I want to create a JAVA based front end that can talk to the PHP based
backend
In other words, I want to evaluate PHP code from a JAVA program using a PHP
script engine and use the results in the JAVA program. Preferable I want to
do this in such a way that no changes to the existing PHP code are needed
(i.e. no inclusion of java related constructs in the PHP code, etceteras),
however if this is the only way to do it I'll naturally consider it. Any
info on the exact support offered by the bridge would be nice.
Following the instructions in the Installation.J2SE file I did the following
to setup the bridge:
* Have Java 1.6.0_07.
* Have PHP 5.2.2.
* Downloaded and extracted the php-java-bridge_j2ee*.zip archive into a
folder and typed: java -classpath JavaBridge.war TestInstallation
* Copied the created "JavaBridge.jar" and "php-script.jar" from the
"ext" folder to the J2SE library path (specifically the 'jre/lib/ext'
directory)
* opened Netbeans IDE
* created the example in helloworld.java via Netbeans, being:
public class HelloWorld {
public static void main(String[] args) {
String l = "3";
System.setProperty("php.java.bridge.default_log_level", l);
System.setProperty("php.java.bridge.default_log_file", "");
System.setProperty("php.java.bridge.php_exec", "php-cgi");
try {
InvocablePhpScriptEngine engine = new InvocablePhpScriptEngine();
String s = "<?php
extension_loaded('java')||@dl('java.so')||@dl('php_java.dll'); echo
'HelloWorld!\n'; java_context()->call(java_closure())
||die('oops!');?>";
engine.eval(new StringReader(s));
String name = (String)
((Invocable)engine).invokeFunction("java_get_server_name", new Object[]{});
System.out.println("PHP/Java communication port: " + name);
}
//engine.release();
engine.eval((Reader)null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
* Compiled the code, which went fine
* Ran the code, leading to:
Exception in thread "main" java.lang.NullPointerException
at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:636)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:116)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:100)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
As a second test I also ran SimpleInvocation.java:
public class Main {
public static void main(String[] args) throws Exception {
ScriptEngineManager m = new ScriptEngineManager();
ScriptEngine e = m.getEngineByName("php-invocable");
Invocable i = (Invocable)e;
i.invokeFunction("phpinfo", new Object[0]);
System.exit(0);
}
}
This leads to the same error.
What am I doing wrong? No php_java.dll is loaded in php.ini.
Thanks for any help,
Bart
|
|
From: <php...@li...> - 2008-09-24 21:54:39
|
Hi, > the environment setting PHP_FCGI_MAX_REQUESTS=5000? Trying > again using a new connection: > CommandLine="C:\Program > Files\Zend\Core\bin\php-cgi.exe" > ConnectionTimeout="30" > RequestTimeout="60" > StartProcesses="8" Impersonate="1" > SetEnv="PHP_FCGI_MAX_REQUESTS=10000" > SetEnv="PHP_FCGI_CHILDREN=1" We're sorry, but we cannot support Zend products. Please contact Zend instead. The PHP/Java Bridge needs the settings described in the README: at least 5 childs and 5000 MAX_REQUESTS. You can change that in the web.xml, though. > I also deployed the java bridge to a running Apache 2 > server. There the > PHP_FCGI_MAX_REQUESTS is set to 10000, so that is not an What do you mean with that? Apache2 doesn't use fastcgi. > PHP Fatal error: Call to undefined function > bindtextdomain() in C:\Program > Files\Zend\Apache2\htdocs\JavaBridge\hello.php This is not a PHP/Java Bridge issue but a PHP issue. You must compile PHP with language support, otherwise bindtextdomain is not available. Please see your PHP documentation for details. > =================================================================== > protocol error: Method Not Allowed > > The requested method PUT is not allowed for the URL > /JavaBridge/JavaBridge.phpjavabridge. > , Internal error at col 4. Check the back end log for > details. You probably have some filter installed. For example mod_jk. You must allow PUT requests to the PHP/Java Bridge servlet, at least on the local interface, otherwise the front-end will not be able to connect to the servlet. Again, this is all working in a standard tomcat installation. You can its default settings, but you must know what you're doing. Regards, Jost Boekemeier __________________________________________________ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com |
|
From: <php...@li...> - 2008-09-24 19:03:09
|
Hi,
I followed your instructions to re-deploy the war file to apache tomcat at
port 8082 (Please remove all Java libraries from the jre lib/ext directory
and use a standard tomcat installation.Then remove the work/Catalina and
temp/* directories and restart tomcat. After that your (PHP/Java Bridge)
Java web application will start properly). Deployment is now successful, but
attempting to open any files in the directory JavaBridge (or this directory
itself) results in:
INFO: PHP application terminated unexpectedly, have you started php-cgi with
the environment setting PHP_FCGI_MAX_REQUESTS=5000? Trying again using a new
connection: php.java.servlet.fastcgi.ConnectionException
Sep 24, 2008 7:55:40 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet PhpCGIServlet threw exception
java.io.IOException: Protocol error
at
php.java.servlet.fastcgi.FastCGIInputStream.doRead(FastCGIInputStream.java:64)
at
php.java.servlet.fastcgi.FastCGIInputStream.read(FastCGIInputStream.java:51)
at
php.java.servlet.fastcgi.FastCGIServlet$CGIRunner.parseBody(FastCGIServlet.java:445)
at
php.java.servlet.fastcgi.FastCGIServlet$CGIRunner.doExecute(FastCGIServlet.java:371)
at
php.java.servlet.fastcgi.FastCGIServlet$CGIRunner.execute(FastCGIServlet.java:376)
at php.java.servlet.CGIServlet.handle(CGIServlet.java:400)
at php.java.servlet.PhpCGIServlet.handle(PhpCGIServlet.java:355)
at php.java.servlet.CGIServlet.doGet(CGIServlet.java:469)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
I also deployed the java bridge to a running Apache 2 server. There the
PHP_FCGI_MAX_REQUESTS is set to 10000, so that is not an issue. Pages can
then be accessed without the above error, but the only one working sort of
is the hello.php file. In the Apache error log it states though:
PHP Notice: Undefined index: language in C:\Program
Files\Zend\Apache2\htdocs\JavaBridge\hello.php on line 11
PHP Fatal error: Call to undefined function bindtextdomain() in C:\Program
Files\Zend\Apache2\htdocs\JavaBridge\hello.php on line 23
Clicking links to all other files leads to the error I mentioned in my
previous email:
===================================================================
protocol error: Method Not Allowed
The requested method PUT is not allowed for the URL
/JavaBridge/JavaBridge.phpjavabridge.
, Internal error at col 4. Check the back end log for details.
===================================================================
I get the same error when I simply access the JAVA/PHP bridge directory
running on localhost:8081 (which is the result of the installation of the
war file) and click the link to test.php.
About compiling the code: I did not include the php_java.dll in the php.ini
file. Also, there is no java related declaration in there. The only code I
compiled is the example code. To clarify perhaps: in the compiled code
option I compile the helloworld.java file in Netbeans IDE 6.0 and then try
to run the helloworld.java example (where I added the jar files to both the
jdk/jre directory and the jre directory of java 1.6.0_7 to run this code. As
said, I removed those files when testing usage via apache tomcat or apache
2). This then results in the mentioned:
Exception in thread "main" java.lang.NullPointerException
at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:636)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:116)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:100)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
It is this last one I am interested in most, as I want to call an existing
php based system from a stand-alone JAVA application. Any help to shed light
on all this would be really appreciated.
Perhaps the problem lies with my fastcgi settings of the php engine? The
settings of the fastcgi.conf file are:
Server type="application/x-httpd-php" CommandLine="C:\Program
Files\Zend\Core\bin\php-cgi.exe" ConnectionTimeout="30" RequestTimeout="60"
StartProcesses="8" Impersonate="1" SetEnv="PHP_FCGI_MAX_REQUESTS=10000"
SetEnv="PHP_FCGI_CHILDREN=1" SetEnv="PATH=?" SetEnv="TEMP=C:\Program
Files\Zend\Core\temp" SetEnv="OS=?" SetEnv="SystemRoot=?" SetEnv="ComSpec=?"
MinDynamicServers 8
MaxDynamicServers 16
IpcDir "C:\Program Files\Zend\Core\temp"
Thanks for all your efforts already!
Kind regards,
Bart
|
|
From: <php...@li...> - 2008-09-23 19:27:14
|
Hi,
You have mentioned that you have "compiled" the code yourself. This may mean that you have compiled Java to native code and declared the compiled extension in the php.ini file.
When using the pure Java PHP/Java Bridge doesn't work if there's a php_java.dll or java.so or a java declaration in you php.ini file(s).
Version 5.2.2.3 contains a workaround for this problem,
please see the ChangeLog for details:
* server/php/java/script/SimplePhpScriptEngine.java (setNewContextFactory): The java.so
and php_java.dll must not trash the pure Java PHP/Java Bridge implementation. Override
any settings from the java.so or php_java.dll and use our own settings.
* VERSION, php-java-bridge.spec: Version 5.2.2.3 released
> FAIL - Application at context path /JavaBridge could not be
> started
This doesn't have anything to do with the PHP/Java Bridge. Please follow the standard procedure to create a clean environment and start again:
Please remove all Java libraries from the jre lib/ext directory and use a standard tomcat installation.
Then remove the work/Catalina and temp/* directories and restart tomcat. After that your (PHP/Java Bridge) Java web application will start properly.
If that doesn't work please check the tomcat log for any exceptions/error reports. The localhost*.log contains a detailed description why the web application could not be started. If you see ClassCastExceptions or class loader exceptions or errors there, make sure that your libraries are loaded from one place.
If that still doesn't work, please contact the tomcat developers.
Regards,
Jost Boekemeier
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
|
|
From: <php...@li...> - 2008-09-23 11:34:43
|
Hi Jost, the version I am using is from the PHP/JavaBridge web site, entitled php-java-bridge_5.2.2_j2ee.zip. I re-did the installation procedure and tested the result.html page. I receive the output correctly there: BEGIN Starting a simple servlet engine: [C:\Program Files\Java\jre1.6.0_07\bin\java, -jar, C:\Data\RAND\MMIC\java php bridge\php-java-bridge_5.2.2_j2ee\ext\JavaBridge.jar, SERVLET_LOCAL:8081] Sep 23 12:56:55 VMBridge INFO : VM : 1.6.0_07@ http://java.sun.com/ Sep 23 12:56:55 VMBridge INFO : VMBridge version : 5.2.2 Sep 23 12:56:55 VMBridge INFO : logFile : Sep 23 12:56:55 VMBridge INFO : default logLevel : 3 Sep 23 12:56:55 VMBridge INFO : socket : SERVLET_LOCAL:8081 Sep 23 12:56:55 VMBridge INFO : java.ext.dirs : C:\Program Files\Java\jre1.6.0_07\lib\ext;C:\Windows\Sun\Java\lib\ext Sep 23 12:56:55 VMBridge INFO : php.java.bridge.base: C:\Users\bartorriens Sep 23 12:56:55 VMBridge INFO : thread pool size : 20 Sep 23 12:56:55 VMBridge INFO : JavaBridgeRunner started on port INET_LOCAL:8081 Invoking php: [php-cgi, -n, -d, allow_url_include=On, C:\Data\RAND\MMIC\java php bridge\php-java-bridge_5.2.2_j2ee\test.php] Now check the C:\Data\RAND\MMIC\java php bridge\php-java-bridge_5.2.2_j2ee\RESULT.html. Read the INSTALL.J2EE and/or INSTALL.J2SE documents. END I then copied the javabridge.jar and php-script.jar to the JRE lib/ext directory. Next I attempted to deploy the standard WAR file to Apache Tomcat (running on port 8081) using the Tomcat's applications manager. However, I got the error FAIL - Application at context path /JavaBridge could not be started I also attempted to run examples found in the 'documentation/server/test' directory using NetBeans IDE, specifically the helloworld.java code and the simpleinvocation.java code. In both cases the result when running it is: Exception in thread "main" java.lang.NullPointerException at java.lang.reflect.Proxy.getInvocationHandler(Proxy.java:636) at php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:116) at php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:100) at php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108) The Jscript I attempted to use, but it is not recognized as a valid command under Vista. It should be created during installation? Any help on what I'm doing wrong here/left out to do would be much appreciated! Kind regards, Bart On Mon, Sep 22, 2008 at 10:49 PM, < php...@li...> wrote: > Hi, > > I am sorry, but I could not reproduce these problems. The bridge works fine > unless you try to mix different versions or even different libraries. > > Which version of the bridge do you use? Are you sure that you use the > PHP/Java Bridge or do you use something else? > > > Can you please post the results of the following calls: > > jrunscript -classpath JavaBridge.jar -l php-interactive > > > echo java("php.java.bridge.Util")->VERSION > > > Can you please deploy the standard JavaBridge.war and click on the > jsr223.jsp and php+jsp.jsp examples? > > > Regards, > Jost Boekemeier > > > __________________________________________________ > Do You Yahoo!? > Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz > gegen Massenmails. > http://mail.yahoo.com > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's > challenge > Build the coolest Linux based applications with Moblin SDK & win great > prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > -- The new is always the old. Everything that's old was once new, and everything that's new will one day be old. The oldest thing of all is the present, because there's never been anything else but the present. No one has ever lived in the past, and no one lives in the future, either. |
|
From: <php...@li...> - 2008-09-22 20:49:44
|
Hi,
I am sorry, but I could not reproduce these problems. The bridge works fine unless you try to mix different versions or even different libraries.
Which version of the bridge do you use? Are you sure that you use the PHP/Java Bridge or do you use something else?
Can you please post the results of the following calls:
jrunscript -classpath JavaBridge.jar -l php-interactive
> echo java("php.java.bridge.Util")->VERSION
Can you please deploy the standard JavaBridge.war and click on the jsr223.jsp and php+jsp.jsp examples?
Regards,
Jost Boekemeier
__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails.
http://mail.yahoo.com
|
|
From: <php...@li...> - 2008-09-22 13:56:39
|
Dear all,
I am new to the PHP/Java bridge and trying to run the standard examples. I'm
trying to connect Java 1.6.0.6 with PHP 5.2.2 to call PHP from JAVA using
the scripting engine. The installation itself via the copy statement was
fine. I tried two options, in both cases the code compiles and seems to
connect to the PHP engine,but the results are not as hoped for:
// OPTION 1
javax.script.ScriptEngineManager manager = new
javax.script.ScriptEngineManager();
javax.script.ScriptEngine e = manager.getEngineByName("php-invocable");
e.eval("<?php class f {function a($p) {return java_values($p)+1;}}\n" +
"java_context()->setAttribute('f', java_closure(new f()), 100); ?>");
javax.script.Invocable i = (javax.script.Invocable)e;
Object f = e.getContext().getAttribute("f", 100);
System.out.println("Invoking");
String res = (String) i.invokeMethod(f, "a", new Object[] {new Integer(1)});
Sytem.out.println("Output: " + res);
e.eval ((java.io.Reader) null);
This leads to a null pointer exception after printing the line 'invoking'
when trying to call invokeMethod. That is, locating the 'f' function does
not lead to an object.
OPTION 2
System.out.println("Interactive engine");
javax.script.ScriptEngine e2 = (new
javax.script.ScriptEngineManager()).getEngineByName("php-interactive");
e2.eval("$v = 1+2");
System.out.println(e2.eval("echo $v"));
e2.eval((String)null);
This leads to a stack overflow exception:
Exception in thread "main" java.lang.StackOverflowError
at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:97)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
at
php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:91)
at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:97)
at
php.java.script.InvocablePhpScriptEngine.invokeFunction(InvocablePhpScriptEngine.java:108)
at
php.java.script.InteractivePhpScriptEngine.eval(InteractivePhpScriptEngine.java:91)
at
javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at
php.java.script.InvocablePhpScriptEngine.invoke(InvocablePhpScriptEngine.java:97)
and etceteras
Any suggestions here on what I'm doing wrong?
Thanks already for any suggestions you can provide!
Kind regards,
Bart Orriens
The new is always the old. Everything that's old was once new, and
everything that's new will one day be old. The oldest thing of all is the
present, because there's never been anything else but the present. No one
has ever lived in the past, and no one lives in the future, either.
|
|
From: <php...@li...> - 2008-09-20 15:56:00
|
Hi Jeff, > > However, you can subclass the > php/java/script/PhpServletScriptEngine.java > Thank you for your assistance with this. I will look into > doing that. I have changed the code accordingly. Please see the updated jsr223.jsp example: http://php-java-bridge.cvs.sourceforge.net/php-java-bridge/php-java-bridge/examples/php%2Bjsp/jsp%2Bphp.jsp?view=markup&sortby=date script=EngineFactory.getPhpScript(path, new StringReader("<?php...?>")); In order to link pre-existing scripts with JSP, you can call getPhpScript with a single argument: script=EngineFactory.getPhpScript(path/To/Your/PhpScript/w/o/.php); This way the PHP scripts can be cached, and you don't have to create a fresh String- or FileReader for each JSP invocation. Regards, Jost Bökemeier __________________________________________________ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com |
|
From: <php...@li...> - 2008-09-18 16:46:00
|
On Sun, Sep 14, 2008 at 12:00 PM, <php...@li...> wrote: >> Why not just [...] pass in the PHP script on standard input? > > because PHP needs a real file within the current working dir. Recent > versions of PHP cannot include PHP files from urls anyway, unless > you set the allow_url_include PHP option. > > However, you can subclass the php/java/script/PhpServletScriptEngine.java > to do what you want. Please see: > > http://php-java-bridge.cvs.sourceforge.net/php-java-bridge/php-java-bridge/server/php/java/script/PhpServletScriptEngine.java?view=markup > > You need to customize the > > protected Object eval(Reader reader, ScriptContext context, String name) throws ScriptException; > > method. Thank you for your assistance with this. I will look into doing that. -- Jeff Weston PGP public key available from http://pgp.mit.edu/ PGP Key ID: 0x14B456ED |
|
From: <php...@li...> - 2008-09-18 12:05:10
|
Hi, > > # java -jar JavaBridge.jar INET:8080 3 > "http://$host:$port/JavaBridge/java/Java.inc"; > > require_once($java_inc_filename); > This throw an exception in the "jasper Server" in order to require the Java.inc directly from the back-end, you need a servlet engine and set the PHP option -dallow_url_include=On Please change the above line to: java -jar JavaBridge.jar SERVLET:8080 3 Please see our documentation for details. Regards, Jost Boekemeier __________________________________________________ Do You Yahoo!? Sie sind Spam leid? Yahoo! Mail verfügt über einen herausragenden Schutz gegen Massenmails. http://mail.yahoo.com |