Reset functionality??

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Reset functionality??

Pinocchio
Hi!
I have big problem. I used sitemesh and thymeleaf in company project. Everything was ok, before I add JSON resolver. Then I gave this error. I remove this resolver but still I have the same error. Do you have an idea what causes it?

java.lang.UnsupportedOperationException: This SAXParser, "org.apache.xerces.jaxp.SAXParserImpl", does not support the reset functionality.  Specification "null" version "null"
        javax.xml.parsers.SAXParser.reset(SAXParser.java:112)
        org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.doParse(AbstractNonValidatingSAXTemplateParser.java:180)
        org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplateUsingPool(AbstractNonValidatingSAXTemplateParser.java:121)
        org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplate(AbstractNonValidatingSAXTemplateParser.java:105)
        org.thymeleaf.TemplateRepository.getTemplate(TemplateRepository.java:269)
        org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1015)
        org.thymeleaf.TemplateEngine.process(TemplateEngine.java:978)
        org.thymeleaf.spring3.view.ThymeleafView.render(ThymeleafView.java:228)
        org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
        org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
        org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
        org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
        org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        org.sitemesh.webapp.contentfilter.ContentBufferingFilter.bufferAndPostProcess(ContentBufferingFilter.java:169)
        org.sitemesh.webapp.contentfilter.ContentBufferingFilter.doFilter(ContentBufferingFilter.java:126)
        org.sitemesh.config.ConfigurableSiteMeshFilter.doFilter(ConfigurableSiteMeshFilter.java:163)
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

mazzi
If you use maven, try to add this dependency:

                <dependency>
                        <groupId>xerces</groupId>
                        <artifactId>xercesImpl</artifactId>
                        <version>2.9.1</version>
                </dependency>
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

Pinocchio
It works. Thx. Why those it happen?
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

mazzi
Wrong dependencies. Different libraries.
Try to decompile the classes to see.
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

omaroman
In reply to this post by Pinocchio
I have a similar problem when deploying into WebLogic

]] Root cause of ServletException.
org.thymeleaf.exceptions.TemplateProcessingException: Exception processing template (index)
        at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1004)
        at org.thymeleaf.spring3.view.ThymeleafView.render(ThymeleafView.java:460)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.UnsupportedOperationException: This SAXParser, "weblogic.xml.jaxp.WebLogicSAXParser", does not support the reset functionality.  Specification "null" version "null"
        at javax.xml.parsers.SAXParser.reset(SAXParser.java:112)
        at weblogic.xml.jaxp.RegistryXMLReader.resetCachedSAXParsers(RegistryXMLReader.java:642)
        at weblogic.xml.jaxp.RegistryXMLReader.reset(RegistryXMLReader.java:636)
        at weblogic.xml.jaxp.RegistrySAXParser.reset(RegistrySAXParser.java:176)
        at org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.doParse(AbstractNonValidatingSAXTemplateParser.java:186)
        Truncated. see log file for complete stacktrace

Anybody knows how to solve this???
Thanks ahead of time
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

omaroman
I found a solution, but not as elegant as I wish.

Edit the file setDomainEnv.[cmd|sh] and insert the following lines:

...

# BEGIN: Specific SAXParser
JAVA_OPTIONS="${JAVA_OPTIONS} -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"
export JAVA_OPTIONS
# END: Specific SAXParser

...

JAVA_OPTIONS="${JAVA_OPTIONS}"
export JAVA_OPTIONS

# SET THE CLASSPATH

...

Does anybody knows how to specify this just for a WebApp and not the whole AppServer? Or is it possible to instruct Thymeleaf to use a specific SAXParser?
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

danielfernandez
Administrator
Thymeleaf 2.0.7 includes a fix for this. Now if a parser implementation does not support the 'reset' operation, it simply outputs a warning --only the first time-- and re-creates the parser.

For performance reasons, using a reset-enabled implementation like Xerces 2.9.1 is preferred, but Thymeleaf will work perfectly OK with parsers lacking this feature.

Regards,
Daniel.
Reply | Threaded
Open this post in threaded view
|

Re: Reset functionality??

Sagarovi21
In reply to this post by mazzi
Getting similar Issue:

Error Message
This DocumentBuilder, "oracle.xml.jaxp.JXDocumentBuilder", does not support the reset functionality.  Specification "null" version "null"

Stacktrace
java.lang.UnsupportedOperationException: This DocumentBuilder, "oracle.xml.jaxp.JXDocumentBuilder", does not support the reset functionality.  Specification "null" version "null"
        at javax.xml.parsers.DocumentBuilder.reset(DocumentBuilder.java:92)

Could you please advise?