[ 
http://issues.ops4j.org/browse/PAXLOGGING-58?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12647#action_12647
 ] 

Stephen Evanchik commented on PAXLOGGING-58:
--------------------------------------------

The discovery mechanism in both commons-logging:getLogFactory() and 
commons-discovery is the same (see the javadocs). 

They are both going to look for a class that extends LogFactory and if they 
cannot find one will fall back to the one defined in FACTORY_DEFAULT which in 
pax-logging points to a non-existent class. This should be fixed as client code 
expects this field to provide a reasonable value for a default factory 
implementation.

pax-logging:LogFactory has broken binary compatibility and also the fundamental 
semantics of commons-logging:LogFactory:

 1. pax-logging:LogFactory cannot be extended due to its private no-args 
constructor.
 2. The original LogFactory is not a singleton it is an abstract class (making 
it impossible to change existing code to simply call getFactory())



> Commons Logging LogFactory implementation is not a drop in replacement for 
> commons-logging:LogFactory/LogFactoryImpl
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: PAXLOGGING-58
>                 URL: http://issues.ops4j.org/browse/PAXLOGGING-58
>             Project: Pax Logging
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 1.3.0
>         Environment: Equinox 3.4.3 wih Axis 1.4.1 (not axis2)
>            Reporter: Stephen Evanchik
>            Assignee: Niclas Hedhman
>            Priority: Blocker
>         Attachments: LoggingDiscoveryTest.java
>
>
> PAX Logging does not work with Axis 1.4 because Axis cannot find a LogFactory 
> implementation. I have included the Exception below.
> I believe this is because commons-logging-1.1.1 has a LogFactory 
> implementation org.apache.commons.logging.impl.LogFactoryImpl with a public 
> no args constructor and the LogFactory class in PAX logging does not (it is a 
> private no args constructor).
> This prevents commons-discovery from finding and instantiating a class that 
> is "compatible" with LogFactory.class . I am in the process of testing this 
> fix by making the constructor public. 
> commons-logging-1.1.1 LogFactoryImpl:
> http://svn.apache.org/viewvc/commons/proper/logging/tags/commons-logging-1.1.1/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java?revision=597256
> See comment:
> "
>     /**
>      * Public no-arguments constructor required by the lookup mechanism.
>      */
>     public LogFactoryImpl()
> "
> Axis 1.4's use of commons-discovery to get a logger: 
> http://svn.apache.org/viewvc/webservices/axis/branches/AXIS_1_4_FINAL/src/org/apache/axis/components/logger/LogFactory.java?view=co
> Caused by: java.lang.ExceptionInInitializerError
> at org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:43)
> at org.apache.axis.client.Service.getAxisClient(Service.java:104)
> at org.apache.axis.client.Service.<init>(Service.java:113)
> at drivenow.external.europcar.XAPILocator.<init>(XAPILocator.java:12)
> at 
> drivenow.external.europcar.EuropcarServiceProxyFactoryBean.afterPropertiesSet(EuropcarServiceProxyFactoryBean.java:23)
> at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
> at 
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
> ... 17 more
> Caused by: org.apache.commons.discovery.DiscoveryException: No implementation 
> defined for org.apache.commons.logging.LogFactory
> at 
> org.apache.commons.discovery.tools.ClassUtils.verifyAncestory(ClassUtils.java:131)
> at 
> org.apache.commons.discovery.tools.SPInterface.verifyAncestory(SPInterface.java:156)
> at 
> org.apache.commons.discovery.tools.SPInterface.newInstance(SPInterface.java:150)
> at 
> org.apache.commons.discovery.tools.DiscoverClass.newInstance(DiscoverClass.java:534)
> at 
> org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:373)
> at 
> org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:333)
> at org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
> at java.security.AccessController.doPrivileged(Native Method)
> at 
> org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.java:41)
> at org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:33)
> ... 24 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.ops4j.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to