Hi all,

I have a strange result with log4j2 and JAX-WS based web service (loading sun-jaxws.xml file at application startup)


If the file sun-jaxws.xml is present in WEB-INF folder the *loggerContext* does *not* start in right way.

If i move sun-jaxws.xml file *away* from WEB-INF folder (or remove the web-service definitions) the *loggerContext* starts *right*.


Environments:

Log4j2 2.8 (with web extension) ---- but problem appears with 2.7 too.

Tomcat 7.0.75

Java 1.8.121 x64

Linux x64


I have create a test project (netbeans 8.2 based), download here: http://www.filedropper.com/testwebapp (~5MB)

*Please copy the lib/to_copy_in_tomcat_lib_folder/ jars inside your tomcat/lib folder.*



In details, if app starts without sun-jaxws.xml the log4j LoggerContext starts right (with display-name "*app*" context related value):

Please don't worry about "javax.xml.ws.WebServiceException: Runtime descriptor "/WEB-INF/sun-jaxws.xml" is missing" error, it is right if sun-jaxws.xml is missing and the log4j2 problem appears if sun-jaxws.xml is in rigth place, not vice-versa. If you want you can comment the web-service section in web.xml

...

2017-02-24 10:07:53,689 http-bio-8088-exec-8 DEBUG *Starting LoggerContext[name=app] from configuration at null *<<<<<<< "*app*" is the *<display-name>* property in web.xml. 2017-02-24 10:07:53,691 http-bio-8088-exec-8 DEBUG Starting LoggerContext[name=app, org.apache.logging.log4j.core.LoggerContext@2b1a85f8] with configuration XmlConfiguration[location.......

...

...

2017-02-24 10:18:50,062 http-bio-8088-exec-7 TRACE *Reregistering context (1/1): 'app'* org.apache.logging.log4j.core.LoggerContext@1bcd2941




If i put sun-jaxws.xml inside WEB-INF folder, LoggerContext starts in wrong way:

*....LoggerContext.... log absent....
*

2017-02-24 10:17:20,465 http-bio-8088-exec-6 DEBUG Initializing configuration XmlConfiguration......

....

...

2017-02-24 10:17:21,394 http-bio-8088-exec-6 TRACE *Reregistering context (1/1): '**15e66403**'* org.apache.logging.log4j.core.LoggerContext@610e69d3



So, what is *15e66403* context name? I suppose that is auto-generated by log4j2....


Seems that Sun's (Oracle) JAX-WS conflicts with log4j2 web application startup, right? What should i do to solve this problem?


Please correct me if i am wrong.



Best regards,

Agharta




Reply via email to