Bug 845099 - OSGi fails to resolve LogFactory
OSGi fails to resolve LogFactory
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: apache-commons-logging (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Mikolaj Izdebski
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-01 14:48 EDT by Andrew Robinson
Modified: 2012-08-08 10:37 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-08 10:37:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Andrew Robinson 2012-08-01 14:48:44 EDT
When OSGi tries to resolve org.apache.commons.logging.LogFactory it fails with error similar to below. Does not happen in Rawhide after f18 mass rebuild. Perhaps f17 needs a rebuild?

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    at org.apache.http.impl.client.AbstractHttpClient.<init>(AbstractHttpClient.java:187)
    at org.apache.http.impl.client.DefaultHttpClient.<init>(DefaultHttpClient.java:141)
    at org.fedoraproject.eclipse.packager.bodhi.api.BodhiClient.getClient(BodhiClient.java:346)
    at org.fedoraproject.eclipse.packager.bodhi.api.BodhiClient.<init>(BodhiClient.java:95)
    at org.fedoraproject.eclipse.packager.bodhi.internal.ui.UserValidationResponse.validate(UserValidationResponse.java:46)
    at org.fedoraproject.eclipse.packager.bodhi.internal.ui.UserValidationResponse.<init>(UserValidationResponse.java:39)
    at org.fedoraproject.eclipse.packager.bodhi.internal.ui.ValidationJob.run(ValidationJob.java:50)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:455)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 8 more
Comment 1 Mikolaj Izdebski 2012-08-01 23:44:43 EDT
Which OSGi Framework are you using? I tried Felix and Equinox, both worked for me:

$ cat Test.java
import java.util.*;
import org.osgi.framework.*;
import org.osgi.framework.launch.*;

class Test {
    public static void main(String[] args) throws BundleException, ClassNotFoundException {
	Framework f = ServiceLoader.load(FrameworkFactory.class).iterator().next().newFramework(Collections.EMPTY_MAP);
	f.start();

	Bundle b = f.getBundleContext().installBundle("file:///usr/share/java/apache-commons-logging.jar");
	System.err.println("installBundle() returned " + b);

	Class c = b.loadClass("org.apache.commons.logging.LogFactory");
	System.err.println("loadClass() returned " + c);
	System.exit(0);
    }
}

$ javac -cp `build-classpath felix` Test.java 

$ java -cp `build-classpath felix`:. Test
installBundle() returned org.apache.commons.logging [1]
loadClass() returned class org.apache.commons.logging.LogFactory

$ java -cp `build-classpath eclipse/osgi`:. Test
installBundle() returned org.apache.commons.logging_1.1.1.v20080605-1930 [2]
loadClass() returned class org.apache.commons.logging.LogFactory

In my case the bundle is resolved correctly. Can you provide more details on how exactly you are loading commons-logging bundle? A working reproducer would be great.
Comment 2 Andrew Robinson 2012-08-08 10:37:16 EDT
Seems to be fixed on all the machines I was using. Not sure what was causing it, but I'll close for now.

Note You need to log in before you can comment on or make changes to this bug.