2
votes

I am newbie in spring mvc, jetty and restful. I'm trying to deploy my restful App is running perfectly when using this command >

mvn clean jetty:run

It gives following error:

java.util.ServiceConfigurationError: org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype at java.util.ServiceLoader.fail (ServiceLoader.java:239) at java.util.ServiceLoader.access$300 (ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService (ServiceLoader.java:376) at java.util.ServiceLoader$LazyIterator.next (ServiceLoader.java:404) at java.util.ServiceLoader$1.next (ServiceLoader.java:480) at org.apache.juli.logging.LogFactory. (LogFactory.java:77) at org.apache.juli.logging.LogFactory. (LogFactory.java:65) at org.apache.tomcat.websocket.WsWebSocketContainer. (WsWebSocketContainer.java:92) at org.apache.tomcat.websocket.server.WsServerContainer. (WsServerContainer.java:85) at org.apache.tomcat.websocket.server.WsSci.init (WsSci.java:131) at org.apache.tomcat.websocket.server.WsSci.onStartup (WsSci.java:47) at org.eclipse.jetty.plus.annotation.ContainerInitializer.callStartup (ContainerInitializer.java:140) at org.eclipse.jetty.annotations.ServletContainerInitializersStarter.doStart (ServletContainerInitializersStarter.java:64) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68) at org.eclipse.jetty.servlet.ServletContextHandler.startContext (ServletContextHandler.java:347) at org.eclipse.jetty.webapp.WebAppContext.startWebapp (WebAppContext.java:1497) at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp (JettyWebAppContext.java:360) at org.eclipse.jetty.webapp.WebAppContext.startContext (WebAppContext.java:1459) at org.eclipse.jetty.server.handler.ContextHandler.doStart (ContextHandler.java:852) at org.eclipse.jetty.servlet.ServletContextHandler.doStart (ServletContextHandler.java:278) at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java:545) at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart (JettyWebAppContext.java:428) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:167) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:119) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:167) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:119) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68) at org.eclipse.jetty.util.component.ContainerLifeCycle.start (ContainerLifeCycle.java:167) at org.eclipse.jetty.server.Server.start (Server.java:418) at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart (ContainerLifeCycle.java:110) at org.eclipse.jetty.server.handler.AbstractHandler.doStart (AbstractHandler.java:113) at org.eclipse.jetty.server.Server.doStart (Server.java:382) at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68) at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty (AbstractJettyMojo.java:477) at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute (AbstractJettyMojo.java:343) at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute (JettyRunMojo.java:169) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289) 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)

my pom.xml as follows : pom.xml

my project as follows: project

I have tried it many times but I've been unsuccessful. Please help!

2

2 Answers

2
votes

org.apache.tomcat.websocket.WsWebSocketContainer

If you are using jetty:run then the above class is not allowed to be in your classpath/classloader.

Find which dependency brings it in and remove/exclude it.

1
votes

Since you are running the app using Jetty, this error tells you that you have conflict with tomcat and I believe you have spring-boot-starter-web dependency in your pom and tomcat is embded by default which causes the conflict with jetty. Simply exclude it like below. It works for me

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>