简体   繁体   English

Log4j 禁用扫描@webservices

[英]Log4j disabling scan @webservices

We are trying to user log4j2 ( moving from log4j1 ) but have an issue probably related to the classpath but I couldN,t fix it after multiple tries我们正在尝试使用 log4j2 (从 log4j1 移动),但有一个问题可能与类路径有关,但我无法在多次尝试后修复它

We are using a separate module (NbfgLogging) that use a java class to configure LOG4J.我们正在使用一个单独的模块 (NbfgLogging),它使用 java class 来配置 LOG4J。 The configuration works without an issue but,for some reason, it disable the scan of the @webservice scan.该配置可以正常工作,但由于某种原因,它禁用了@webservice 扫描的扫描。 Looking at the console of WAS, the services are not anymore registered COMMONS-LOGGING.PROPERTIES查看 WAS 的控制台,服务不再注册COMMONS-LOGGING.PROPERTIES

priority=1
    org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.LogFactoryImpl
    #org.apache.commons.logging.Log=org.apache.logging.log4j.Logger
    org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
    #org.apache.commons.logging.Log=java.util.logging.Logger

DEPENDENCIES IN THE SEPARATE MODULE FILE ( NbfgLogging )独立模块文件 (NbfgLogging) 中的依赖项

<dependencies>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-jcl</artifactId>
        <version>${log4j.version}</version>         
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${log4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${log4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${log4j.version}</version>
    </dependency>       
    <dependency>
        <groupId>org.owasp.encoder</groupId>
        <artifactId>encoder</artifactId>
        <version>1.2.3</version>
    </dependency>
</dependencies>

DEPENDENCIES IN THE WAR FILES ( that create the issue. No scan of the @webservices ) WAR 文件中的依赖项(产生问题。不扫描 @webservices)

    <dependency>
        <groupId>com.nbfg.fw.foundation</groupId>
        <artifactId>NbfgLogging</artifactId>
        <version>3.0.0-SNAPSHOT</version>
    </dependency>
    

LOGS OF THE SERVER ( other lines服务器的日志(其他行

[12/14/21 13:13:50:512 EST] 00000177 AbstractInjec W CWNEN0070W: The javax.ws.rs.HeaderParam annotation class will not be recognized because it was loaded from the file:/C:/blp/IBM/WebSphere/wp_profile/installedApps/portail-devCell/PA_Xxxxx.ear/CP-3.4.4-SNAPSHOT.war/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar location rather than from a product class loader. [12/14/21 13:13:50:512 EST] 00000177 AbstractInjec W CWNEN0070W:javax.ws.rs.HeaderParam 注释 class 将无法识别,因为它是从文件加载的:/C:/blp/IBM/ WebSphere/wp_profile/installedApps/porttail-devCell/PA_Xxxxx.ear/CP-3.4.4-SNAPSHOT.war/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar 位置而不是来自产品 ZA2F2ED4F8EBC2CBB4C21A29DDC40AB6装载机。 [12/14/21 13:13:50:513 EST] 00000177 AbstractInjec W CWNEN0070W: The javax.annotation.Resource annotation class will not be recognized because it was loaded from the file:/C:/blp/IBM/WebSphere/wp_profile/installedApps/portail-devCell/PA_Xxxxxx.ear/CP-3.4.4-SNAPSHOT.war/WEB-INF/lib/javax.annotation-api-1.2.jar location rather than from a product class loader. [12/14/21 13:13:50:513 EST] 00000177 AbstractInjec W CWNEN0070W:javax.annotation.Resource 注释 class 将无法识别,因为它是从文件加载的:/C:/blp/IBM/WebSphere/ wp_profile/installedApps/porttail-devCell/PA_Xxxxxx.ear/CP-3.4.4-SNAPSHOT.war/WEB-INF/lib/javax.annotation-api-1.2.jar 位置而不是来自产品 class 加载程序。

I have tried the following that solve the issue of the scan of @webservice.我尝试了以下解决@webservice扫描问题的方法。 But the looger is not working anymore.但是 looger 不再工作了。 I have tried other exclusions... without any succes.我尝试了其他排除...没有任何成功。

DEPENDENCIES IN THE WAR FILES ( with exclusion )战争文件中的依赖关系(排除)

    <dependency>
        <groupId>com.nbfg.fw.foundation</groupId>
        <artifactId>NbfgLogging</artifactId>
        <version>3.0.0-SNAPSHOT</version>
        <exclusions>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
            </exclusion>
        </exclusions>
        

LOGS OF THE SERVER ( other lines are not included )服务器日志(不包括其他行)

Caused by: org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.引起:org.apache.commons.logging.LogConfigurationException:用户指定的日志 class 'org.ZB6EFD606D118D0F62066E31419FFLog04CCZ.commons.logginger' 无法找到。

From the error message, it looks like the app located here: PA_Xxxxx.ear/CP-3.4.4-SNAPSHOT.war/ is packaging the JAX-RS 2.0 API here WEB-INF/lib/javax.ws.rs-api-2.0.1.jar the JAX-RS 2.0 API is provided by the WebSphere runtime, and this is causing a conflict.从错误消息看来,应用程序位于此处: PA_Xxxxx.ear/CP-3.4.4-SNAPSHOT.war/正在将 JAX-RS 2.0 API 打包在此处WEB-INF/lib/javax.ws.rs-api-2.0.1.jar JAX-RS 2.0 API 由 WebSphere 运行时提供,这会导致冲突。 If your application contains JAX-RS code, then you can do one of two things: remove the JAX-RS dependencies from your application and rely on the WebSphere JAX-RS implementation, or if you'd like to use a third-party JAX-RS implementation then you can disable the JAX-RS runtime on Websphere following these directions: https://www.ibm.com/docs/en/was/8.5.5?topic=applications-disabling-jax-rs-runtime-environment如果您的应用程序包含 JAX-RS 代码,那么您可以执行以下两种操作之一:从应用程序中删除 JAX-RS 依赖项并依赖 WebSphere JAX-RS 实现,或者如果您想使用第三方 JAX -RS 实现,然后您可以按照以下说明在 Websphere 上禁用 JAX-RS 运行时: https://www.ibm.com/docs/en/was/8.5.5?topic=applications-disabling-jax-rs-runtime-环境

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

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