javabirdge php_使用Php-Java Bridge

I am having trouble setting up the Php-Java Bridge setup properly.

I will explain what I have done.

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

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.

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");

?>

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

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

解决方案

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.

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值