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