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

Caspar MacRae commented on PAXLOGGING-58:
-----------------------------------------


I know this ticket is resolved won't fix and I completely agree with the 
reasons behind this, but as I found this ticket via googling the error (and 
it's also linked to from a springsource bug report), I thought it would be good 
to detail the solution here - which is to fix axis' log crapness.

# Grab a copy of Axis 1.4 (the release AFAIK):
#* svn checkout 
http://svn.apache.org/repos/asf/webservices/axis/branches/AXIS_1_4_FINAL    
AXIS_1_4_FINAL
# Check the README for required dependencies not included; JavaMail and 
javax.activation - grab these and stick them in the lib directory
# Apply the patch (see end of this comment)
# Build Axis - note you MUST use a 1.4 jdk as the Axis developers subclassed 
something (ResourceBundle.java AFAIR) from the rt/tools but in later jdks the 
overridden method is marked final 
#* ant dist
# Crack open the distribution zip/tarball and copy out the axis and jaxrpc jars

Note: you'll still need to pax wrap it, but at least it's now usable in an OSGi 
environment.


The patch:


{code:title=axis_1.4.patch|borderStyle=solid}
Index: src/org/apache/axis/components/logger/LogFactory.java
===================================================================
--- src/org/apache/axis/components/logger/LogFactory.java       (revision 
1076582)
+++ src/org/apache/axis/components/logger/LogFactory.java       (working copy)
@@ -19,6 +19,9 @@
 import org.apache.commons.discovery.tools.DiscoverSingleton;
 import org.apache.commons.logging.Log;
 
+
+import org.apache.commons.logging.impl.LogFactoryImpl;
+
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 
@@ -38,14 +41,6 @@
     }
     
     private static final org.apache.commons.logging.LogFactory getLogFactory() 
{
-        return (org.apache.commons.logging.LogFactory)
-            AccessController.doPrivileged(
-                new PrivilegedAction() {
-                    public Object run() {
-                        return 
DiscoverSingleton.find(org.apache.commons.logging.LogFactory.class,
-                                       
org.apache.commons.logging.LogFactory.FACTORY_PROPERTIES,
-                                       
org.apache.commons.logging.LogFactory.FACTORY_DEFAULT);
-                    }
-                });
+        return org.apache.commons.logging.LogFactory.getFactory();
     }
 }
Index: build.xml
===================================================================
--- build.xml   (revision 1076582)
+++ build.xml   (working copy)
@@ -94,8 +94,8 @@
     </depend>  
     <javac srcdir="${src.dir}" destdir="${build.dest}"  nowarn="${nowarn}" 
debug="${debug}"
       deprecation="${deprecation}" 
-      source="${source}"
-      target="${target}"
+      source="1.4"
+      target="1.4"
       classpathref="classpath">
       <exclude name="**/old/**/*" />
       <exclude name="**/bak/**"/>
{code}

hope that saves someone else some time

> 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: LogFactory.java, 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
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to