Javax.xml.transform.TransformerConfigurationException:Could not compile stylesheet

Source: Internet
Author: User

Today, I encountered an exception when I tuned the code: Javax.xml.transform.TransformerConfigurationException:Could not compile stylesheet-fatal error: "Cannot mutate style sheet ", from the Internet to find a solution, the following paste out for later use."


The problem arises because the JDK's own xalan is castrated, and many features are not, such as Java-type method calls. What do we do?

The official Java notation is:

Apache-the Org.apache classes, which has never been supported J2SE APIs but is used by the Javax.xml package, which has MOV Ed in 5.0 to Com.sun.org.apache.package.internal so this they won ' t clash with more recent, developer-downloaded versions of the classes. Any applications this depend on the Org.apache classes being part of the J2SE release must does one of the following to work In 5.0:

Code the application so it uses only the supported interfaces that is part of the JAXP.
Download the Org.apache.xalan classes from Apache.


In short, the JDK has integrated some Apache libraries from 1.5 onwards, but changed the package name from Org.apache to com.sun.org.apache.package.internal to avoid collisions. So those castrated parts can safely put Apache bags into the classpath without fear of conflict. So just download a Xalan.jar package and put it in the project to solve this problem


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.