You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2022/08/21 22:41:00 UTC

[jira] [Commented] (LOG4J2-3580) issue while using log4j version 2.17.2

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

Ralph Goers commented on LOG4J2-3580:
-------------------------------------

Well, NoClassDefFoundError means that the org.osgi.framework.BundleReference class cannot be found. The only reason I can think of for that is that somehow the osgi api jar is not on the class path. Log4j expects that it will be provided by the OSGi container. So you will have to determine why that is not happening. Frankly, I am not sure how your app could work at all without that.

In any case, this is not a Log4j problem.

> issue while using log4j version 2.17.2 
> ---------------------------------------
>
>                 Key: LOG4J2-3580
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3580
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: shamim
>            Priority: Major
>
> Hi,
> I am using below dependencies in my java OSGI project. Getting below error 
> java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/osgi/framework/BundleReference
>     at org.apache.felix.dm.impl.FactoryConfigurationAdapterServiceImpl$AdapterImpl.handleException(FactoryConfigurationAdapterServiceImpl.java:259)
>     at org.apache.felix.dm.impl.FactoryConfigurationAdapterServiceImpl$AdapterImpl.createService(FactoryConfigurationAdapterServiceImpl.java:134)
>     at org.apache.felix.dm.impl.AbstractDecorator.updated(AbstractDecorator.java:148)
>     at org.eclipse.equinox.internal.cm.ManagedServiceFactoryTracker$2.run(ManagedServiceFactoryTracker.java:284)
>     at org.eclipse.equinox.internal.cm.SerializedTaskQueue$1.run(SerializedTaskQueue.java:40)
> Caused by: java.lang.NoClassDefFoundError: org/osgi/framework/BundleReference
>     at org.apache.logging.log4j.core.osgi.BundleContextSelector.getContext(BundleContextSelector.java:119)
>     at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:117)
>     at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:150)
>     at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
>     at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
>     at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:137)
>     at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:55)
>     at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:47)
>     at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33)
>     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:363)
>     at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
>     at com.ericsson.rm.voucher.spark.SparkServiceImpl.<clinit>(EmplyeeServiceImpl.java:219)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>     at java.lang.Class.newInstance(Class.java:442) 
>  
> Exception getting at initializing Logger 
>   private static final Logger myLogger = LoggerFactory.getLogger(EmployeeServiceImpl.class);
>  
> Imported Dependencies as below
>  import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
>  
> Log4j dependencies are used in project as below :
> <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-api</artifactId>
>             <version>2.17.2</version>
>         </dependency>
> <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-core</artifactId>
>             <version>2.17.2</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-1.2-api</artifactId>
>             <version>2.17.2</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-slf4j-impl</artifactId>
>             <version>2.17.2</version>
>         </dependency>
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)