问题
On my locahost I am able to connect my php server codes to a java base code running on my netbeans via a javabridge imported class. The code for the java is below
public class Listener {
public static final String JAVABRIDGE_PORT = "xxxx";//8080
static final php.java.bridge.JavaBridgeRunner runner =
php.java.bridge.JavaBridgeRunner.getInstance(JAVABRIDGE_PORT);
/**
* @param args the command line arguments
* @throws java.lang.InterruptedException
*/
public static void main(String[] args) throws InterruptedException {
// TODO code application logic here
runner.waitFor();
System.exit(0);
}
}
but now am moving to this cool hosting site openshift
for production and I need to do the same exact thing. My confusion is what application do I use in my openshift to run my java code. A couple of options I see available are JBOSS
and TOMCAT
but not sure how to go about this and with little research I know both applications are java EE for running java in web applications but is it the right tool for me or is there something else.
回答1:
Going by this diagram (http://php-java-bridge.sourceforge.net/pjb/) it looks like what you need to do is create two applications on openshift. One for the php code (using the php cartridge) and one for the java code (using one of the servlet or application containers) and then configure the Java bridge to know where your Java application is hosted (what it's url is).
来源:https://stackoverflow.com/questions/38478878/connecting-php-and-java-via-a-javabridge-port-in-openshift