I try to load the "Tasks" from a .mpp-File.
If I get the current date by java.util.Date
it works very fine, to access JAVA
but if i try to access the MPPReader I get the error:
CreateInstance failed: new net.sf.mpxj.mpp.MPPReader. Cause: java.lang.ClassNotFoundException
This is the code to my test case.
define("JAVA_SERVLET", false);
define("JAVA_HOSTS", 9267);
$mpxjPath = getcwd()."/libs/java/mpxj-5.6.0.jar";
exec("java -cp $mpxjPath");
require_once("libs/java/Java.inc");
$date = new java('java.util.Date');
echo $date;
$project = new java('net.sf.mpxj.mpp.MPPReader');
This is the output in the browser
Wed Feb 01 08:53:43 CET 2017
Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new net.sf.mpxj.mpp.MPPReader. Cause: java.lang.ClassNotFoundException: net.sf.mpxj.mpp.MPPReader VM: 1.7.0_55@http://java.oracle.com/" at:
#-15 java.net.URLClassLoader$1.run(URLClassLoader.java:366)
#-14 java.net.URLClassLoader$1.run(URLClassLoader.java:355)
...
The output shows, that the java is reachable. But how can I access the MPPReader ?
Update
Server: CentOS 7
This is the code in my index.php
right now.
<?php
define("JAVA_HOSTS", 9267);
define("JAVA_SERVLET", false);
require_once("libs/java/Java.inc");
echo "<pre>";
$date = new java('java.util.Date');
echo $date;
$project = new java('net.sf.mpxj.mpp.MPPReader');
?>
Run Standalone
command on CentOS 7
java -cp "ext/JavaBridge.jar:libs/java/mpxj-5.6.0.jar" php.java.bridge.Standalone SERVLET:9267
This is the error.
Thu Feb 02 07:11:45 CET 2017PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new java.net.sf.mpxj.mpp.MPPReader. Cause: java.lang.ClassNotFoundException: java.net.sf.mpxj.mpp.MPPReader VM: 1.7.0_55@http://java.oracle.com/" at:
#-15 java.net.URLClassLoader$1.run(URLClassLoader.java:366)
#-14 java.net.URLClassLoader$1.run(URLClassLoader.java:355)
#-13 java.security.AccessController.doPrivileged(Native Method)
#-12 java.net.URLClassLoader.findClass(URLClassLoader.java:354)
#-11 java.lang.ClassLoader.loadClass(ClassLoader.java:425)
#-10 sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
#-9 java.lang.ClassLoader.loadClass(ClassLoader.java:358)
#-8 java.lang.Class.forName0(Native Method)
#-7 java.lang.Class.forName(Class.java:270)
#-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(Co in http://127.0.0.1:9267/JavaBridge/java/Java.inc on line 195