[ 
https://issues.apache.org/jira/browse/LOG4J2-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13979390#comment-13979390
 ] 

Abid commented on LOG4J2-461:
-----------------------------

Hi,

I am also hitting the same ClassCastException issue while trying to run the 
log4j2 in WebLogic application server. Here is what I have done:

- if I put the api and core jars into DOMAIN_HOME/lib (equivalent to adding the 
jars into server classpath) things run okay.

- if I put the api and core jars into 
WL_HOME/server/lib/mbeantypes/3rdpartyjars, then this classcast exception is 
thrown:

java.lang.ClassCastException: 
org.apache.logging.log4j.simple.SimpleLoggerContext
        at 
com.qnb.itd.wls.sec.providers.QNBAuditProviderImpl.initialize(QNBAuditProviderImpl.java:108)
        at 
com.bea.common.security.internal.legacy.service.SecurityProviderImpl.init(SecurityProviderImpl.java:65)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:363)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.lookupService(ServiceEngineImpl.java:257)
        at 
com.bea.common.engine.internal.ServicesImpl.getService(ServicesImpl.java:72)
        at 
weblogic.security.service.internal.WLSIdentityServiceImpl.initialize(Unknown 
Source)
        at 
weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(Unknown 
Source)
        at weblogic.security.service.CSSWLSDelegateImpl.initialize(Unknown 
Source)
        at 
weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.InitializeServiceEngine(Unknown
 Source)
        at 
weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealm(Unknown
 Source)
        at 
weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadRealm(Unknown
 Source)
        at 
weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealms(Unknown
 Source)
        at 
weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(Unknown
 Source)
        at weblogic.security.service.SecurityServiceManager.initialize(Unknown 
Source)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
> 



With code snippet:

import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.LogManager;
...
...

public final class MyAuditProviderImpl implements AuditProvider, AuditChannel{
...
...


public void initialize(ProviderMBean mbean, SecurityServices services){
        ...
        ...
        LoggerContext ctx = null;
        Configuration config =  null;
        Map mp = null;
        
        ctx = (LoggerContext) LogManager.getContext(false);
        mp = config.getAppenders();
        System.out.println("***<MyAudit Provider o/p follows> Before logger 
re-configuration:");
        System.out.println("\tAppenders:" + mp.keySet());
        ...
        ...
    }
}


- with least hope to solve this issue, I also merged the two jars carefully 
(making sure MANIFEST.MF has all the entries) into single one but still same 
issue.

Hope this helps in someway to identify what is going wrong.

I am ready to test to collect any additional data for debugging.


Thanks

>  ERROR StatusLogger Unable to locate a logging implementation, using 
> SimpleLogger
> ---------------------------------------------------------------------------------
>
>                 Key: LOG4J2-461
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-461
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.0-beta9
>         Environment: Android
>            Reporter: Gaurav Kapoor
>            Priority: Blocker
>
> ERROR StatusLogger Unable to locate a logging implementation, using 
> SimpleLogger
> Code:
> Logger LOG = LogManager.getLogger(MainActivity.class);
>                       LOG.error("Test Log4j2");
> {code}
> <?xml version="1.0" encoding="UTF-8"?> 
> <Configuration> 
>   <Appenders> 
>     <Console name="STDOUT" target="SYSTEM_OUT"> 
>       <PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/> 
>     </Console> 
>   </Appenders> 
>   <Loggers> 
>     <Logger name="hello" level="info"/> 
>     <Root level="trace"> 
>       <AppenderRef ref="STDOUT"/> 
>     </Root> 
>   </Loggers> 
> </Configuration>
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to