Quantcast
Channel: Abhisar's Blog
Viewing all articles
Browse latest Browse all 37

A required class was missing while executing org.mortbay.jetty:jetty-maven-plugin

$
0
0
When I was running the command
mvn jetty:run
I got the message

[ERROR] Failed to execute goal org.mortbay.jetty:jetty-maven-plugin:8.1.1.v20120215:run (default-cli) on project CabShareService: Execution default-cli of goal
org.mortbay.jetty:jetty-maven-plugin:8.1.1.v20120215:run failed: A required class was missing while executing org.mortbay.jetty:jetty-maven-plugin:8.1.1.v201202
15:run: org/slf4j/impl/StaticLoggerBinder
My Jetty settings were

                       
org.mortbay.jetty
jetty-maven-plugin
8.1.1.v20120215


com.jolbox
bonecp
0.7.1.RELEASE




/${project.artifactId}

src/test/resources/jetty.xml
true
10
${project.artifactId}-stop
9999

 The reason of the error was that the slf4j implementation was not defined.
Tried setting the Logback as the one of the better implementation (detailed post ) .

Added the following dependency in the jetty dependencies section.


ch.qos.logback
logback-classic
0.9.29

This produced the following error


[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Exception in thread "Thread-1" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/help
ers/FormattingTuple;
        at org.eclipse.jetty.util.log.JettyAwareLogger.log(JettyAwareLogger.java:613)
        at org.eclipse.jetty.util.log.JettyAwareLogger.debug(JettyAwareLogger.java:200)
        at org.eclipse.jetty.util.log.Slf4jLog.debug(Slf4jLog.java:94)
        at org.eclipse.jetty.util.thread.ShutdownThread.run(ShutdownThread.java:125)

So it was obvious that all is not well. Some reading along will hit and trial reached to following jetty plugin configuration which removed the errors



org.mortbay.jetty
jetty-maven-plugin
8.1.1.v20120215



com.jolbox
bonecp
0.7.1.RELEASE



ch.qos.logback
logback-classic
1.0.0


org.slf4j
slf4j-api
1.6.1





logback.configurationFile

./src/test/resources/logback.xml



/${project.artifactId}

src/test/resources/jetty.xml
true
10
${project.artifactId}-stop
9999


 If you notice we have separated the Logback  configuration from the pom file. Below is a sample logback.xml file details.




class="ch.qos.logback.core.rolling.RollingFileAppender">
logFile.log


logFile.%d{yyyy-MM-dd}.log


%-4relative [%thread] %-5level %logger{35} - %msg%n














Viewing all articles
Browse latest Browse all 37

Trending Articles