简体   繁体   English

Weblogic 12.2.1和OpenSaml2发生冲突

[英]Weblogic 12.2.1 and OpenSaml2 conflict

I have a spring boot web service application that uses opensaml dependency (an old version, 2.2.3). 我有一个使用opensaml依赖项(旧版本2.2.3)的spring boot Web服务应用程序。 When I deploy to Weblogic I get: 当我部署到Weblogic时,我得到:

Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at org.opensaml.xml.XMLConfigurator.<clinit>(XMLConfigurator.java:60) ~[com.oracle.weblogic.security.opensaml2.jar:na]

The workaround I did is the same as this user: https://stackoverflow.com/a/20913280/2968729 . 我所做的解决方法与此用户相同: https : //stackoverflow.com/a/20913280/2968729 I renamed com.oracle.weblogic.security.opensaml2.jar so it would be ignored. 我将其重命名为com.oracle.weblogic.security.opensaml2.jar,因此它将被忽略。

As described on the error, weblogic has his own opensaml2.jar that uses log4j which isn't present on my application classpath and that's why fails. 如错误所述,weblogic拥有自己的opensaml2.jar ,该文件使用log4j ,而我的应用程序类路径中没有此log4j ,这就是失败的原因。

So the point is: I don't want to add log4j neither to use com.oracle.weblogic.security.opensaml2.jar but my opensaml from my classpath instead. 因此,重点是:我既不想添加log4j也不想使用com.oracle.weblogic.security.opensaml2.jar而是从类路径中com.oracle.weblogic.security.opensaml2.jar我的opensaml。 What is the proper way to achieve this? 实现此目标的正确方法是什么?

weblogic.xml: weblogic.xml:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app
        xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
        http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
    <wls:container-descriptor>
        <wls:prefer-application-packages>
            <wls:package-name>org.slf4j</wls:package-name>
            <wls:package-name>ch.qos.logback.*</wls:package-name>
            <wls:package-name>org.opensaml</wls:package-name>
            <wls:package-name>org.apache.cxf</wls:package-name>
        </wls:prefer-application-packages>
    </wls:container-descriptor>
</wls:weblogic-web-app>

I already specify to use opensaml of my classpath so I dont understand what is happening. 我已经指定使用我的类路径的opensaml,所以我不明白发生了什么。

So stupid: weblogic.xml was on the wrong place, so it was being ignored. 太愚蠢了:weblogic.xml放在错误的位置,因此被忽略了。 I had it on src/main/resource folder. 我把它放在src / main / resource文件夹中。

It must be on src/main/webapp/WEB-INF/weblogic.xml 它必须在src/main/webapp/WEB-INF/weblogic.xml

Notice there is webapp folder! 请注意,这里有webapp文件夹!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM