From: <php...@li...> - 2006-06-11 05:27:17
|
I added some debug output to begin_header in client.c: case 'X':// Redirect { php_log_err("Got X"); php_log_err(str); char *key; static const char context[] = "X_JAVABRIDGE_CONTEXT"; static const char redirect[]= "X_JAVABRIDGE_REDIRECT"; if(!(*ctx)->peer_redirected && !strcmp(str, redirect)) { php_log_err("redirect"); And this is what I get: [Sat Jun 10 21:50:47 2006] [error] [client 127.0.0.1] Got X, referer: http://localhost:81/JavaBridge/index.php [Sat Jun 10 21:50:47 2006] [error] [client 127.0.0.1] X_javabridge_redirect, referer: http://localhost:81/JavaBridge/index.php But no 'redirect'; the header has been munged to Mixed case, so the strcmp against redirect fails. I suspect this is happening in the Web Server implementation of HttpServletResponse. HTTP spec (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2) states that header field names are case-insensitive, so the comparison should use strcasecmp. Changing strcmp to strcasecmp in lines 398, 414, 424 and 444 fixes the problem. Hope this is useful, and thanks again for a really useful tool :-) Cheers, Pat php...@li... wrote: > I successfully built php-java-bridge_3.0.8.3 on Solaris 10 U1 x86. I'm > now trying to deploy it. I have Apache 2.2 + PHP5 on the 'client' end, > Sun Java System Web Server 6.1 SP5 on the server end. > > In my php.ini, I have: > > extension = java.so > [java] > java.hosts = "127.0.0.1:80" > java.servlet = "/JavaBridge/JavaBridge.phpjavabridge" > java.log_level="4" > > > After some tweaks to fix some SJSWS specific issues (ensuring that all > directories in the pat to the shared docs directory are 755, changing > the ACL to allow PUT), I'm stuck. test.php hangs before it shows the > bottom of the page. > > The WS error log shows an NPE in GlobalRef.get. Here is the whole > interaction as logged at WS: > > [09/Jun/2006:23:10:33] info (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): JavaBridge DEBUG: @1a73d30 --> <C > v="java.lang.System" p="C" i="136880520" > > [09/Jun/2006:23:10:33] info (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): JavaBridge DEBUG: @1a73d30 --> </C> > [09/Jun/2006:23:10:33] info (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): JavaBridge DEBUG: @1a73d30 <-- <O > v="1" p="O" i="136880520"/> > [09/Jun/2006:23:10:33] info (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): JavaBridge DEBUG: @1a73d30 > re-directing to port# Pipe:/var/tmp//.php_java_bridgeC3a4CQ > [09/Jun/2006:23:10:33] info (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): JavaBridge DEBUG: @1a73d30 --> <I > v="1" m="getProperties" p="I" i="136886208" > > [09/Jun/2006:23:10:33] info (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): JavaBridge ERROR: An exception occured > [09/Jun/2006:23:10:33] failure (21795): for host 127.0.0.1 trying to PUT > /JavaBridge/JavaBridge.phpjavabridge, service-j2ee reports: WEB2798: > [/JavaBridge] ServletContext.log(): > java.lang.NullPointerException > at php.java.bridge.GlobalRef.get(GlobalRef.java:30) > at php.java.bridge.Request.getGlobalRef(Request.java:88) > at php.java.bridge.Request.begin(Request.java:352) > at php.java.bridge.Parser.CALL_BEGIN(Parser.java:95) > at php.java.bridge.Parser.parse(Parser.java:156) > at php.java.bridge.Request.handleRequest(Request.java:460) > at php.java.bridge.Request.handleRequests(Request.java:493) > at > php.java.servlet.PhpJavaServlet.handleSocketConnection(PhpJavaServlet.java:213) > at php.java.servlet.PhpJavaServlet.doPut(PhpJavaServlet.java:260) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:908) > at > org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509) > at > com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161) > at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580) > > 30 seconds later, Apache reports: > > [Fri Jun 09 23:11:03 2006] [notice] child pid 21735 exit signal > Segmentation fault (11) > > Any idea what could be happening here? > > I'm trying to interpret the trace from the WS error file - extracting > the relevant stuff, it says: > > # $v = new JavaClass("java.lang.System"); > <C v="java.lang.System" p="C" i="136880520" > > </C> > <O v="1" p="O" i="136880520"/> > > re-directing to port# Pipe:/var/tmp//.php_java_bridgeC3a4CQ > > # $v->getProperties() > <I v="1" m="getProperties" p="I" i="136886208" > > > So the first method invocation returns an object reference '1', which is > then used in the second invocation, but, by then, this object doesn't > seem to exist. I can see the redirection to the named pipe in between > the two calls, but, from the stack trace, the client doesn't seem to be > following the redirect - it's just doing another PUT. > > It looks like the client should be setting the > X_JAVABRIDGE_OVERRIDE_HOSTS header to override the redirect, but, for > some reason, it doesn't, so the server doesn't know to preserve the > context in the second PUT. > > Does this all make sense? Any suggestions on tracking this down further? > > Cheers, > > Pat > -- ------------------------------------------------------------------------ Pat Patterson <mailto:pat...@su...> Federation Architect Superpatterns <http://blogs.sun.com/roller/page/superpat> blog, Planet Identity <http://planetidentity.org> Identity Management Products <http://www.sun.com/identity> /Sun Microsystems, Inc. <http://www.sun.com/>/ ------------------------------------------------------------------------ |