2

带有 Apache2、Tomcat7、PHP 5.5.10 的 Linux 服务器均已启动并正在运行

得到了这个项目,我们安装了一个用于生成报告的 JavaBridge,我在 xampp 环境中的 Windows pc 上像魅力一样工作,但在服务器上我得到一个 ClassNotFoundException。

我可以通过以下方式直接从站点访问 JavaBridge:

http://mysite:8080/JavaBridge/java/Java.inc

但是从 PHP 中我不断收到 ClassNotFoundException 这个错误

//getting Java.inc 
//acquired Java.incdisplay 
//java propertiesIn Java.inc
[[o:Exception]:"java.lang.Exception: CreateInstance failed: new com.nlrt.reportgenerator.ReportGenerator([o:PhpParserString], [o:PhpParserString], [o:PhpParserString]). 
Cause: java.lang.ClassNotFoundException: com.nlrt.reportgenerator.ReportGenerator VM: 1.6.0_27@http://java.sun.com/" at: 
#-32 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1701)      
#-31 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1546) 
#-30 java.lang.Class.forName0(Native Method) 
#-29 java.lang.Class.forName(Class.java:266) 
#-28 php.java.bridge.Util.classForName(Util.java:1518) 
#-27 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:445)
#-26 php.java.bridge.Request.handleRequest(Request.java:458) 
#-25 php.java.bridge.Request.handleOneRequest(Request.java:510) 
#-24 php.java.servlet.PhpJavaServlet.handleLocalConnection(PhpJavaServlet.java:202) 
#-23 php.java.servlet.PhpJavaServlet.handlePut(PhpJavaServlet.java:250)
#-22 php.java.servlet.PhpJavaServlet.doPut(PhpJavaServlet.java:261) 
#-21 javax.servlet.http.HttpServlet.service(HttpServlet.java:644) 
#-20 javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
#-19 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 
#-18 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
#-17 php.java.servlet.PhpCGIFilter.doFilter(PhpCGIFilter.java:126) 
#-16 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 
#-15 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
#-14 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) 
#-13 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 
#-12 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 
#-11 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) #-10 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) #-9 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) #-8 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) #-7 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) #-6 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) 
#-5 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579) 
#-4 org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307) 
#-3 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
#-2 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
#-1 java.lang.Thread.run(Thread.java:679) 
#0 /home/dev/public/sanome.com/public/java/Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(1, NULL, 'T', false) 
#1 /home/dev/public/sanome.com/public/java/Java.inc(360): java_Arg->getResult(false) 
#2 /home/dev/public/sanome.com/public/java/Java.inc(363): java_Client->getWrappedResult(false) 
#3 /home/dev/public/sanome.com/public/java/Java.inc(535): java_Client->getInternalResult() 
#4 /home/dev/public/sanome.com/public/java/Java.inc(1930): java_Client->createObject('com.nlrt.report...', Array) 
#5 /home/dev/public/sanome.com/public/devicePorts/FileManager.class.php(139): Java->Java('com.nlrt.report...', '372', '/home/dev/publi...', '{"result_id":"4...') 
#6 /home/dev/public/sanome.com/public/devicePorts/FileManager.class.php(65): FileManager->generateAndStreamPDF('1', '372') 
#7 /home/dev/public/sanome.com/public/devicePorts/FileManager.class.php(43): FileManager->handleGenerateAndStreamPDF() 
#8 /home/dev/public/sanome.com/public/report_generation/download_pdf.php(76): FileManager->__construct(Array, '1') 
#9 {main}]
//500 Encountered exception while trying to create ReportGenerator

访问所需资源的 PHP 代码如下:

try
{
    // we'll be using JavaBridge
    echo "getting Java.inc";
    require_once('../java/Java.inc');// http://sanome.com:8080/JavaBridge/java/Java.inc
    echo "acquired Java.inc";
    echo "display java properties";
    //echo java("java.lang.System")->getProperties();
    $reportGenerator = new java("com.nlrt.reportgenerator.ReportGenerator", $st_usage_id, $report_generator_directory, json_encode($results_array));
    echo "created reportGenerator";
}
catch(Exception $exception)
{
   var_dump($exception) ;//$exception;
}

所需的JAR 已打包并添加到JavaBridge 的WEB-INF/lib 目录中。

php.ini 文件也有配置

allow_url_include=On

我什至遵循了这些步骤,但我没有运气。

javabridge设置/安装问题

根据我提供的内容,有人可以帮助我吗?

请不要批评解决方案,因为它不是我的设计。我只是想让它工作,同时添加它。

谢谢你。

4

0 回答 0