Issue Details (XML | Word | Printable)

Key: JETTY-574
Type: Bug Bug
Status: Resolved Resolved
Resolution: Not A Bug
Priority: Major Major
Assignee: Unassigned
Reporter: martin
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Jetty

SLF4J classes not visible when added as dependencies to maven-jetty-plugin

Created: 14/May/08 08:41 AM   Updated: 14/May/08 11:08 AM
Component/s: Maven2
Affects Version/s: 6.1.7, 6.1.8, 6.1.9, 7.0.0pre0, 7.0.0pre1
Fix Version/s: 6.1.7

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive test-slf4j.zip (3 kB)



 Description  « Hide
Adding SLF4J as a dependency to maven-jetty-plugin doesn't make it visible to the running webapp (NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder)
It works fine with other libraries than SLF4J.

Try mvn jetty:run with the attached project.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
martin added a comment - 14/May/08 08:44 AM
Oops, I mean the error is "NoClassDefFoundError: org/slf4j/LoggerFactory" since it's slf4j-api that isn't visible.

Igor E. Poteryaev added a comment - 14/May/08 09:14 AM
According to Jetty classloading architecture (see http://docs.codehaus.org/display/JETTY/Classloading),
org.slf4j.* classes by default are included in so called ServerClasses and are hidden from webapp context classloaders.

I think that you have two possibilities:

1. Override default ServerClasses list excluding org.slf4j. from it. After it webapp context classloader will see slf4j classes from parent classloader.

or

2. Add slf4j dependencies not only to maven-plugin-jetty, but as dependency at top maven pom <dependencies> level . After it webapp context classloader will see slf4j classes from its own WEB-INF/lib/ directory.


martin added a comment - 14/May/08 11:07 AM
Sorry for the false alarm, I didn't know Jetty was hiding certain classes.
Your first suggestion works great, I added this to the plugin configuration and now everything's ok:

<configuration>
<webAppConfig>
<contextPath>/test</contextPath>
<serverClasses>
<filter>-org.mortbay.jetty.plus.jaas.</filter>
<filter>org.mortbay.jetty.</filter>
</serverClasses>
</webAppConfig>
</configuration>

Thanks!