Error Unable To Instantiate Parser Org.apache.xerces.parsers.saxparser
This Site Careers Other all forums Forum: XML and Related Technologies Cannot load xerces SAXParser Jeppe Sommer Ranch Hand Posts: 270 posted 6 years ago Hello, I have some serious problems with Xerces2 Java Parser 2.9.1. I am using Apache Tomcat/5.5.25 JVM 1.5.0_16-b02. I just downloaded Xerces2 version 2.9.1. I copied the following jar files into the library called: /apache-tomcat-5.5.25/shared/lib/ : resolver.jar serializer.jar xercesImpl.jar aml-apis.jar When I restart the container it seems to work fine. But it only works until I reload my application using Tomcat Web Application Manager. Then I get this error: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser I have searched the internet to solve the problem. It seems that several people have experienced the same problem, but I´m not sure how to work around this issue. Any help please would be appreciated? Log print from wrapper.log: | jvm 1 | 2010/02/25 12:36:00 | org.jdom.JDOMException: Could not load org.apache.xerces.parsers.SAXParser: SAX2 driver class org.apache.xerces.parsers.SAXParser not found: org.apache.xerces.parsers.SAXParser INFO | jvm 1 | 2010/02/25 12:36:00 | at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:531) INFO | jvm 1 | 2010/02/25 12:36:00 | at org.jdom.input.SAXBuilder.build(SAXBuilder.java:424) INFO | jvm 1 | 2010/02/25 12:36:00 | at org.jdom.input.SAXBuilder.build(SAXBuilder.java:810) INFO | jvm 1 | 2010/02/25 12:36:00 | at org.jdom.input.SAXBuilder.build(SAXBuilder.java:789) INFO | jvm 1 | 2010/02/25 12:36:00 | at module.oioxml.OIOXMLSetupParseXML.getInvoiceSetup(OIOXMLSetupParseXML.java:30) INFO | jvm 1 | 2010/02/25 12:36:00 | at module.oioxml.FTPOIOXMLData.sendUBLDocuments(FTPOIOXMLData.java:51) INFO | jvm 1 | 2010/02/25 12:36:00 | at scheduler.SendUBLDocuments.sendOIOXMLFiles(SendUBLDocuments.java:42) INFO | jvm 1 | 2010/02/25 12:36:00 | at scheduler.SendUBLDocuments.execute(SendUBLDocuments.java:69) INFO | jvm 1 | 2010/02/25 12:36:00 | at org.quartz.core.JobRunShell.run(JobRunShell.java:202) INFO | jvm 1 | 2010/02/25 12:36:00 | at org.quartz.simpl.Simple
available 38 people starred this issue and may be notified of changes. Back to list Status: Obsolete Owner: ---- Closed: https://coderanch.com/t/484602/XML/load-xerces-SAXParser Sep 2012 Type-Defect Priority-Medium Language-Java log-3098757 Component-ThirdParty squash-1 Sign in to add a comment Reported by craig...@gmail.com, Apr 20, 2009 The default xerces SAX parser does not appear https://code.google.com/p/googleappengine/issues/detail?id=1367 to be available (or at least loadable using JDOM): Nested in javax.servlet.ServletException: Could not load default SAX parser: org.apache.xerces.parsers.SAXParser: SAX2 driver class org.apache.xerces.parsers.SAXParser not found: org.apache.xerces.parsers.SAXParser: org.jdom.JDOMException: Could not load default SAX parser: org.apache.xerces.parsers.SAXParser: SAX2 driver class org.apache.xerces.parsers.SAXParser not found: org.apache.xerces.parsers.SAXParser at org.jdom.input.SAXBuilder.createParser(SAXBuilder.java:581) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:424) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:851) at jdomprob.ExampleServlet.doGet(ExampleServlet.java:24) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1093) at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionF ilter.java:35) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1084) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans actionCleanupFilter.java:43) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle r.java:1084) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionH andlerMap.java:237) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) at org.mortbay.j
riverrat.testing; 00002 00003 import org.xml.sax.*; 00004 import org.xml.sax.helpers.*; 00005 00010 public class XMLFakeServer extends FakeServer { 00012 protected static String file = "race.xml"; 00013 00015 protected http://web.mit.edu/riverrat/docs/html/XMLFakeServer_8java-source.html boolean DELAY_INPUT = true; 00016 00018 public XMLFakeServer() { 00019 super(); 00020 } 00021 00023 public XMLFakeServer(int newport) { 00024 super(newport); 00025 } 00026 00030 public https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014899163 void mainServer() { 00031 openFile(file, DELAY_INPUT); 00032 00033 //initialize parser 00034 DefaultHandler defaulthandler = (DefaultHandler) this; 00035 XMLReader parser = null; 00036 try { //instantiate error unable parser 00037 parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); 00038 } catch (Exception e) { 00039 System.err.println("Error: Unable to instantiate parser."); 00040 } 00041 00042 //set parser features 00043 try { 00044 parser.setFeature("http://xml.org/sax/features/namespaces",true); 00045 parser.setFeature("http://xml.org/sax/features/validation",false); 00046 parser.setFeature("http://apache.org/xml/features/validation/schema",false); 00047 parser.setFeature("http://apache.org/xml/features/validation/schema-full-checking",false); 00048 } catch (SAXException e) { 00049 System.err.println("warning: Parser doesn't support features... "+e); 00050 } 00051 error unable to 00052 parser.setContentHandler(defaulthandler); 00053 //tells the XML parser to use the defaulthandler (the BasicServer object) to handle callbacks 00054 parser.setErrorHandler(defaulthandler); 00055 //tells the XML parser to use the defaulthandler for errors 00056 00057 //parse, using callbacks in this class 00058 InputSource source = new InputSource(fileInputStream); 00059 source.setSystemId(""+filename); 00060 if(source == null) { 00061 System.err.println("InputSource is null!"); 00062 System.exit(1); 00063 } 00064 try { 00065 parser.parse(source); 00066 } catch(NullPointerException e) { 00067 System.err.println("NullPointerException trying to parse. This probably means that the ContentHandler class is null."); 00068 } catch(Exception e) { 00069 System.err.println("Parse error."); 00070 } 00071 } 00072 00079 public static void main(String args[]) { 00080 if(args.length != 0) { 00081 //get filename from 1st argument 00082 filename = args[0]; 00083 } 00084 XMLFakeServer testserver = new XMLFakeServer(); 00085 Thread serverthread = new Thread(testserver); 00086 serverthread.start(); 00087 00088 while(true) { 00089 System.out.println("This is the main loop."); 00090 try { 00091 Thread.sleep(10000); 00092 } catch(Inte
WebSphere > Forum: IBM Web Experience Factory - Getting Started (Installation, Configuration and Deployment) > Topic: RuntimeException: Could not instantiate parser org.apache.xerces...in WASCE 1 reply Latest Post - 2012-10-18T13:53:16Z by mburati Display:ConversationsBy Date 1-2 of 2 Previous Next SystemAdmin 110000D4XK 1493 Posts Pinned topic RuntimeException: Could not instantiate parser org.apache.xerces...in WASCE 2012-10-18T05:01:11Z | Tags: Answered question This question has been answered. Unanswered question This question has not been answered yet. Hi,all When i migrate my project from WAS to WASCE, In my project use xerces.jar and castor-xml.jar to parse xml config file,there occurs following errror: ================ server.log java.lang.RuntimeException: Could not instantiate parser org.apache.xerces.parsers.SAXParser: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser at org.exolab.castor.util.LocalConfiguration.getParser(LocalConfiguration.java:342) at org.exolab.castor.util.LocalConfiguration.getParser(LocalConfiguration.java:273) at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:703) at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:588) at com.dxz.parse.BookUnmarshall.unmarshall(BookUnmarshall.java:29) ... ... ================ This behavior does not occur in websphere,weblogic,jboss and EAserver. For verify this error,i wirte a demo as attached,after deployed this demo, visit http://localhost:8080/TestWASCE/index.jsp will call unmarshaller.unmarshal() method. ******************** java code: mapping.loadMapping("c:/temp/wasce/book-mapping.xml"); FileReader reader = new FileReader("c:/temp/wasce/sample.xml"); Unmarshaller unmarshaller = new Unmarshaller(BookInfo.class); BookInfo book = (BookInfo)unmarshaller.unmarshal(reader); //occur error unmarshaller.setMapping(mapping); System.out.println("Subject "+book.getSubject()); xml file: c:/temp/wasce/1.xml