使用Php-Java Bridge [英] Working with Php-Java Bridge

查看:475
本文介绍了使用Php-Java Bridge的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法正确设置 Php-Java Bridge 设置。

我会解释一下我的内容已经完成。

I will explain what I have done.


  • 我的网站是纯PHP的

  • 对于我们的付款交易流程,我们需要设置一个php-java桥

  • 我按照这个链接来设置桥 PHP-JAVA BRIDGE INSTALATION。

  • 在这里,我了解到我需要一台私人jvm来安装这座桥。

  • 因此,我使用我的c-panel在Private JVM中安装了apache-tomcat-6.0.14。安装后,它要求我将域映射到私有JVM。所以我将我的域example.com(这是唯一可用的选项)映射到它。

  • 然后它要求启用从Apache Web服务器到我的Java应用程序服务器的流量重定向(有一个复选框,我点击了它)

  • 最后它要我部署WAR文件(JavaBridge.WAR是我的文件),并且看起来很好

  • 现在,当我去 http://example.com/JavaBridge/ 时,我可以看到javabridge示例和它工作正常。

  • My site is in pure php
  • For our payment transaction process we need to set up a php-java bridge
  • I followed this link to setup the bridge PHP-JAVA BRIDGE INSTALATION.
  • Here I learned that I need to have a private jvm to install the bridge.
  • So 1st i installed apache-tomcat-6.0.14 in Private JVM using my c-panel. After instalation it asked me to Map a domain to private JVM. So I mapped my domain example.com (which is the only option available) to it.
  • Then it asked to enable a traffic redirection from Apache web server to my Java application server (there was a check box and i clicked it)
  • Finally it asked me to deploy the WAR File (JavaBridge.WAR was my file) and everthing seems fine
  • Now when i go to http://example.com/JavaBridge/ I could see the javabridge examples and it works fine.

SO FAR SO GOOD

现在我的问题从这里开始,当我尝试从php访问java类文件时。我创建了一个示例 test.php 并将以下代码放入其中。

Now my problem starts here when I try to access a java class file from php. A sample test.php is what I create and put the following code into it.

  <?php
        require_once("http://example.com:portnumber/JavaBridge/java/Java.inc");
        $System = java("java.lang.System");
        echo $System->getProperties(); //This Part echo's correctly and shows the data so it means i can access Java.inc Correctly

        $path_e24class = getcwd(). '/e24PaymentPipe.class'; //This part fails both test.php and java class file e24PaymentPipe.class are in the same directory in publich_html folder
        java_require($path_e24class);
        $pipe = new Java("e24PaymentPipe");
        $pipe->setAction("1");
?>

我的网站内容位于public_html文件夹中,WAR文件部署在私有jvm中。

My site contents reside in the public_html folder and the WAR file are deployed in private jvm.

这些是我收到的错误消息。

These are the error message am getting.

  1) Warning: java_require() not supported anymore. Please use tomcat or jee hot deployment instead 
  Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new e24PaymentPipe. Cause: java.lang.ClassNotFoundException: e24PaymentPipe VM:  1.6.0_22@http://java.sun.com/" at: #-10 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358) #-9 
 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204) #-8 
 java.lang.Class.forName0(Native Method) #-7 
 java.lang.Class.forName(Class.java:247) #-6 
 php.java.bridge.Util.classForName(Util.java:1518) #-5 
 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:445) #-4 
 php.java.bridge.Request.handleRequest(Request.java:458) #-3 
 php.java.bridge.Request.handleRequests(Request.java:500) #-2 
 php.java.bridge.http.ContextRunner.run(ContextRunner.java:145) #-1 
 php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60) #0 
 http://example.com:portnumber/JavaBridge/java/Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(3, 'java.util.Prope...', 'T', false) #1

最后我对java不太了解。所以我被困在这里不知道该做什么。

Finally I don't know much about the java. So am stuck here not knowing what to do.

推荐答案

这是一个很好的一步一步教程,其中显示了所需的一切!这有点旧(2007年),但不久前帮了我。

Here is a great step by step tutorial you can follow, which shows everything required! It is a little old (2007) but helped me a while ago.

还有另一种选择。您可以安装Apache Tomcat并在那里部署您的战争。只要您尊重端口设置,您可以在同一台计算机上同时运行httpd,同时运行多个tomcat实例。您甚至可以使用Apache httpd。

There is also another option. You can install Apache Tomcat and deploy your war there. You can have even multiple tomcat instances simultaneously with your httpd running at the same time on the same machine, as long as you respect the port settings. You can even front them with Apache httpd.

这篇关于使用Php-Java Bridge的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆