[ https://issues.apache.org/jira/browse/CXF-8116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marco Tenti updated CXF-8116: ----------------------------- Comment: was deleted (was: RESOLVED WITH WORKAROUND (READ THE COMMENTS BELOW)) > Can't find a way to integrate the webjars "swaggerui" on OSGI Camel CXF > Project > ------------------------------------------------------------------------------- > > Key: CXF-8116 > URL: https://issues.apache.org/jira/browse/CXF-8116 > Project: CXF > Issue Type: Bug > Components: Bus, Documentation, JAX-RS, OSGi > Affects Versions: 3.2.7 > Reporter: Marco Tenti > Priority: Major > > Hi, i really need a full example for integrate the webjars "swaggerui" on > OSGI Camel CXF Project. > I followed the documentation and add the webjars swagger-ui on compile mode > on my pom.xml > I don't know why but my "Swagger2Feature" generate only the swagger.json > endpoint and never load the SwaggerUi page. > Here the blueprint.xml configuration i'm try to use: > {code:xml} > <cxf:rsServer > address="${https.serviceHost}:${https.servicePort}/cxf/my/rest" > id="rsServerTestServiceEndpointSSL" > loggingFeatureEnabled="true" loggingSizeLimit="20" > serviceClass="bug.test.endpoint.TestEndpoint" > staticSubresourceResolution="true"> > <cxf:serviceBeans> > <ref component-id="testServiceEndpointID"/> > </cxf:serviceBeans> > <cxf:inInterceptors> > <ref component-id="loggingInInterceptor"/> > </cxf:inInterceptors> > <cxf:outInterceptors> > <ref component-id="loggingOutInterceptor"/> > </cxf:outInterceptors> > <cxf:providers> > <ref component-id="jacksonJsonProvider"/> > <ref component-id="jacksonJaxbXMLProvider"/> > <ref component-id="multipartProvider" /> > <ref component-id="crossOriginResourceSharingFilterProvider"/> > </cxf:providers> > <cxf:features> > <ref component-id="loggingFeature"/> > <bean id="swagger2Feature" > class="org.apache.cxf.jaxrs.swagger.Swagger2Feature"><!-- > init-method="findSwaggerUiRoot" --> > <property name="host" > value="${https.serviceHost}:${https.servicePort}"/> > <property name="basePath" > value="${https.serviceHost}:${https.servicePort}/cxf/my/rest"/> > <property name="usePathBasedConfig" value="true" /> > <!-- > <property name="runAsFilter" value="true" /> > <property name="title" value="RESTful Service (swagger v2.0) > :: Signature Service"/> > <property name="description" value="Description Signature > Service"/> > <property name="version" value="1.0"/> > <property name="contact" value="XXXXXXXXXXXXXXXXXXX"/> > <property name="prettyPrint" value="true"/> > <property name="schemes"> > <array value-type="java.lang.String"> > <value>http</value> > <value>https</value> > </array> > </property> > <property name="scanAllResources" value="true"/> > <property name="swaggerUiVersion" value="true"/> > <property name="swaggerUiMavenGroupAndArtifact" > value="org.webjars/swagger-ui"/> > <property name="swaggerUiVersion" value="3.13.0"/> > --> > <!-- <property name="scan" value="true"/> --> > </bean> > </cxf:features> > </cxf:rsServer> > {code} > i even get this exception , but i don't know how resolve: > {code} > org.apache.cxf.interceptor.Fault: Direct self-reference leading to cycle > (through reference chain: > org.apache.cxf.message.MessageContentsList[1]->org.apache.cxf.jaxrs.swagger.SyntheticServletConfig["servletContext"]->io.undertow.servlet.spec.ServletContextImpl["deployment"]->io.undertow.servlet.core.DeploymentImpl["deploymentInfo"]->io.undertow.servlet.api.DeploymentInfo["classLoader"]->org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader["bundle"]->org.apache.felix.framework.BundleImpl["bundle"]) > while invoking public javax.ws.rs.core.Response > io.swagger.jaxrs.listing.ApiListingResource.getListing(javax.ws.rs.core.Application,javax.servlet.ServletConfig,javax.ws.rs.core.HttpHeaders,javax.ws.rs.core.UriInfo,java.lang.String) > with params > [org.apache.cxf.jaxrs.swagger.Swagger2Feature$DefaultApplication@7fc8f668, > org.apache.cxf.jaxrs.swagger.SyntheticServletConfig@470a7e15, > org.apache.cxf.jaxrs.impl.HttpHeadersImpl@237f91e8, > org.apache.cxf.jaxrs.impl.UriInfoImpl@1ade3492, json]. > at > org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166) > at > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140) > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > at > org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:278) > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78) > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) > at > org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.doService(UndertowHTTPDestination.java:200) > at > org.apache.cxf.transport.http_undertow.CxfUndertowServlet.invoke(CxfUndertowServlet.java:52) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:225) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:645) > at > org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) > at > io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74) > at > io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) > at > io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) > at > io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) > at > io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) > at > io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) > at > io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) > at > io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) > at > io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) > at > io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) > at > io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) > at > io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) > at > io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209) > at > io.undertow.servlet.spec.AsyncContextImpl$2$1.handleRequest(AsyncContextImpl.java:194) > at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364) > at > io.undertow.servlet.spec.AsyncContextImpl$2.run(AsyncContextImpl.java:191) > at > io.undertow.servlet.spec.AsyncContextImpl$6.run(AsyncContextImpl.java:485) > at > io.undertow.servlet.spec.AsyncContextImpl$TaskDispatchRunnable.run(AsyncContextImpl.java:604) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) > at java.lang.Thread.run(Thread.java:748) > Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: > Direct self-reference leading to cycle (through reference chain: > org.apache.cxf.message.MessageContentsList[1]->org.apache.cxf.jaxrs.swagger.SyntheticServletConfig["servletContext"]->io.undertow.servlet.spec.ServletContextImpl["deployment"]->io.undertow.servlet.core.DeploymentImpl["deploymentInfo"]->io.undertow.servlet.api.DeploymentInfo["classLoader"]->org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader["bundle"]->org.apache.felix.framework.BundleImpl["bundle"]) > at > com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77) > at > com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1191) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter._handleSelfReference(BeanPropertyWriter.java:944) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:721) > at > com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) > at > com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) > at > com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) > at > com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) > at > com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) > at > com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) > at > com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) > at > com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) > at > com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) > at > com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) > at > com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) > at > com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) > at > com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) > at > com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119) > at > com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79) > at > com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18) > at > com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480) > at > com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319) > at > com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1396) > at > com.fasterxml.jackson.databind.ObjectWriter._configAndWriteValue(ObjectWriter.java:1120) > at > com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:950) > at > org.apache.camel.component.jackson.JacksonDataFormat.marshal(JacksonDataFormat.java:166) > at > org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:69) > at > org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:181) > at > org.apache.camel.processor.interceptor.HandleFaultInterceptor.process(HandleFaultInterceptor.java:42) > at > org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:110) > at > org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) > at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) > at > org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) > at > org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.asyncInvoke(CxfRsInvoker.java:95) > at > org.apache.camel.component.cxf.jaxrs.CxfRsInvoker.performInvocation(CxfRsInvoker.java:69) > at > org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:193) > at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:103) > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) > at > org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) > at > org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) > at > org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267) > at > org.apache.cxf.transport.http_undertow.UndertowHTTPDestination.doService(UndertowHTTPDestination.java:200) > at > org.apache.cxf.transport.http_undertow.UndertowHTTPHandler.handleRequest(UndertowHTTPHandler.java:123) > at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364) > at > io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) > ... 3 more > {code} > *+The full test project can be found here:+* > https://github.com/p4535992/bug-load-swaggerui-blueprint > i'm desperated to make this work. > Anyone can provide a full example for the integration of the swaggerui ? -- This message was sent by Atlassian Jira (v8.3.4#803005)