|
From: <php...@li...> - 2008-02-13 20:00:07
|
Hi,
I'm newby in PHP and PHP/Java bridge, and I have some doubt about it. It seems that I can not instantiate Java class from PHP in case that class imports some external library, regardless that library is available in jar file that I use. Here is the PHP code:
...
require_once('http://localhost:8080/JavaBridge/java/Java.inc');
java_require("moodleLOCMapper v0.003.jar");
$repository=new Java("depths.moodle.RepositoryFactory");
...
Java code
package depths.moodle;
import org.openrdf.sesame.repository.SesameRepository;
import depths.moodle.repository.Repository;
public class RepositoryFactory {
...
And here is the error:
javax.servlet.ServletException: PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new depths.moodle.RepositoryFactory. Cause: java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: org/openrdf/sesame/query/QueryEvaluationException. -- Unable to call constructor, see the README section "Java platform issues" for details. VM: 1.6.0_04@http://java.sun.com/" at:
Did I make some mistake here, or I have to create facade class in order to access this class?
Thanks
Zoran
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
|
|
From: <php...@li...> - 2008-02-14 09:04:10
|
Hi,
I found that this error is not connected with libraries used in Java. Rather it has something with proxy, as the error code refere to the Java.inc getProxy function. However, I don't have problem to access other java classes in the same package, as well as to access this class from Java code. Here is the complete error code I got:
Error (File: http://localhost:8080/JavaBridge/java/Java.inc, line 222): [[o:ClassNotFoundException]:"java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: org/openrdf/sesame/query/QueryEvaluationException. -- Unable to call constructor, see the README section "Java platform issues" for details." at: #-6 php.java.bridge.JavaBridge.getUnresolvedExternalReferenceException(JavaBridge.java:427) #-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:498) #-4 php.java.bridge.Request.handleRequest(Request.java:447) #0 http://localhost:8080/JavaBridge/java/Java.inc(259): java_ExceptionProxyFactory->getProxy(4, 'java.lang.Class...', true) #1 http://localhost:8080/JavaBridge/java/Java.inc(411): java_Arg->getResult(true) #2 http://localhost:8080/JavaBridge/java/Java.inc(417): java_Client->getWrappedResult(true) #3 http://localhost:8080/JavaBridge/java/Java.inc(621): java_Client->getResult() #4
http://localhost:8080/JavaBridge/java/Java.inc(1744): java_Client->invokeMethod(3, 'getCause', Array) #5 http://localhost:8080/JavaBridge/java/Java.inc(2112): java_JavaProxy->__call('getCause', Array) #6 [internal function]: java_exception->__call('getCause', Array) #7 C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test\test.php(18): java_InternalException->getCause() #8 {main}]
Thanks
Zoran
php...@li... wrote:
Hi,
I'm newby in PHP and PHP/Java bridge, and I have some doubt about it. It seems that I can not instantiate Java class from PHP in case that class imports some external library, regardless that library is available in jar file that I use. Here is the PHP code:
....
require_once('http://localhost:8080/JavaBridge/java/Java.inc');
java_require("moodleLOCMapper v0.003.jar");
$repository=new Java("depths.moodle.RepositoryFactory");
....
Java code
package depths.moodle;
import org.openrdf.sesame.repository.SesameRepository;
import depths.moodle.repository.Repository;
public class RepositoryFactory {
....
And here is the error:
javax.servlet.ServletException: PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new depths.moodle.RepositoryFactory. Cause: java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: org/openrdf/sesame/query/QueryEvaluationException. -- Unable to call constructor, see the README section "Java platform issues" for details. VM: 1.6.0_04@http://java.sun.com/" at:
Did I make some mistake here, or I have to create facade class in order to access this class?
Thanks
Zoran
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
|
|
From: <php...@li...> - 2008-02-14 09:08:39
|
Hi, > java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: > org/openrdf/sesame/query/QueryEvaluationException. -- Unable to call constructor, see the README > section "Java platform issues" for > details. VM: 1.6.0_04@http://java.sun.com/" at: Java has no "module system". The above message means that there's an open reference which cannot be resolved. Please re-read the README section "Java platform issues" and your Java documentation for details. If there's anything we can do to describe the problem more clearly, please let us know. Regards, Jost Boekemeier Heute schon einen Blick in die Zukunft von E-Mails wagen? Versuchen Sie´s mit dem neuen Yahoo! Mail. www.yahoo.de/mail |
|
From: <php...@li...> - 2008-02-14 17:30:51
|
Hi, Thank you for your quick answer. I have tried to resolved what you have write about this issue. Regardless I have some experiences with Java, I must admit that I'm not familiar with deploying it as JAR files. I have tried to google for some pages related to this issue, and I have resolved till now that it is related to the problem of how JAR references other JARS, and that somethimes it can cause "classnotfound" problems, but I didn't found anything that clearly explains how to struggle this issue. Could you suggest me some link that could be useful to resolve this. >Java has no "module system". The above message means that there's an open reference >which cannot be resolved. Could you please be more specific about this "open reference which cannot be resolved". In my Java class I don't have anything that could cause "org/openrdf/sesame/query/QueryEvaluationException" that is not handled from Java (I have attached this class, as well as php file that use it, if it could be helpful) Regards Zoran php...@li... wrote: Hi, > java.lang.ClassNotFoundException: Unresolved external reference: java.lang.NoClassDefFoundError: > org/openrdf/sesame/query/QueryEvaluationException. -- Unable to call constructor, see the README > section "Java platform issues" for > details. VM: 1.6.0_04@http://java.sun.com/" at: Java has no "module system". The above message means that there's an open reference which cannot be resolved. Please re-read the README section "Java platform issues" and your Java documentation for details. If there's anything we can do to describe the problem more clearly, please let us know. Regards, Jost Boekemeier Heute schon einen Blick in die Zukunft von E-Mails wagen? Versuchen Sie´s mit dem neuen Yahoo! Mail. www.yahoo.de/mail ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ php-java-bridge-users mailing list php...@li... https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users --------------------------------- Never miss a thing. Make Yahoo your homepage. |
|
From: <php...@li...> - 2008-02-14 18:23:10
|
Hi Zoran,
> references other JARS, and that somethimes it can cause "classnotfound"
this isn't a class not found exception. It is a hard error: NoClassDefFound.
> >Java has no "module system". The above message means that there's an
> open reference >which cannot be resolved.
>
> Could you please be more specific about this "open reference which
> cannot be resolved".
Not really. The only person who could resolve this issue is the person who has compiled the
class or library. You could look at the library docs, which probably include a section which lists
the libraries which must be linked together in order to build an executable.
Once you know which libraries to link, you can append them to the java_require path or
copy them to WEB-INF/lib/ and restart the J2EE server.
Regards,
Jost Boekemeier
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go
|
|
From: <php...@li...> - 2008-02-18 10:55:22
|
Hi,
>Not really. The only person who could resolve this issue is the person who has compiled
>the class or library. You could look at the library docs, which probably include a section
>which lists the libraries which must be linked together in order to build an executable.
I have resolved this issue. I have created jar file using Fat-Jar eclipse plugin. I have tested it from command prompt and it works fine. The main class is depths.moodle.MainClass which is executed successfully. However the following code
require_once('http://localhost:8080/JavaBridge/java/Java.inc');
java_require("moodleLOCMapper_fat.jar");
echo "<br>";
try{
$repository=new Java("depths.moodle.MainClass");
generates ClassNotFoundException for depth.moodle.MainClass in java_require() path (complete error code is given bellow.
>Once you know which libraries to link, you can append them to the java_require path or
>copy them to WEB-INF/lib/ and restart the J2EE server.
Could you tell me where exactly should this jar file reside. I have tried to put it at the same folder as test.php page that use it, or at the "Tomcat/webapps/JavaBridge/WEB-INF/lib". In both case, I got the same error message.
Error (File: http://localhost:8080/JavaBridge/java/Java.inc, line 222): [[o:ClassNotFoundException]:"java.lang.ClassNotFoundException: Could not find depths.moodle.MainClass in java_require() path. Please check the path and the SEL and File permissions." at: #-10 php.java.bridge.DynamicJavaBridgeClassLoader.loadClass(DynamicJavaBridgeClassLoader.java:284) #-9 java.lang.ClassLoader.loadClassInternal(Unknown Source) #-8 java.lang.Class.forName0(Native Method) #0 http://localhost:8080/JavaBridge/java/Java.inc(259): java_ExceptionProxyFactory->getProxy(2, 'java.lang.Class...', true) #1 http://localhost:8080/JavaBridge/java/Java.inc(411): java_Arg->getResult(true) #2 http://localhost:8080/JavaBridge/java/Java.inc(417): java_Client->getWrappedResult(true) #3 http://localhost:8080/JavaBridge/java/Java.inc(621): java_Client->getResult() #4 http://localhost:8080/JavaBridge/java/Java.inc(1744): java_Client->invokeMethod(1, 'getCause', Array) #5
http://localhost:8080/JavaBridge/java/Java.inc(2112): java_JavaProxy->__call('getCause', Array) #6 [internal function]: java_exception->__call('getCause', Array) #7 C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test\test.php(14): java_InternalException->getCause() #8 {main}] end of message.
[[o:Exception]:"java.lang.Exception: CreateInstance failed: new depths.moodle.MainClass. Cause: java.lang.ClassNotFoundException: Could not find depths.moodle.MainClass in java_require() path. Please check the path and the SEL and File permissions. VM: 1.6.0_04@http://java.sun.com/" at: #-10 php.java.bridge.DynamicJavaBridgeClassLoader.loadClass(DynamicJavaBridgeClassLoader.java:284) #-9 java.lang.ClassLoader.loadClassInternal(Unknown Source) #-8 java.lang.Class.forName0(Native Method) #0 http://localhost:8080/JavaBridge/java/Java.inc(259): java_ThrowExceptionProxyFactory->getProxy(1, NULL, false) #1 http://localhost:8080/JavaBridge/java/Java.inc(411): java_Arg->getResult(false) #2 http://localhost:8080/JavaBridge/java/Java.inc(414): java_Client->getWrappedResult(false) #3 http://localhost:8080/JavaBridge/java/Java.inc(596): java_Client->getInternalResult() #4 http://localhost:8080/JavaBridge/java/Java.inc(1947): java_Client->createObject('depths.moodle.M...', Array) #5
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test\test.php(8): Java->Java('depths.moodle.M...') #6 {main}]end
Regards
Zoran
php...@li... wrote:
Hi Zoran,
> references other JARS, and that somethimes it can cause "classnotfound"
this isn't a class not found exception. It is a hard error: NoClassDefFound.
> >Java has no "module system". The above message means that there's an
> open reference >which cannot be resolved.
>
> Could you please be more specific about this "open reference which
> cannot be resolved".
Not really. The only person who could resolve this issue is the person who has compiled the
class or library. You could look at the library docs, which probably include a section which lists
the libraries which must be linked together in order to build an executable.
Once you know which libraries to link, you can append them to the java_require path or
copy them to WEB-INF/lib/ and restart the J2EE server.
Regards,
Jost Boekemeier
Lesen Sie Ihre E-Mails jetzt einfach von unterwegs.
www.yahoo.de/go
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
php-java-bridge-users mailing list
php...@li...
https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
---------------------------------
Never miss a thing. Make Yahoo your homepage.
|