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

Abid edited comment on LOG4J2-461 at 6/8/14 7:02 AM:
-----------------------------------------------------

Adding of jars into subdirectory of "WL_HOME/server/lib/mbeantypes" was 
suggested by Oracle Support with whom I have an SR open to track this issue. 
But I think this suggestion was not correct because I suspect that WLS loads 
each jar inside the subdirectory inside a separate classloader and hence this 
visibility issue between API and core jars. So I dropped this option floated as 
a half-hearted solution by Oracle. And they have not been able to suggest 
anything new so far.

Given your pointers on weblogic use of OSGi, I packaged the core and api jars 
with my custom security provider jar (which is generated by WLS tools), I 
modified "MANIFEST.MF"  to have entries:

{code:title=MANIFEST.MF|borderStyle=solid}
...
..
Name: log4j-core-2.0-rc2-SNAPSHOT.jar
Name: log4j-api-2.0-rc2-SNAPSHOT.jar
Bundle-ClassPath: 
log4j-api-2.0-rc2-SNAPSHOT.jar,log4j-core-2.0-rc2-SNAPSHOT.jar,disruptor-3.2.0.jar,log4j2.xml,.
{code}


But nothing progressive; now WLS starts to throw NoClassDefFoundError:

{code:title=std.out/error|borderStyle=solid}
<Jun 8, 2014 9:08:27 AM AST> <Error> <Security> <BEA-090870> <The realm 
"myrealm" failed to be loaded: 
weblogic.security.service.SecurityServiceException: 
java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger.
weblogic.security.service.SecurityServiceException: 
java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
        at 
weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(CSSWLSDelegateImpl.java:341)
        at 
weblogic.security.service.CSSWLSDelegateImpl.initialize(CSSWLSDelegateImpl.java:220)
...
...
Caused By: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:249)
        at 
com.bea.common.security.internal.legacy.service.SecurityProviderImpl.init(SecurityProviderImpl.java:46)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:363)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        Truncated. see log file for complete stacktrace
>
<Jun 8, 2014 9:08:28 AM AST> <Notice> <Security> <BEA-090082> <Security 
initializing using security realm myrealm.>
...
...
{code}

Thanks,
Abid


was (Author: pirabid):
Adding of jars into subdirectory of "WL_HOME/server/lib/mbeantypes" was 
suggested by Oracle Support with whom I have an SR open to track this issue. 
But I think this suggestion was not correct because I suspect that WLS loads 
each jar inside the subdirectory inside a separate classloader and hence this 
visibility issue between API and core jars. So I dropped this option floated as 
a half-hearted solution by Oracle. And they have not been able to suggest 
anything so far.

Given your pointers on weblogic use of OSGi, I packaged the core and api jars 
with my custom security provider jar (which is generated by WLS tools), I 
modified "MANIFEST.MF"  to have entries:

{code:title=MANIFEST.MF|borderStyle=solid}
...
..
Name: log4j-core-2.0-rc2-SNAPSHOT.jar
Name: log4j-api-2.0-rc2-SNAPSHOT.jar
Bundle-ClassPath: 
log4j-api-2.0-rc2-SNAPSHOT.jar,log4j-core-2.0-rc2-SNAPSHOT.jar,disruptor-3.2.0.jar,log4j2.xml,.
{code}


But nothing progressive; now WLS starts to throw NoClassDefFoundError:

{code:title=std.out/error|borderStyle=solid}
<Jun 8, 2014 9:08:27 AM AST> <Error> <Security> <BEA-090870> <The realm 
"myrealm" failed to be loaded: 
weblogic.security.service.SecurityServiceException: 
java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger.
weblogic.security.service.SecurityServiceException: 
java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
        at 
weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(CSSWLSDelegateImpl.java:341)
        at 
weblogic.security.service.CSSWLSDelegateImpl.initialize(CSSWLSDelegateImpl.java:220)
...
...
Caused By: java.lang.NoClassDefFoundError: org/apache/logging/log4j/Logger
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:249)
        at 
com.bea.common.security.internal.legacy.service.SecurityProviderImpl.init(SecurityProviderImpl.java:46)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:363)
        at 
com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
        Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: org.apache.logging.log4j.Logger
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        Truncated. see log file for complete stacktrace
>
<Jun 8, 2014 9:08:28 AM AST> <Notice> <Security> <BEA-090082> <Security 
initializing using security realm myrealm.>
...
...
{code}

Thanks,
Abid

>  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: log4j 1.2 emulation
>    Affects Versions: 2.0-beta9, 2.0-rc1
>         Environment: Android
>            Reporter: Gaurav Kapoor
>            Priority: Blocker
>         Attachments: MANIFEST.MF
>
>
> 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