[jacorb-developer] Help: Use of slf4j in jacorb

Nick Cross jacorb at goots.org
Wed Sep 2 16:09:18 CEST 2020


Hi,

SLF4J is a logger agnostic interface. The problem is the underlying logger 
implementation. JacORB is currently using the slf4j-jdk14 - which is the 
java.util.logging interface and has been using this since 2009. It appears your 
code is assuming the logging system is logback - so while SLF4J has detected the 
two logging systems you should look into managing the two systems.

Thanks

Nick



On 27/08/2020 08:39, ZION Stephane (SAFRAN ELECTRONICS & DEFENSE) wrote:
> Hi everyone,
> 
> I try to use Jacorb 3.9 (as I used 2.3 before).
> When launching my application, I got one exception when loading the web.xml :
> 
> SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
> SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
> sept. 04, 2020 5:39:09 AM org.apache.catalina.core.StandardContext
> listenerStart
> GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) com.server.PrintLogStatusListener
> 
> java.lang.ClassCastException: org.slf4j.impl.JDK14LoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
> at   com.server.PrintLogStatusListener.contextInitialized(PrintLogStatusListener.java:25)
> at   org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5127)
> at   org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5643)
> at   org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
> at   org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
> at   org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
> at   org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
> at   org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1260)
> at   org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2002)
> at   java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> at   java.util.concurrent.FutureTask.run(FutureTask.java:266)
> at   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at   java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at   java.lang.Thread.run(Thread.java:748)
> 
> 
> PrintLogStatusListener is defined like this in the web.xml:
> <listener>
>      <listener-class>com.server.PrintLogStatusListener</listener-class>
>    </listener>
> 
> 
> 
> My PrintLogStatusListener class looks like this:
> 
> import ch.qos.logback.classic.LoggerContext;
> import ch.qos.logback.core.util.StatusPrinter;
> import org.slf4j.LoggerFactory;
> 
> public class PrintLogStatusListener implements ServletContextListener,
>                                                 HttpSessionListener, HttpSessionAttributeListener {
> 
>                                                   // -------------------------------------------------------
>            // ServletContextListener implementation
>            // -------------------------------------------------------
>            public void contextInitialized( ServletContextEvent sce ) {
>              LoggerContext lc = ( LoggerContext ) LoggerFactory.getILoggerFactory();
>              StatusPrinter.print( lc );
>            }
>    }
> 
>    I think the pb deals with a conflict between slf4j and logback. The 3.9 jacorb version seems to impose the use of slf4j (via loads slf4j-api-1.7.14.jar).
>    I Use JAVA_ENDORSED_DIRS=/opt/Jacorb/3.9.1/lib
> 
>    How could I solve my pb? Thanks for your help ;)
> 
>    Stéphane
> 
> 
> #
> " Ce courriel et les documents qui lui sont joints peuvent contenir des informations confidentielles, être soumis aux règlementations relatives au contrôle des exportations ou ayant un caractère privé. S'ils ne vous sont pas destinés, nous vous signalons qu'il est strictement interdit de les divulguer, de les reproduire ou d'en utiliser de quelque manière que ce soit le contenu. Toute exportation ou réexportation non autorisée est interdite Si ce message vous a été transmis par erreur, merci d'en informer l'expéditeur et de supprimer immédiatement de votre système informatique ce courriel ainsi que tous les documents qui y sont attachés."
> ******
> " This e-mail and any attached documents may contain confidential or proprietary information and may be subject to export control laws and regulations. If you are not the intended recipient, you are notified that any dissemination, copying of this e-mail and any attachments thereto or use of their contents by any means whatsoever is strictly prohibited. Unauthorized export or re-export is prohibited. If you have received this e-mail in error, please advise the sender immediately and delete this e-mail and all attached documents from your computer system."
> #
> _______________________________________________
> jacorb-developer maillist  -  jacorb-developer at lists.spline.inf.fu-berlin.de
> https://lists.spline.inf.fu-berlin.de/mailman/listinfo/jacorb-developer
> 


More information about the jacorb-developer mailing list