Hello David, Make sure the browser isn't doing a head request, in which case the request is 0 bytes since the browser is just checking whether it can just re-show the document stored in cache or whether it needs to re-grab the document from the server.
Jake Monday, December 02, 2002, 4:22:52 PM, you wrote: DN> I have a servlet that uses the DOMParser to parse an XML String from a DN> browser. It is working fine when it gets sent to Tomcat directly on DN> port 8080. It also parses the string when routed through apache the DN> first time, but fails on the second request. No exceptions are thrown. DN> This is from the error.log: DN> [Mon Dec 02 14:44:27 2002] [notice] Parent: Created child process 2800 DN> [Mon Dec 02 14:44:28 2002] [notice] Child 2800: Child process is running DN> [Mon Dec 02 14:44:28 2002] [notice] vm.init(): Jni lib: C:\Program DN> Files\Java\j2re1.4.1_01\bin\client\jvm.dll DN> [Mon Dec 02 14:44:28 2002] [notice] vm.openJvm2() Option: DN> -Djava.class.path=C:/Program Files/Apache Group/Tomcat DN> 4.1/bin/tomcat-jni.jar DN> [Mon Dec 02 14:44:28 2002] [notice] vm.openJvm2() Option: DN> -Dtomcat.home=C:/Program Files/Apache Group/tomcat 4.1 DN> [Mon Dec 02 14:44:28 2002] [notice] vm.openJvm2() Option: DN> -Dcatalina.home=C:/Program Files/Apache Group/Tomcat 4.1 DN> [Mon Dec 02 14:44:28 2002] [notice] vm.openJvm2() Option: -Xmx128M DN> [Mon Dec 02 14:44:28 2002] [notice] vm.open2() done DN> [Mon Dec 02 14:44:28 2002] [notice] jni.validate() class= DN> org/apache/jk/apr/TomcatStarter DN> [Mon Dec 02 14:44:28 2002] [notice] Loaded DN> org/apache/jk/apr/TomcatStarter DN> [Mon Dec 02 14:44:28 2002] [notice] jni.init() setting stdout=C:/Program DN> Files/Apache Group/Apache2/logs/stdout.log... DN> [Mon Dec 02 14:44:28 2002] [notice] jni.init() setting stderr=C:/Program DN> Files/Apache Group/Apache2/logs/stderr.log... DN> [Mon Dec 02 14:44:29 2002] [notice] jni.init() ARG start DN> [Mon Dec 02 14:44:29 2002] [notice] jni.init() calling main()... DN> [Mon Dec 02 14:44:29 2002] [notice] jni.validate() class= DN> org/apache/jk/apr/TomcatStarter DN> [Mon Dec 02 14:44:29 2002] [notice] Loaded DN> org/apache/jk/apr/TomcatStarter DN> [Mon Dec 02 14:44:29 2002] [notice] jni.init() disabling the non init DN> hook worker DN> [Mon Dec 02 14:44:29 2002] [notice] uriMap: creating context */ROOT DN> [Mon Dec 02 14:44:29 2002] [notice] workerEnv.init() ok C:/Program DN> Files/Apache Group/Apache2/conf/workers2.properties DN> [Mon Dec 02 14:44:29 2002] [notice] mod_jk child init 1 -1 DN> [Mon Dec 02 14:44:29 2002] [notice] Child 2800: Acquired the start DN> mutex. DN> [Mon Dec 02 14:44:29 2002] [notice] Child 2800: Starting 250 worker DN> threads. DN> [Mon Dec 02 14:46:34 2002] [notice] service.init() Can't find child in DN> scoreboard 2800 DN> [Mon Dec 02 14:46:44 2002] [notice] channel_jni.open(): DN> [Mon Dec 02 14:46:44 2002] [error] channel_jni.open() Can't create java DN> context DN> [Mon Dec 02 14:46:44 2002] [error] channel_jni.send() no java context DN> [Mon Dec 02 14:46:44 2002] [notice] vm.detach() ok DN> [Mon Dec 02 14:46:44 2002] [notice] channel_jni.close() ok DN> [Mon Dec 02 14:46:44 2002] [error] ajp13.service() Error forwarding DN> ajp13:jni 1 0 DN> Below is the servlet code and a sample url request: DN> http://localhost/mapstedi/edu.colorado.geomuse.controller.mapstediContro DN> ller?xmlRequestType=ARCXML&xmlRequest=<ARCXML%20version="1.1"><REQUEST>< GET_IMAGE>><PROPERTIES><ENVELOPE%20minx="-180"%20miny="-90"%20maxx="180"% 20maxy="90"%20/>><IMAGESIZE%20height="340"%20width="500"%20/><BACKGROUND% DN> 20color="255,255,254"%20/></PROPERTIES></GET_IMAGE></REQUEST></ARCXML> DN> public void doGet(HttpServletRequest request, DN> HttpServletResponse response) throws IOException, DN> ServletException { DN> // Initialize variables DN> int xmlRequestType = 0; DN> String xmlRequestString = null; DN> PrintWriter clientWriter = null; DN> xmlRequestType = this.getRequestType(request); DN> xmlRequestString = this.getXMLRequestString(request); DN> switch (xmlRequestType) { DN> case 1: // ARCXML request send to mapHandler */ DN> // Create a Xerces DOM Parser DN> DOMParser parser = new DOMParser(); DN> parser.setErrorHandler(new XMLErrorHandler()); DN> ByteArrayInputStream bais = new DN> ByteArrayInputStream(xmlRequestString.getBytes()); DN> // Parse the Document DN> // and traverse the DOM DN> try { DN> parser.parse(new InputSource(bais)); DN> Document document = parser.getDocument(); DN> this.traverse (document); DN> parser = null; DN> document = null; DN> bais.close(); DN> bais = null; DN> System.out.println("vars set to null"); DN> } catch (SAXException e) { DN> System.out.println("SAXException thrown"); DN> System.err.println (e); DN> } catch (IOException e) { DN> System.out.println("IOException thrown"); DN> System.err.println (e); DN> } catch (Exception e) { DN> System.out.println("Exception thrown"); DN> System.err.println (e); DN> } DN> break; DN> case 2: // DGRXML request send to digirHandler DN> break; DN> default: // Generate error response DN> break; DN> } DN> response.setContentType("text/html"); DN> clientWriter = response.getWriter(); DN> clientWriter.println("<HTML><BODY>Request DN> received...</BODY></HTML>"); DN> } DN> public void doPost(HttpServletRequest request, DN> HttpServletResponse response) throws IOException, DN> ServletException { DN> doGet(request, response); DN> } DN> private int getRequestType(HttpServletRequest request) { DN> String xmlRequestTypeString = null; DN> int xmlRequestType = 0; DN> // Get xmlRequestType from request DN> xmlRequestTypeString = request.getParameter("xmlRequestType"); DN> if (xmlRequestTypeString != null) { DN> if (xmlRequestTypeString.toUpperCase().equals("ARCXML")) { DN> xmlRequestType = this.ARCXML; DN> } DN> if (xmlRequestTypeString.toUpperCase().equals("DGRXML")) { DN> xmlRequestType = this.DGRXML; DN> } DN> } DN> return xmlRequestType; DN> } DN> private String getXMLRequestString(HttpServletRequest request) { DN> String xmlRequestString = null; DN> // Get xmlString from request DN> xmlRequestString = request.getParameter("xmlRequest"); DN> return xmlRequestString; DN> } DN> // Traverse DOM Tree. Print out Element Names DN> private void traverse (Node node) { DN> int type = node.getNodeType(); DN> if (type == Node.ELEMENT_NODE) DN> System.out.println (node.getNodeName()); DN> NodeList children = node.getChildNodes(); DN> if (children != null) { DN> for (int i=0; i< children.getLength(); i++) DN> traverse (children.item(i)); DN> } DN> } DN> -- DN> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> DN> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- Best regards, Jacob mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
