PHP/Java Bridge

software development

#1

Hi, I’m trying to use PHP/Java Bridge at my vps. I proceeded as the follow:

  • installed tomcat;
  • put into the webapps folder the file “JavaBridge.war”;
  • restarted tomcat;
  • accessed <mydomain.com>:8080/JavaBridge/java/Java.inc the result was as I expected;
  • accessed <mydomain.com>:8080/JavaBridge/ and I got the error posted below:
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: php.java.bridge.http.FCGIConnectException: Could not connect to server
	php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:133)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	java.lang.Thread.run(Thread.java:662)

root cause

php.java.bridge.http.FCGIConnectException: Could not connect to server
	php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
	php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	java.lang.Thread.run(Thread.java:662)

root cause

java.io.IOException: java.net.ConnectException: Connection refused
	php.java.bridge.http.FCGIConnectException.<init>(FCGIConnectException.java:37)
	php.java.bridge.http.SocketChannelFactory.test(SocketChannelFactory.java:58)
	php.java.servlet.fastcgi.FastCGIServlet.init(FastCGIServlet.java:131)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	java.lang.Thread.run(Thread.java:662)

root cause

java.io.IOException: PHP not found. Please install php-cgi. PHP test command was: [php-cgi, -v] 
	php.java.bridge.Util$Process.start(Util.java:1145)
	php.java.servlet.fastcgi.FCGIProcess.start(FCGIProcess.java:68)
	php.java.bridge.http.SocketChannelFactory.doBind(SocketChannelFactory.java:125)
	php.java.bridge.http.FCGIConnectionFactory.runFcgi(FCGIConnectionFactory.java:88)
	php.java.bridge.http.FCGIConnectionFactory$1.run(FCGIConnectionFactory.java:109)

Could someone help me?.. =/


#2

The PHP Java Bridge is not supported by DreamHost, and appears to be significantly outdated anyway. (The last release of the software was in 2010.)


#3

Hi Andrew,

My server is a VPS. After a few hours I made it work. I needed to set the file “/var/lib/tomcat6/webapps/JavaBridge/WEB-INF/web.xml”.
I set this:

to this:

And as you said, it is significantly outdated, but it was the only way the I found to join jasper reports into a php application. Do you have other suggestion for this case (jasper reports into a php application)?
I’ll be really thankful for your tips.


#4

I’m not personally familiar with Jasper Reports, so I can’t say for sure. I’d imagine there’s some way to generate a report from the command line, though, so it’d likely be better to have PHP code running a single Java command to generate the report, rather than having a Java server running PHP to do everything else.