首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Weblogic 12c上的Spring

Weblogic 12c上的Spring
EN

Stack Overflow用户
提问于 2014-07-31 14:45:04
回答 3查看 2.4K关注 0票数 4

我目前正在开发一个应用程序,该应用程序使用Spring (http://projects.spring.io/spring-security-saml/)项目作为身份验证的一部分。我知道它还在RC中,但我们正在开发的应用程序也是如此。当部署到Tomcat7时,这个库已经集成并完全运行,但是在部署到WebLogic12c (12.0.1.2)时遇到了问题。在Weblogic上,在不抛出任何错误的情况下,断言值将被拆分为空、无错误。

问题似乎在于Xerces库。据我所知,Spring (由于OpenSAML)需要2.10.0,但Weblogic提供了2.8.0的Xerces库,我试图通过在projects WEB/lib文件夹中包含适当的xercesImpl和xml来更新Xerces库版本。这解决了Spring的解压缩问题,但破坏了Weblogics解析JSP页面的能力。我已经为下面的未升级和升级的Xerces异常提供了部分堆栈跟踪。如果有人知道如何正确解决这个问题,以便Spring能够在不破坏默认功能的情况下运行Weblogic,我将非常感激。

这是更新Xerces之前的堆栈跟踪。

代码语言:javascript
复制
2014-07-31 10:43:37,675 [[ACTIVE] ExecuteThread: '2' for queue:     'weblogic.kernel.Default (self-tuning)'] DEBUG org.apache.xml.security.algorithms.JCEMapper   - Request for U
RI http://www.w3.org/2001/04/xmlenc#aes256-cbc
2014-07-31 10:43:37,675 [[ACTIVE] ExecuteThread: '2' for queue:    'weblogic.kernel.Default (self-tuning)'] DEBUG org.apache.xml.security.encryption.XMLCipher    - JCE Algorithm
 = AES/CBC/ISO10126Padding
<Jul 31, 2014 10:43:37 AM EDT> <Error> <HTTP> <BEA-101020>     <[ServletContext@1538876008[app:intranet module:intranet.war path:null spec-version:3.0]]    Servlet failed with an
Exception
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:504)
    at java.lang.Integer.valueOf(Integer.java:582)
    at org.opensaml.common.SAMLVersion.valueOf(SAMLVersion.java:89)
    at org.opensaml.saml2.core.impl.AssertionUnmarshaller.processAttribute(AssertionUnmarshaller.java:71)
    at org.opensaml.xml.io.AbstractXMLObjectUnmarshaller.unmarshallAttribute(AbstractXMLObjectUnmarshaller.java:254)
    at org.opensaml.xml.io.AbstractXMLObjectUnmarshaller.unmarshall(AbstractXMLObjectUnmarshaller.java:113)
    at org.opensaml.xml.encryption.Decrypter.decryptDataToList(Decrypter.java:479)
    at org.opensaml.xml.encryption.Decrypter.decryptData(Decrypter.java:403)
    at org.opensaml.saml2.encryption.Decrypter.decryptData(Decrypter.java:141)
    at org.opensaml.saml2.encryption.Decrypter.decrypt(Decrypter.java:69)
    at org.springframework.security.saml.websso.WebSSOProfileConsumerImpl.processAuthenticationResponse(WebSSOProfileConsumerImpl.java:190)
    at org.springframework.security.saml.SAMLAuthenticationProvider.authenticate(SAMLAuthenticationProvider.java:82)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:156)
    at org.springframework.security.saml.SAMLProcessingFilter.attemptAuthentication(SAMLProcessingFilter.java:84)

这是将Xerces更新为2.10.0之后的堆栈跟踪。

代码语言:javascript
复制
weblogic.servlet.jsp.CompilationException: Failed to compile JSP /WEB-  INF/jsp/errors/500.jsp
500.jsp:1:1: The validator class: "org.apache.taglibs.standard.tlv.JstlCoreTLV" has       failed with the following exception: "java.lang.ClassCastException: weblogic.xml.jaxp.Re
gistrySAXParserFactory cannot be cast to javax.xml.parsers.SAXParserFactory".
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
^-------------------------------------------------------------^
500.jsp:2:5: No tag library could be found with this URI. Possible causes could be that     the URI is incorrect, or that there were errors during parsing of the .tld file.
<%@ taglib prefix="int" uri="intranet"%>
^----^
 500.jsp:2:5: No tag library could be found with this URI. Possible causes could be   that the URI is incorrect, or that there were errors during parsing of the .tld file.
<%@ taglib prefix="int" uri="intranet"%>
^----^
500.jsp:6:3: This tag can only appear as a subelement of a standard or custom action.    Exceptions are: jsp:body, jsp:attribute, jsp:expression, jsp:scriptlet, and jsp:declaration.
    <jsp:attribute name="minifiedJs">
     ^-----------^
 500.jsp:8:3: This tag can only appear as a subelement of a standard or custom action.   Exceptions are: jsp:body, jsp:attribute, jsp:expression, jsp:scriptlet, and jsp:declaration.
    <jsp:attribute name="nonMinifiedJs">
     ^-----------^
  500.jsp:11:3: This tag can only appear as a subelement of a standard or custom action. Exceptions are: jsp:body, jsp:attribute, jsp:expression, jsp:scriptlet, and jsp:declaration.
    <jsp:body>
     ^------^

    at weblogic.servlet.jsp.JavelinxJSPStub.reportCompilationErrorIfNeccessary(JavelinxJSPStub.java:243)
    at weblogic.servlet.jsp.JavelinxJSPStub.compilePage0(JavelinxJSPStub.java:179)
    at weblogic.servlet.jsp.JavelinxJSPStub.access$000(JavelinxJSPStub.java:50)
    at weblogic.servlet.jsp.JavelinxJSPStub$1.run(JavelinxJSPStub.java:108)
    at java.security.AccessController.doPrivileged(Native Method)
    at weblogic.servlet.jsp.JavelinxJSPStub.compilePage(JavelinxJSPStub.java:105)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:247)
    at weblogic.servlet.jsp.JspStub.prepareServlet(JspStub.java:200)
    at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:403)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:295)
    at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:478)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:367)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
    ...
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2014-08-02 10:48:45

以下方法允许在Weblogic中捆绑自定义Xerces和Xalan库:

  1. 创建ear存档spring-security-saml2-sample.ear
  2. 在ear中包含Spring文件spring-security-saml2-sample.war,war应该包含自己版本的Xerces和Xalan。
  3. 在ear中创建具有以下内容的文件META-INF/application.xml: 弹簧-安全.saml2 2-样本.战争弹簧.安全.saml2 2-样本
  4. 创建具有以下内容的文件META-INF/weblogic-application.xml: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl org.apache.xalan.processor.TransformerFactoryImpl org.opensaml.* org.apache.xerces* org.apache.xalan.*
  5. 部署存档
票数 1
EN

Stack Overflow用户

发布于 2014-07-31 20:27:26

以后再发生这种事的人。最后,我通过更新到xercesImpl版本2.9.0来解决这个问题。对于这个问题,这似乎是一个贴切的版本,尽管它比OpenSAML请求的要少--它修复了这个问题,同时也没有引起Weblogic的任何其他问题(就我目前所遇到的情况而言)。Xerces 2.10.0需要更新版本的xml才能运行,这导致了Weblogic出现问题(2.9.0似乎适用于Weblogic中包含的xml版本)。

票数 2
EN

Stack Overflow用户

发布于 2014-07-31 15:30:15

您玩过war文件的prefer-web-inf-classes或ear文件的prefer-application-packages吗?其中之一很可能解决问题:

在weblogic-application.xml中:

代码语言:javascript
复制
<wls:prefer-application-packages>
    <wls:package-name>org.apache.xerces.xni.parser.*</wls:package-name>
    <wls:package-name>org.apache.xerces.parsers.*</wls:package-name>
    <wls:package-name>org.apache.xalan.*</wls:package-name>
</wls:prefer-application-packages>

在weblogic.xml中:

代码语言:javascript
复制
<wls:container-descriptor>
    <wls:prefer-web-inf-classes>true</prefer-web-inf-classes>
</wls:container-descriptor>

看这些甲骨文文档

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25061918

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档