M2 Realease - REST API not working

Hi guys, I’m back (Less than before but back)

I have upgraded to M2 and changed the addons.cfg for the restdocs:

# A comma-separated list of UIs to install (e.g. "ui = basic,paper")
ui = basic,classic,habmin,habpanel,paper,restdocs

But the REST API interface is down:

The text is:

500 : <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 500 Request failed.</title> </head> <body><h2>HTTP ERROR 500</h2> <p>Problem accessing /rest/swagger.json. Reason: <pre> Request failed.</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.18.v20190429</a><hr/> </body> </html> http://openhab:8080/rest/swagger.json

On the logs I get:

2019-08-26 13:16:50.985 [WARN ] [org.eclipse.jetty.server.HttpChannel] - /rest/swagger.json

javax.servlet.ServletException: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class io.swagger.converter.ModelConverters

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:88) ~[?:?]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[94:org.eclipse.jetty.server:9.4.18.v20190429]

	at org.eclipse.jetty.server.Server.handle(Server.java:505) ~[94:org.eclipse.jetty.server:9.4.18.v20190429]

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370) [94:org.eclipse.jetty.server:9.4.18.v20190429]

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267) [94:org.eclipse.jetty.server:9.4.18.v20190429]

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305) [85:org.eclipse.jetty.io:9.4.18.v20190429]

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [85:org.eclipse.jetty.io:9.4.18.v20190429]

	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [85:org.eclipse.jetty.io:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804) [97:org.eclipse.jetty.util:9.4.18.v20190429]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class io.swagger.converter.ModelConverters

	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:489) ~[?:?]

	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[?:?]

	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) ~[?:?]

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) ~[?:?]

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[?:?]

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) ~[?:?]

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) ~[?:?]

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[?:?]

	... 15 more

Caused by: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class io.swagger.converter.ModelConverters

	at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278) ~[?:?]

	at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260) ~[?:?]

	at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509) ~[?:?]

	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334) ~[?:?]

	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[?:?]

	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[?:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[?:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[?:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[?:?]

	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[?:?]

	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[?:?]

	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[?:?]

	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ~[?:?]

	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[?:?]

	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) ~[?:?]

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) ~[?:?]

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[?:?]

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) ~[?:?]

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) ~[?:?]

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[?:?]

	... 15 more

Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.swagger.converter.ModelConverters

	at io.swagger.jaxrs.DefaultParameterExtension.createProperty(DefaultParameterExtension.java:101) ~[?:?]

	at io.swagger.jaxrs.DefaultParameterExtension.extractParameters(DefaultParameterExtension.java:54) ~[?:?]

	at io.swagger.jaxrs.Reader.getParameters(Reader.java:913) ~[?:?]

	at io.swagger.jaxrs.Reader.parseMethod(Reader.java:864) ~[?:?]

	at io.swagger.jaxrs.Reader.read(Reader.java:299) ~[?:?]

	at io.swagger.jaxrs.Reader.read(Reader.java:145) ~[?:?]

	at io.swagger.jaxrs.listing.BaseApiListingResource.scan(BaseApiListingResource.java:56) ~[?:?]

	at io.swagger.jaxrs.listing.BaseApiListingResource.process(BaseApiListingResource.java:101) ~[?:?]

	at io.swagger.jaxrs.listing.BaseApiListingResource.getListingJsonResponse(BaseApiListingResource.java:147) ~[?:?]

	at io.swagger.jaxrs.listing.ApiListingResource.getListing(ApiListingResource.java:32) ~[?:?]

	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.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[?:?]

	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[?:?]

	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[?:?]

	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) ~[?:?]

	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[?:?]

	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[?:?]

	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[?:?]

	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[?:?]

	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) ~[?:?]

	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) ~[?:?]

	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) ~[?:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) ~[?:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) ~[?:?]

	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) ~[?:?]

	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) ~[?:?]

	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) ~[?:?]

	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) ~[?:?]

	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) ~[?:?]

	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) ~[?:?]

	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) ~[?:?]

	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:873) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146) ~[?:?]

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) ~[?:?]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257) ~[?:?]

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) ~[?:?]

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) ~[?:?]

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480) ~[?:?]

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) ~[?:?]

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247) ~[?:?]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) ~[?:?]

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) ~[?:?]
	... 15 more

It’s only a warning the the interface doesn’t appear.

I have read a few posts regarding this
I have cleared the cache

Linux Ubuntu 18.04 Desktop running headless

Any ideas?

Thanks

It works for me.
Try removing the api from addons.cfg and adding it through the PaperUI. That is the preferred method anyway.

:partying_face:

That was a known bug but it got fixed (really it was a regression and some changes got rolled back) prior to M2. Do indeed try to clear the cache and see if that fixes it. See https://github.com/openhab/openhab-webui/issues/86, https://github.com/openhab/openhab-core/pull/905, and https://github.com/openhab/openhab-core/issues/918.

1 Like

Is there an ETA on resolving?

1 Like

It was fixed before 2.5M2 was released. I can verify it works.

Doesn’t work for me… :frowning_face:
And I really miss it

I have it installed through the PaperUI, not the addons.cfg.

I tried both. No dice

Does not work for me. I’m on build 1672.

I am installing via addons.cfg… but that cannot be the reason this fails, surely.

Mike

If that is after 2.5M2 it may be broken again. It was broken until slightly before the M2 build.

I downgraded from 2.5.0~S1672-1 to 2.5.0~M2-1. I’ve been working on trying to get MQTT2 configured and now my Generic Broker connects successfully. Unfortunately REST Docs are still not working.

It seems to be a conflict where some bindings installs a different version of the Jackson library which causes the swagger.json to fail generating.

The rest API should still work though, just not the docs.

The rest API works. I confirm that. Not the docs…

1 Like

Do you have the Jinja Transformation addon installed?
That “killed” REST for me. After removing Jinja REST docs also worked again.

Might be worth a try.

1 Like

Welcome back!

Do you have the chromecast binding installed? If so, remove it and see if the issue goes away.

Jinja not installed. Not the issue

I rely heavily on chromecast audio messages. Don’t really want to do that.

Yes, for me it appears that the conflict for me is due to the Chromecast binding. @rlkoshak pointed this out to me in another topic as well. In the latest milestone the Chromecast binding must install Jackson 2.9.x.

I do not have the Jinja transform addon installed.

I don’t want to remove the Chromecast binding to test because I have a dozen devices for which I have linked several Items to their channels.

Mike

Understood. I only was suggesting you remove it to see if it clears the issue. Obviously, a non-working restdocs is preferable to no audio messages. :wink:

There’s a chromecast fix in the pipeline, I just don’t know if it’s been merged yet.

1 Like

I’ll do a test early in the morning when I am “alone” to test the theory.

Here’s the PR that I think will fix it. It was merged, but I don’t think it’s in the build yet.