Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9057

Camel Example Servlet REST generates java.lang.NoClassDefFoundError: scala/xml/PrettyPrinter

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.16.0
    • Fix Version/s: None
    • Component/s: examples
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      After starting jetty:run maven goal and accessing the apiDoc of Swagger (http://localhost:8080/camel-example-servlet-rest-tomcat/api-docs/myCamel), the following error is reported

      2015-08-05 17:42:18.053:INFO:oejs.Server:main: Started @18962ms
      [INFO] Started Jetty Server
      2015-08-05 17:42:26.619:WARN:oejs.ServletHandler:qtp1891031939-25: Error for /camel-example-servlet-rest-tomcat/api-docs/myCamel
      java.lang.NoClassDefFoundError: scala/xml/PrettyPrinter
              at com.wordnik.swagger.core.util.JsonSerializer$.<init>(JsonSerializer.scala:31)
              at com.wordnik.swagger.core.util.JsonSerializer$.<clinit>(JsonSerializer.scala)
              at org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.renderResourceListing(RestSwaggerApiDeclarationServlet.scala:225)
              at org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.doGet(RestSwaggerApiDeclarationServlet.scala:111)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
              at org.apache.camel.component.swagger.RestSwaggerCorsFilter.doFilter(RestSwaggerCorsFilter.scala:44)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
              at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
              at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
              at org.eclipse.jetty.server.Server.handle(Server.java:497)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
              at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: 
      java.lang.ClassNotFoundException: scala.xml.PrettyPrinter
              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)
              at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:450)
              at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:403)
              at com.wordnik.swagger.core.util.JsonSerializer$.<init>(JsonSerializer.scala:31)
              at com.wordnik.swagger.core.util.JsonSerializer$.<clinit>(JsonSerializer.scala)
              at org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.renderResourceListing(RestSwaggerApiDeclarationServlet.scala:225)
              at org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.doGet(RestSwaggerApiDeclarationServlet.scala:111)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      

      when the same url is called a second time, then we get another class not found error

      2015-08-05 17:47:33.803:WARN:oejs.ServletHandler:qtp1891031939-33: Error for /camel-example-servlet-rest-tomcat/api-docs/myCamel
      java.lang.NoClassDefFoundError: Could not initialize class com.wordnik.swagger.core.util.JsonSerializer$
              at org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.renderResourceListing(RestSwaggerApiDeclarationServlet.scala:225)
              at org.apache.camel.component.swagger.RestSwaggerApiDeclarationServlet.doGet(RestSwaggerApiDeclarationServlet.scala:111)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
              at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
              at org.apache.camel.component.swagger.RestSwaggerCorsFilter.doFilter(RestSwaggerCorsFilter.scala:44)
              at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
              at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
              at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
              at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
              at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
              at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
              at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
              at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
              at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
              at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
              at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
              at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
              at org.eclipse.jetty.server.Server.handle(Server.java:497)
              at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
              at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
              at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
              at java.lang.Thread.run(Thread.java:745)
      
      

        Attachments

          Activity

            People

            • Assignee:
              cmoulliard Moulliard Charles
              Reporter:
              cmoulliard Moulliard Charles
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: