From: <php...@li...> - 2010-09-29 19:28:30
|
Hi, if your class is there, you can access it from php. Where is your code? On 9/28/10, php...@li... <php...@li...> wrote: > Here's my test JSP page (i don't use jsp, so my jsp code isn't great, but > its good enough to test) > > i rewrote the TestClass in a package jspTest as well. > The following works perfectly in tomcat....but i can't call the class from > PHP, which is what i need. > > <%@ page import= "jspTest.TestClass" %> > <jsp:useBean id= "MyTest" class= "jspTest.TestClass" scope= "session" /> > > <html> > <head><title>Number Guess</title></head> > <body bgcolor="white"> > <font size=4> > > <% MyTest.setTestString("From JSP"); %> > > Value set to <%= MyTest.getTestString() %> > > </font> > </body> > </html> > > Another thing is, my apache server for PHP does allow me to turn on the > allow_url_include option....i've changed in php.ini (both allow_url_include > & fopen) no effect. > would this be an issue? > > with this php/java bridge (java_include is a depreciated method.....so > require_once("java/Java.inc") must be there and the you instantiate the java > class immediately, right?) > -------------------------------------------------- > From: <php...@li...> > Sent: Tuesday, September 28, 2010 9:08 PM > To: <php...@li...> > Subject: Re: [Php-java-bridge-users] Using my own java classes with > php/javabridge > >> Sounds as if the class .test does not exist. Use package name and see >> FAQ fo details. >> >> >> >> On 9/28/10, php...@li... >> <php...@li...> wrote: >>> This is what the error log says....I took the code out of try...catch >>> block >>> so it could log the error. >>> >>> php[1992] >>> PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: >>> CreateInstance failed: new testClass. Cause: >>> java.lang.ClassNotFoundException: testClass VM: >>> 1.6.0_21@http://java.sun.com/" at: >>> #-30 >>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1666) >>> #-29 >>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511) >>> #-28 java.lang.Class.forName0(Native Method) >>> #-27 java.lang.Class.forName(Unknown Source) >>> #-26 php.java.bridge.Util.classForName(Util.java:1481) >>> #-25 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:429) >>> #-24 php.java.bridge.Request.handleRequest(Request.java:458) >>> #-23 php.java.bridge.Request.handleOneRequest(Request.java:510) >>> #-22 >>> php.java.servlet.PhpJavaServlet.handleLocalConnection(PhpJavaServlet.java:202) >>> #-21 php.java.servlet.PhpJavaServlet.handlePut(PhpJavaServlet.java:250) >>> #-20 php.java.servlet.PhpJavaServlet.doPut(PhpJavaServlet.java:261) >>> #-19 javax.servlet.http.HttpServlet.service(HttpServlet.java:644) >>> #-18 javax.servlet.http.HttpServlet.service(Ht in C:\Program Files >>> (x86)\Apache Software >>> Foundation\Apache2.2\htdocs\MyTestPHPJava\java\Java.inc on line 195 >>> >>> Event Xml: >>> <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> >>> <System> >>> <Provider Name="PHP-5.3.3" /> >>> <EventID Qualifiers="16384">2</EventID> >>> <Level>4</Level> >>> <Task>6</Task> >>> <Keywords>0x80000000000000</Keywords> >>> <TimeCreated SystemTime="2010-09-28T15:51:10.000000000Z" /> >>> <EventRecordID>26885</EventRecordID> >>> <Channel>Application</Channel> >>> <Computer></Computer> >>> <Security /> >>> </System> >>> <EventData> >>> <Data>php[1992]</Data> >>> <Data>PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: >>> CreateInstance failed: new testClass. Cause: >>> java.lang.ClassNotFoundException: testClass VM: >>> 1.6.0_21@http://java.sun.com/" at: >>> #-30 >>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1666) >>> #-29 >>> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511) >>> #-28 java.lang.Class.forName0(Native Method) >>> #-27 java.lang.Class.forName(Unknown Source) >>> #-26 php.java.bridge.Util.classForName(Util.java:1481) >>> #-25 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:429) >>> #-24 php.java.bridge.Request.handleRequest(Request.java:458) >>> #-23 php.java.bridge.Request.handleOneRequest(Request.java:510) >>> #-22 >>> php.java.servlet.PhpJavaServlet.handleLocalConnection(PhpJavaServlet.java:202) >>> #-21 php.java.servlet.PhpJavaServlet.handlePut(PhpJavaServlet.java:250) >>> #-20 php.java.servlet.PhpJavaServlet.doPut(PhpJavaServlet.java:261) >>> #-19 javax.servlet.http.HttpServlet.service(HttpServlet.java:644) >>> #-18 javax.servlet.http.HttpServlet.service(Ht in C:\Program Files >>> (x86)\Apache Software >>> Foundation\Apache2.2\htdocs\MyTestPHPJava\java\Java.inc on line >>> 195</Data> >>> </EventData> >>> </Event> >>> >>> -------------------------------------------------- >>> From: <php...@li...> >>> Sent: Monday, September 27, 2010 8:25 PM >>> To: <php...@li...> >>> Subject: Re: [Php-java-bridge-users] Using my own java classes with php >>> /javabridge >>> >>>> blank page means "syntax err" check php err log >>>> >>>> On 9/26/10, php...@li... >>>> <php...@li...> wrote: >>>>> Hi, >>>>> >>>>> i'm having issues getting my own java class working with php/java >>>>> bridge. >>>>> the bridge works perfect with the sample scripts and a script to get >>>>> the >>>>> date and display it, but as soon as i try using my own class, thats >>>>> when >>>>> the >>>>> plot thickens.... >>>>> >>>>> heres my simple class: >>>>> >>>>> public class testClass { >>>>> private String _testString; >>>>> >>>>> public testClass() { >>>>> } >>>>> >>>>> public void SetStringVal (String val) { >>>>> this._testString = val; >>>>> } >>>>> >>>>> public String GetStringVal() { >>>>> return this._testString; >>>>> } >>>>> >>>>> } >>>>> >>>>> i compiled it, made it into a jar file, then added it to the >>>>> web-inf/lib >>>>> folder in the JavaBridge template and deployed it with Tomcat (even >>>>> restarted tomcat) >>>>> >>>>> (i'm using Apache 2.2 for PHP scripts and tomcat for the >>>>> bridge....works >>>>> beautifully....) >>>>> >>>>> my PHP code: >>>>> >>>>> <?php >>>>> require_once("java/Java.inc"); >>>>> >>>>> $mClass = new java("testClass"); >>>>> >>>>> $mClass->SetStringVal("From Java"); >>>>> >>>>> echo $mClass->GetStringVal() ." to PHP"; >>>>> ?> >>>>> >>>>> I assume that i followed the steps correctly, but no luck....i just get >>>>> >>>>> a >>>>> blank page.... >>>>> >>>>> any help would be appreciated... >>>>> ------------------------------------------------------------------------------ >>>>> Start uncovering the many advantages of virtual appliances >>>>> and start using them to simplify application deployment and >>>>> accelerate your shift to cloud computing. >>>>> http://p.sf.net/sfu/novell-sfdev2dev >>>>> _______________________________________________ >>>>> php-java-bridge-users mailing list >>>>> php...@li... >>>>> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >>>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Start uncovering the many advantages of virtual appliances >>>> and start using them to simplify application deployment and >>>> accelerate your shift to cloud computing. >>>> http://p.sf.net/sfu/novell-sfdev2dev >>>> _______________________________________________ >>>> php-java-bridge-users mailing list >>>> php...@li... >>>> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >>>> >>> >>> ------------------------------------------------------------------------------ >>> Start uncovering the many advantages of virtual appliances >>> and start using them to simplify application deployment and >>> accelerate your shift to cloud computing. >>> http://p.sf.net/sfu/novell-sfdev2dev >>> _______________________________________________ >>> php-java-bridge-users mailing list >>> php...@li... >>> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >>> >> >> ------------------------------------------------------------------------------ >> Start uncovering the many advantages of virtual appliances >> and start using them to simplify application deployment and >> accelerate your shift to cloud computing. >> http://p.sf.net/sfu/novell-sfdev2dev >> _______________________________________________ >> php-java-bridge-users mailing list >> php...@li... >> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users >> > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |