【问题标题】:Spring SAML + Wildfly 8 + IBM Jdk (1.7) - java.lang.RuntimeException: org.w3c.dom.ls.LSException: [ERR 0462] An unsupported encoding is encounteredSpring SAML + Wildfly 8 + IBM Jdk (1.7) - java.lang.RuntimeException: org.w3c.dom.ls.LSException: [ERR 0462] 遇到不支持的编码
【发布时间】:2016-06-14 19:32:17
【问题描述】:

在使用 IBM JDK 1.7 的 Wildfly 8 中部署 spring-saml 应用程序时出现错误。有趣的是,谷歌搜索没有得到任何答案。

错误堆栈跟踪是

Caused by: org.w3c.dom.ls.LSException: [ERR 0462] An unsupported encoding is encountered.
at org.apache.xml.serializer.dom3.LSSerializerImpl.write(Unknown Source) [xml.jar:]
at org.opensaml.xml.util.XMLHelper.writeNode(XMLHelper.java:892)
at org.opensaml.xml.util.XMLHelper.writeNode(XMLHelper.java:872)
at org.opensaml.xml.util.XMLHelper.nodeToString(XMLHelper.java:834)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:159)
at org.opensaml.xml.XMLConfigurator.load(XMLConfigurator.java:143)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:203)
at org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:186)
at org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:92)
at org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)
at org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:696)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:461)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:194)

有什么想法吗?

【问题讨论】:

    标签: spring spring-security saml-2.0 spring-saml


    【解决方案1】:

    我认为问题在于 opensaml.jarserializer.jar 之间的依赖关系。 当您使用 Spring Security SAML 插件时,您可能正在使用以下库(因为它们在演示应用程序中):

    • opensaml-2.6.1.jar
    • spring-security-config-3.1.2.jar
    • spring-security-core-3.2.1.jar
    • spring-security-web-3.2.1.jar
    • spring-security-saml2-core-1.0.2.jar

    Wildfly 8(以及 9)都包含 serializer-2.7.1.jbossorg-1.jar /modules/system/layers/base/org/apache/xalan/main) 这似乎与“标准” serializer-2.7.1.jar (https://mvnrepository.com/artifact/xalan/serializer/2.7.1 )。

    我比较了两个 jar,它们包含相同的类和资源,但是它们的大小不同。 “标准”版本是用 IBM JDK 1.3.1 编译的,JBoss 版本是用 Oracle JDK 1.6_20 编译的——这基于两个 MANIFEST.MF 文件。 注意 opensaml.jar 是使用基于 Maven 存储库信息的“标准”序列化程序库编译的。

    我正在寻找“标准”serializer-2.7.1.jar的源代码,但找不到。但是,我发现另一个 2.7.1 版本,这次来自 Spring,并与一个 JBoss 源进行比较,它们有一些差异。我假设如果我比较“标准”源代码,我会发现相同的。这不是我以前见过的简单的文件重命名。

    接下来我做了一些实验。 首先将 serializer-2.7.1.jar 放入我的 application.war/WEB-INF/lib,启动 Wildfly (v 8.2.1) 并且应用程序启动时没有任何问题。删除 JAR 并返回异常。

    接下来,我将 WF 的 xalan 模块 改为使用 serializer-2.7.1.jar 代替 serializer-2.7.1.jbossorg-1.jar strong>(删除了 jar 文件并编辑了 module.xml)。启动WF,令人惊讶的是,我得到了同样的例外。我什至尝试更改为 serializer-2.7.1.jbossorg-2.jar(包含 Wildfly 10)和 serializer-2.7.2.jar > (https://mvnrepository.com/artifact/xalan/serializer/2.7.2) 并且异常仍然发生。

    最后,我将模块更改回滚到原始状态并创建了一个自定义WF模块,包括serializer-2.7.1.jar,并在应用程序“jboss-部署结构.xml”。

    WAS 8.5.5WAS Liberty Profile 8.5.5 下突出显示应用程序启动时没有任何问题(或额外的 serializer.jar)非常重要。 (分别以生产 AS 和另一个开发 AS 为目标)。 Wildfly 中的自定义模块可以方便地避免在这种情况下修改应用程序 WAR。

    作为补充说明,作为解决此问题的测试的一部分,我升级到了最新的 Spring-Security (3.2.9)Open-SAML (2.6.4) 我需要升级到 serialize.jar 到 2.7.2

    附注我在同一个项目中与 Mahe 合作过,但他几个月前离开了,我得到了解决这个问题的任务。

    【讨论】:

      猜你喜欢
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-08
      • 1970-01-01
      • 1970-01-01
      • 2016-12-04
      • 2016-11-06
      相关资源
      最近更新 更多