From: <php...@li...> - 2008-05-09 20:41:06
|
Hi, I have the problem to create an instance of my class ProjectFactory which constructor has the argument of the type org.openrdf.sesame.repository.local.LocalRepository. I'm always gets an error when trying to create this class with the following code: $projectFact=new Java("depths.moodle.ProjectsFactory",$sesame); The error implies that I have provided illegal argument: Exception occured; mixed trace: java.lang.Exception: CreateInstance failed: new depths.moodle.ProjectsFactory((o:LocalRepository)[o:LocalRepository]). Cause: java.lang.IllegalArgumentException: argument type mismatch VM: 1.6.0_04@http://java.sun.com/ java stack trace: java.lang.Exception: CreateInstance failed: new depths.moodle.ProjectsFactory((o:LocalRepository)[o:LocalRepository]). Cause: java.lang.IllegalArgumentException: argument type mismatch VM: 1.6.0_04@http://java.sun.com/ at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:487) at php.java.bridge.Request.handleRequest(Request.java:447) at php.java.bridge.Request.handleRequests(Request.java:485) at php.java.bridge.http.ContextRunner.run(ContextRunner.java:140) at php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60) Caused by: java.lang.IllegalArgumentException: argument type mismatch ... 9 more Exception occured; mixed trace: java.lang.Exception: Invoke failed: [[o:Request$PhpNull]]->getAllProjects. Cause: java.lang.NullPointerException: call object is null, check the server log file(s). VM: 1.6.0_04@http://java.sun.com/ java stack trace: java.lang.Exception: Invoke failed: [[o:Request$PhpNull]]->getAllProjects. Cause: java.lang.NullPointerException: call object is null, check the server log file(s). VM: 1.6.0_04@http://java.sun.com/ at php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1016) at php.java.bridge.Request.handleRequest(Request.java:409) at php.java.bridge.Request.handleRequests(Request.java:485) at php.java.bridge.http.ContextRunner.run(ContextRunner.java:140) at php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60) Caused by: java.lang.NullPointerException: call object is null, check the server log file(s). ... 5 more Variable $sesame is an instance of this class that I have also get from Java. When I check it with $sesame->getClass() I get the class org.openrdf.sesame.repository.local.LocalRepository, but if I check it with $SesameClass=java("org.openrdf.sesame.repository.local.LocalRepository"); if (java_instanceof($sesame, $SesameClass)){ ... it seems that this is not an instance of this class. Can you give me any suggestions? Thanks Zoran --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. |
From: <php...@li...> - 2012-07-12 08:27:38
|
Hi; I set up Tomcat and JavaBridge.war as described in the documentation. I have JavaBridge application under webapps directory. All examples work fine. Then I copied my PHP scripts into JavaBridge and custom .jar files into JavaBridge/WEB-INF/lib. I get the following exceptions whenever I try to create an instance of a Java class. [[o:Exception]:"java.lang.Exception: CreateInstance failed: new net.windward.xmlreport.ProcessHtml((o:InputStream)[c:FileInputStream], (o:OutputStream)[c:ByteArrayOutputStream]). Cause: java.lang.IllegalArgumentException: argument type mismatch VM: 1.7.0_05@http://java.oracle.com/" at: #-9 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) #-8 sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) #-7 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) #-6 java.lang.reflect.Constructor.newInstance(Unknown Source) #-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:487) #-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 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(3, 'java.io.ByteArr...', 'T', false) #1 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(360): java_Arg->getResult(false) #2 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(363): java_Client->getWrappedResult(false) #3 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(535): java_Client->getInternalResult() #4 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(1929): java_Client->createObject('net.windward.xm...', Array) #5 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\sample\classes\ProcessHtml.php(41): Java->Java('net.windward.xm...', Object(JavaClass), Object(JavaClass)) #6 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\sample\runreport.php(34): ProcessHtml::CreateWithTemplateReport(Object(JavaClass), Object(JavaClass)) #7 {main}] Could someone help me to resolve this issue? I can't figure out why the exception is thrown. An instance of the ProcessHtml class created like this new Java("net.windward.xmlreport.ProcessHtml", $template, $report); the constructor of net.windward.xmlreport.ProcessHtml class accepts two parameters: java.io.InputStream and java.io.OutputStream. $template and $report are created like this $template = java("java.io.FileInputStream", "/path/to/a/file"); $report = java("java.io.ByteArrayOutputStream"); Sincerely, Igor Kolesnik |
From: <php...@li...> - 2012-07-12 09:26:09
|
Hi It states that there is an mismatch between your input parameters and the expected parameters in the method. Why are you creating the parameters (by the way it's new java...) in PHP. Why not create a Java side wrapper where you instantiate the input/outputstream? Something like callProcessHtml(String filename) and then do the call to ProcessHtml from there? Hermod -----Opprinnelig melding----- Fra: php...@li... [mailto:php...@li...] Sendt: 12. juli 2012 10:27 Til: php...@li... Emne: [Php-java-bridge-users] IllegalArgumentException problem Hi; I set up Tomcat and JavaBridge.war as described in the documentation. I have JavaBridge application under webapps directory. All examples work fine. Then I copied my PHP scripts into JavaBridge and custom .jar files into JavaBridge/WEB-INF/lib. I get the following exceptions whenever I try to create an instance of a Java class. [[o:Exception]:"java.lang.Exception: CreateInstance failed: new net.windward.xmlreport.ProcessHtml((o:InputStream)[c:FileInputStream], (o:OutputStream)[c:ByteArrayOutputStream]). Cause: java.lang.IllegalArgumentException: argument type mismatch VM: 1.7.0_05@http://java.oracle.com/" at: #-9 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) #-8 sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) #-7 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) #-6 java.lang.reflect.Constructor.newInstance(Unknown Source) #-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:487) #-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 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(232): java_ThrowExceptionProxyFactory->getProxy(3, 'java.io.ByteArr...', 'T', false) #1 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(360): java_Arg->getResult(false) #2 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(363): java_Client->getWrappedResult(false) #3 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(535): java_Client->getInternalResult() #4 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\java\Java.inc(1929): java_Client->createObject('net.windward.xm...', Array) #5 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\sample\classes\ProcessHtml.php(41): Java->Java('net.windward.xm...', Object(JavaClass), Object(JavaClass)) Java->#6 C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\webapps\JavaBridge\sample\runreport.php(34): ProcessHtml::CreateWithTemplateReport(Object(JavaClass), Object(JavaClass)) #7 {main}] Could someone help me to resolve this issue? I can't figure out why the exception is thrown. An instance of the ProcessHtml class created like this new Java("net.windward.xmlreport.ProcessHtml", $template, $report); the constructor of net.windward.xmlreport.ProcessHtml class accepts two parameters: java.io.InputStream and java.io.OutputStream. $template and $report are created like this $template = java("java.io.FileInputStream", "/path/to/a/file"); $report = java("java.io.ByteArrayOutputStream"); Sincerely, Igor Kolesnik ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ php-java-bridge-users mailing list php...@li... https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DNB Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the anti virus programs used in the DNB Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
From: <php...@li...> - 2012-07-14 08:45:15
|
You forgot the new keyword. java(...) returns the class([c...[) new java(...) an instance of that class ([o....]). |
From: <php...@li...> - 2008-05-10 19:35:30
|
> it seems that this is not an instance of this class. > Can you give me any suggestions? Moodle@ClassLoader1 is not assignment compatible with Moodle@ClassLoader2. In other words, you have more than one such library in your class path(s). Please see our class loading FAQ for details. Nicht vergessen! Am Sonntag, den 11. Mai ist Muttertag Geschenkideen, Gedichte & mehr: www.yahoo.de/muttertag |
From: <php...@li...> - 2008-05-10 20:46:32
|
Hi, >In other words, you >have more than one such library in your class path(s). The code that causes problem here calls function from another file which create an instance $projectFact=new Java("depths.moodle.ProjectsFactory",$sesame); Both files, the one that calls function and function itself have: java_requre($mylib.jar); Do you mean that this causes problem here? Do I have to delete this statement from called function? Zoran php...@li... wrote: > it seems that this is not an instance of this class. > Can you give me any suggestions? Moodle@ClassLoader1 is not assignment compatible with Moodle@ClassLoader2. In other words, you have more than one such library in your class path(s). Please see our class loading FAQ for details. Nicht vergessen! Am Sonntag, den 11. Mai ist Muttertag Geschenkideen, Gedichte & mehr: www.yahoo.de/muttertag ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ 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-05-12 12:16:33
|
> Both files, the one that calls function and function itself have: > java_requre($mylib.jar); I still think we should deprecate java_require() to avoid a misunderstanding like yours. -- Dynamic class loading is not really possible in Java. However, we've decided to keep java_require() and to recomment standard Java class loading instead. > Do you mean that this causes problem here? The above code doesn't do what you think it does. Please re-read the java_require() documentation: http://php-java-bridge.sourceforge.net/doc/faq.php#java-require > Do I have to delete this statement from called > function? Please remove the java_require() and copy your libraries to your J2EE server or copy them to Java's global repository. Regards, Jost Boekemeier Nicht vergessen! Am Sonntag, den 11. Mai ist Muttertag Geschenkideen, Gedichte & mehr: www.yahoo.de/muttertag |