Wed, 04 Jun 08
JSTL 1.2 and “Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found” exception
I am using JSTL for a project. For such a standard, it’s a bit wierd to get started with. Sun provides a spec, but as far as I can see, you have to download the entire J2EE stack to get the jarfile. There’s not a lot of good documentation on getting started with it (this page, though dated and focusing on JSTL 1.0 and 1.1, was helpful).
One exception in particular dogged me. If you are trying to get started using Tomcat (my version is 6.0) and JSTL, and are getting this exception when you are using the JSTL tags, run, don’t walk to your nearest Xerces download center and place xercesImpl.jar, in your lib directory (I also needed Xalan, for JSTL 1.2, which I had to download from here):
HTTP Status 500 -
type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exceptionjavax.servlet.ServletException: javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found org.apache.jasper.servlet.JspServlet.service(JspServlet.java:274) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.cohomefinder.eightz.servlet.RequestDispatcher.doGet(RequestDispatcher.java:30) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)root cause
javax.xml.parsers.FactoryConfigurationError: Provider org.apache.xerces.jaxp.SAXParserFactoryImpl not found javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source) org.apache.taglibs.standard.tlv.JstlBaseTLV.validate(JstlBaseTLV.java:161) org.apache.taglibs.standard.tlv.JstlCoreTLV.validate(JstlCoreTLV.java:105) org.apache.jasper.compiler.TagLibraryInfoImpl.validate(TagLibraryInfoImpl.java:761) org.apache.jasper.compiler.Validator.validateXmlView(Validator.java:1774) org.apache.jasper.compiler.Validator.validate(Validator.java:1743) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:178) org.apache.jasper.compiler.Compiler.compile(Compiler.java:306) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:273) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) com.cohomefinder.eightz.servlet.RequestDispatcher.doGet(RequestDispatcher.java:30) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
Apache Tomcat/6.0.14
« Advice for Attending Technical Conferences | Permalink | Setting headers in a PHP include directive »
mark said,
June 19, 2008 at 3:35 pm
You can sometimes get around these problems defining the javax.xml.parsers.SAXParserFactory implementation class in the services directory inside you jar file
META-INF/services/javax.xml.parsers.SAXParserFactory
If you put the implementation bundled with the JVM running a main method with a javax.xml.parsers.SAXParserFactoy.newInstance().getClass().getName(), will let you know what that is.