|
From: <php...@li...> - 2009-04-02 14:41:19
|
Hi Jost, Thank you for the swift reply. Both apache and tomcat servers are definitely up and running, I'm actually running it on my local machine. I have checked my tomcat server.xml config file and it seems as tho I'm not using AJP at all. That section is commented out. I did try to telnet to the webserver and it was accepting empty PUT commands for the resource /HelloWorldWebApp/ , but not for the .phpjavabridge resource. For this I code the status code 403. That's when I remembered I didn't put the servlet definitions in my web.xml. So I changed my web.xml to look like; <?xml version="1.0" encoding="UTF-8"?> <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>HelloWorldWebApp</display-name> <!-- PHP Servlet: back-end for Apache or IIS --> <servlet> <servlet-name>PhpJavaServlet</servlet-name> <servlet-class>php.java.servlet.PhpJavaServlet</servlet-class> <!-- Allow non-local PHP clients. Default is Off. --> <!-- Leave this off if your server is connected to the internet. --> <!-- <init-param> <param-name>promiscuous</param-name> <param-value>On</param-value> </init-param> --> <load-on-startup>0</load-on-startup> </servlet> <servlet-mapping> <servlet-name>PhpJavaServlet</servlet-name> <url-pattern>*.phpjavabridge</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> </web-app> However in my catalina.out log file I get the following error on startup; ERROR - Exception sending context initialized event to listener instance of class php.java.servlet.ContextLoaderListener java.lang.NoClassDefFoundError: javax/script/ScriptException Even with this however I can get JVM system info from my php scripts; $SystemClazz = Java("java.lang.System"); echo $SystemClazz->getProperties(); But calling my own defined classes I get the following error; Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[c:HelloWorld]]->getMessage. Cause: php.java.bridge.NoSuchProcedureException: static getMessage() The method and class are definitely there, contained in the WEB-INF/classes directory of my webapp. One last thing. Looking at the javabridge template I also added the following to my web.xml; <!-- support for J2EE cluster --> <distributable/> <!-- Override the define ("JAVA_HOSTS", "127.0.0.1:8080"); --> <!-- setting from your PHP script, Config.inc or Java.inc or --> <!-- JavaProxy.php, so that PHP connects back to the current VM. --> <context-param> <param-name>override_hosts</param-name> <param-value>On</param-value> </context-param> <!-- Attach the JSR223 script factory to the servlet context --> <listener> <listener-class>php.java.servlet.ContextLoaderListener</listener-class> </listener> However when I do this, the application simply fails to load and I cannot even retrieve system info. I get the following error message; [2009-04-02 15:05:59,978] ERROR - Error listenerStart [2009-04-02 15:05:59,978] ERROR - Context [/JavaBridge] startup failed due to previous errors [2009-04-02 15:05:59,979] ERROR - Exception sending context destroyed event to listener instance of class php.java.servlet.ContextLoaderListener java.lang.NoClassDefFoundError: javax/script/ScriptException ... Incidentally when I attempt to simply place the JavaBridgeTemplate.war into my webapps directory I have the same issue. Any ideas? I am running tomcat 5.5.25. Thank You On 2/4/09 13:03, "php...@li..." <php...@li...> wrote: > Hi, > > the php-servlet.jar is missing in the lib directory, please see the > JavaBridgeTemplate.war from the binary download as an example. > > However, the error message may mean that request.getServerPort() is lying, > this usually happens if mod_jk or AJP is installed but not yet configured, > see our last FAQ entry. > > The back end log is written to the standard tomcat log. > > Assuming that you know the http protocol, you can check the back end by > telnet'ing to 8080 and sending an empty PUT request: > > telnet localhost 8080 > PUT /HelloWorldWebApp/.phpjavabridge HTTP/1.0 > 2xenter > > Should return: http 200 Ok > > If not, your web app is not running. The reason should be in the tomcat log. > > Regards, > Jost Boekemeier > > Apr 2, 2009 1:29 nachm. schrieb am < > php...@li...>: > > Hi Guys, > > Just started using the bridge, wonderful product. I have successfully > managed to connect to my java app standalone, however I am experiencing > problems in getting a web app example up and running. All I'm trying to do > is call a java method from my php script, so I'm not interesting in running > php in a vm. If I understand correct, all I need to do is make the Java.inc > file available to the calling php script, place JavaProxy.php and > JavaBridge.jar in my classpath and the class files of whatever java app I'm > calling. > > > This is what the directory structure for the web app looks like; > > HelloWorldWebApp > | > |-WEB-INF > |-classes > |-lib > |-JavaBridge.jar > |-HelloWorld.jar > |-web.xml > |-META-INF > |-java > |-Java.inc > |-JavaProxy.php > > Now I can access my Java.inc file in my browser with the following url; > > http://localhost:8080/HelloWorldWebApp/java/Java.inc > > And my php looks like; > > <?php require_once("http://localhost:8080/HelloWorldWebApp/java/Java.inc"); > > $myClass = new java("test.HelloWorldTest"); > echo $myClass->getMessage(); > ?> > > Now everything seems fine to me, but I run the php script I get the > following error; > > "protocol error: > HTTP Status 403 - > > type Status report > > message > > description Access to the specified resource () has been forbidden. > Apache Tomcat/5.5.25 > . Check the back end log for details. " > > Now firstly why could this be happening and secondly how do I check the back > end log? > > I have set recursive permissions on that directory to allow access to all > the files and folders, but I still get the error. > > Any ideas? > -- > > Jaz Chana > Integration Specialist > Lean Practitioner > > Direct Dial: 0151 290 5917 > Email: jaz...@cd... > > Web: www.cdms.co.uk <http://www.cdms.co.uk/> > > > > ***************************************************************************** > > This email and its attachments are confidential to the intended recipient. > If this has come to you in error, please notify the sender immediately and > delete this email from your system. You must take no action based on this > email, nor must you copy or disclose it or any part of its contents to any > person or organisation. Please note that email communications may be > monitored. The registered office of CDMS Limited is First Floor, Skyways > House, Speke Road, Speke, Liverpool, L70 1AB, registered in England number > 00406869. > > ***************************************************************************** > > ------------------------------------------------------------------------------ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > ------------------------------------------------------------------------------ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > > > ***** This Email has been scanned for Viruses and SPAM by Blackspider > Mailcontrol. ***** > Click > https://www.mailcontrol.com/sr/7WmkR8Jsg7XTndxI!oX7UpRUG+IHZ5e6oz7AiS!Lx!8sRuw > rsLuNdtdxow7SW0jL2j!a2kADeZ62eN6FcXjHgg== to report this email as spam. -- Jaz Chana Integration Specialist Lean Practitioner Direct Dial: 0151 290 5917 Email: jaz...@cd... Web: www.cdms.co.uk <http://www.cdms.co.uk/> |