Bug 1123042 - Maven Eclipse integration cannot find slf4j Logger class even if it's installed.
Summary: Maven Eclipse integration cannot find slf4j Logger class even if it's installed.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: eclipse-m2e-core
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Gerard Ryan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-24 17:16 UTC by Diego
Modified: 2014-07-30 07:04 UTC (History)
2 users (show)

Fixed In Version: eclipse-m2e-core-1.4.0-12.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-30 07:04:03 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Diego 2014-07-24 17:16:09 UTC
Description of problem:

When using "Run as..." - "Maven build" in a Maven project under Eclipse I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/Logger
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2570)
	at java.lang.Class.getMethod0(Class.java:2813)
	at java.lang.Class.getMethod(Class.java:1663)
	at org.codehaus.plexus.classworlds.launcher.Launcher.getEnhancedMainMethod(Launcher.java:172)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:268)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.ClassNotFoundException: org.slf4j.Logger
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
	... 9 more


Version-Release number of selected component (if applicable):
$ rpm -q eclipse-m2e-core
eclipse-m2e-core-1.4.0-11.1.fc20.noarch
$ rpm -q slf4j
slf4j-1.7.5-3.fc20.noarch

How reproducible:
Always

Steps to Reproduce:
1. Install eclipse, eclipse-m2e-core and slf4j
2. git clone https://github.com/zxing/zxing.git
3. from Eclipse "Import" - "Maven" - "Existing Maven Projects"
4. select folder "zxing/core"
5. after import try "Run as" - "Maven build"

Actual results:
The backtrace listed above appears in Console tab.


Expected results:
Maven build runs without complaining.

Comment 1 Roland Grunberg 2014-07-24 17:28:40 UTC
I was just able to reproduce this as well.

It seems like sl4fj.api is not accessible by the maven runtime. It's an OSGi bundle, and everything certainly resolves correctly but I don't think that Maven is able to load the class unless it is directly bundled into the maven runtime plugin.

I did the following workaround :
cd /usr/share/eclipse/dropins/eclipse-m2e-core/eclipse/plugins/org.eclipse.m2e.maven.runtime-1.4.0-SNAPSHOT/jars
sudo ln -s /usr/share/java/slf4j/slf4j-api.jar .

Then in /usr/share/eclipse/dropins/eclipse-m2e-core/eclipse/plugins/org.eclipse.m2e.maven.runtime-1.4.0-SNAPSHOT/META-INF/MANIFEST.MF add ',jars/slf4j-api.jar' to the end of the list of Bundle-ClassPath entries.

I started Eclipse back up with the '-clean' option and the build proceeded.

Comment 2 Gerard Ryan 2014-07-24 17:53:53 UTC
@Diego: thanks for taking the time to report.

@Roland: thanks for taking the time to diagnose & produce a workaround.

I'll push a fix & create an update asap.

Comment 3 Fedora Update System 2014-07-25 21:12:12 UTC
eclipse-m2e-core-1.4.0-12.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/eclipse-m2e-core-1.4.0-12.fc20

Comment 4 Gerard Ryan 2014-07-25 21:14:52 UTC
(In reply to Fedora Update System from comment #3)
> eclipse-m2e-core-1.4.0-12.fc20 has been submitted as an update for Fedora 20.
> https://admin.fedoraproject.org/updates/eclipse-m2e-core-1.4.0-12.fc20

This adds the fix that Roland provided here. It fixes the issue for me. If you would like to test it, please do and give karma in bodhi! :)

Comment 5 Fedora Update System 2014-07-26 16:00:58 UTC
Package eclipse-m2e-core-1.4.0-12.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing eclipse-m2e-core-1.4.0-12.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-8907/eclipse-m2e-core-1.4.0-12.fc20
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2014-07-30 07:04:03 UTC
eclipse-m2e-core-1.4.0-12.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


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