[英]how to overcome SuchMethodError: com.sun.org.apache.xml.internal.serialize.OutputFormat
I run into this error on one box but not another, when using code to "pretty print" XML:当使用代码“漂亮地打印”XML 时,我在一个盒子上遇到了这个错误,但在另一个盒子上没有遇到这个错误:
ERROR! java.lang.NoSuchMethodError: com.sun.org.apache.xml.internal.serialize.OutputFormat.<init>(Lorg/w3c/dom/Document;)V
What could be the problem?可能是什么问题呢?
Turns out the box with the failure was running "JDK 11" so fix for me was to temporarily use "JDK 8" instead for now.原来出现故障的盒子正在运行“JDK 11”,所以对我来说修复是暂时使用“JDK 8”。 Appears replacement alternatives are discussed here
似乎在这里讨论了替代方案
I have got this warning: com.sun.org.apache.xml.internal.serialize.OutputFormat is Sun proprietary API and may be removed in a future release我收到了这个警告:com.sun.org.apache.xml.internal.serialize.OutputFormat 是 Sun 专有的 API,可能会在未来的版本中删除
See also Serialize DOM to FileOutputStream using Xerces and https://stackoverflow.com/a/9331063/32453 but I don't see an exact replacement.另请参阅使用 Xerces和https://stackoverflow.com/a/9331063/32453 将DOM 序列化为 FileOutputStream ,但我没有看到确切的替代品。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.