org.apache.log4j.Logger.getAppender(String name) method missing in the Pax Logging

Description

I am coding bundles for my system deployed in FUSE ESB 4.3.1-00-00 which have to get the logger appender reference. I found out, that it is not present in the log4j implementation behind Pax Logging. It prohibits from successful deployment with the following exception:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'databaseBinding' defined in URL [bundleentry://281.fwk1477638638/META-INF/spring/bundle-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.log4j.Logger.getAppender(Ljava/lang/StringLorg/apache/log4j/Appender;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.afterPropertiesSet(OsgiServiceFactoryBean.java:167)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 14 more
Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Logger.getAppender(Ljava/lang/StringLorg/apache/log4j/Appender;
at com.example.databaseBinding.DatabaseBindingImpl.afterPropertiesSet(DatabaseBindingImpl.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1544)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 23 more

Environment

FUSE ESB 4.3.1-00-00.
I assume, that it is using Pax Logging 1.5.3 basing on this link: http://fusesource.com/forums/thread.jspa?threadID=3909&tstart=120

Activity

Show:
Achim Nierbeck
November 11, 2012, 10:47 PM
Edited

I'm not quite sure what you are trying to achieve here, but if you want to add your own appender you need to use a fragment bundle and attach it to the pax-logging-service bundle. I did a small blog on how to do this here

BTW. if this is true, please close this issue as won't fix.

Jean-Baptiste Onofre
July 17, 2014, 7:55 PM

Log4j is wrapped in Pax Logging. The Category class is different and doesn't expose all methods of the original log4j Category.
This behavior is expected as the configuration comes from PaxLogging (using ConfigAdmin).

Assignee

Unassigned

Reporter

Kowalski Wlodzimierz

Fix versions

None

Labels

Components

Affects versions

Priority

Major
Configure