Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment fails since enabling CDI in 2.0.0-SNAPSHOT. #2640

Open
noltedx opened this issue Jan 30, 2018 · 7 comments
Open

Deployment fails since enabling CDI in 2.0.0-SNAPSHOT. #2640

noltedx opened this issue Jan 30, 2018 · 7 comments

Comments

@noltedx
Copy link

noltedx commented Jan 30, 2018

The deployment of our project (ear) on Wildfly (10.0.0) runs into the following exception since we using swagger-core rc4:

15:32:41,558 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."public-rest-service-4.0.0-SNAPSHOT.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."public-rest-service-4.0.0-SNAPSHOT.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000071: Managed bean with a parameterized bean class must be @dependent: class org.apache.cxf.jaxrs.provider.JAXBElementProvider
at org.jboss.weld.bean.ManagedBean.checkType(ManagedBean.java:208)
at org.jboss.weld.bean.AbstractBean.initializeAfterBeanDiscovery(AbstractBean.java:107)
at org.jboss.weld.bean.ManagedBean.initializeAfterBeanDiscovery(ManagedBean.java:122)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:136)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:127)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)

I think this happens due to the changes based on #2617.
Is there a possible workaround or a solution to this issue?

@frantuma
Copy link
Member

Change in #2617 is not part (shouldn't be) of 2.0.0-rc4; it is currently included in 2.0.0-SNAPSHOT and will possibly be updated; are you maybe experiencing the issue with 2.0.0-SNAPSHOT instead? in this case please switch to rc4 and/or monitor #2627 and #2617.

@noltedx
Copy link
Author

noltedx commented Jan 31, 2018

Hi,
you are right, it is in 2.0.0-SNAPSHOT and rc3 works well. But switching to rc4 leads to another issue: while trying to open Swagger UI in a browser it failed with: Failed to load spec! The related Stacktrace on server side looks like this:
11:53:59,701 ERROR [de.ser.sedna.publicrs.ExceptionHandler] (default task-5) java.lang.IllegalStateException: Unsupported annotated member: io.swagger.v3.core.converter.ModelConverterContextImpl$1: java.lang.IllegalStateException: Unsupported annotated member: io.swagger.v3.core.converter.ModelConverterContextImpl$1 at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.findAnnotation(JaxbAnnotationIntrospector.java:1363) at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.findSubtypes(JaxbAnnotationIntrospector.java:637) at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findSubtypes(AnnotationIntrospectorPair.java:258) at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findSubtypes(AnnotationIntrospectorPair.java:259) at io.swagger.v3.core.jackson.ModelResolver.getSchemaAnnotation(ModelResolver.java:1425) at io.swagger.v3.core.jackson.ModelResolver.resolveTitle(ModelResolver.java:1065) at io.swagger.v3.core.jackson.ModelResolver.resolveSchemaMembers(ModelResolver.java:1333) at io.swagger.v3.core.jackson.ModelResolver.resolveAnnotatedType(ModelResolver.java:203) at io.swagger.v3.core.converter.ModelConverterContextImpl.resolveAnnotatedType(ModelConverterContextImpl.java:196) at io.swagger.v3.core.converter.ModelConverters.resolveAnnotatedType(ModelConverters.java:59) at io.swagger.v3.jaxrs2.Reader.parseMethod(Reader.java:838) at io.swagger.v3.jaxrs2.Reader.parseMethod(Reader.java:663) at io.swagger.v3.jaxrs2.Reader.read(Reader.java:391) at io.swagger.v3.jaxrs2.Reader.read(Reader.java:167) at io.swagger.v3.jaxrs2.Reader.read(Reader.java:194) at io.swagger.v3.oas.integration.GenericOpenApiContext.read(GenericOpenApiContext.java:349) at io.swagger.v3.jaxrs2.integration.resources.BaseOpenApiResource.getOpenApi(BaseOpenApiResource.java:49) at io.swagger.v3.jaxrs2.integration.resources.OpenApiResource.getOpenApi(OpenApiResource.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:497) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:192) 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.servlet.ServletController.invokeDestination(ServletController.java:234) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:191) 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:687) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:276) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) 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:284) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

I tried to debug and also simplified my project, to get an idea what's wrong, because it seems to be an problem while scanning the annotations, but i can't figure it out. May be you have an hint for me?

@frantuma
Copy link
Member

Which Jackson version are you using? possibly may be related to FasterXML/jackson-modules-base#31 which is fixed in jackson 2.9.3 (although dep version of swagger is the same in rc3 and rc4); worth trying to use 2.9.3 though.
Also can you identify the offending class?

Regarding your original issue with 2.0.0-SNAPSHOT, have you maybe tried to "simplify" integration as suggested in #2627 (comment) ?

@noltedx
Copy link
Author

noltedx commented Jan 31, 2018

After switching to version 2.9.3 (we have 2.8.6) of jackson, 2.0.0-rc4 works well.
Regarding the original issue, I' am not so familar with the CDI stuff and therefore, I'am not sure what exactly the point is. So I have to start further investigation to understand.

@noltedx noltedx changed the title Deployment fails since enabling CDI in rc4. Deployment fails since enabling CDI in 2.0.0-SNAPSHOT. Jan 31, 2018
@derekm
Copy link
Contributor

derekm commented Feb 6, 2018

I think 2.0.0-rc4 actually does have the CDI-enablement in it.

Here's how I was able to upgrade Hammock: https://github.com/hammock-project/hammock/pull/125/files

Notice how integrators using CDI should be able to delete pointless code since swagger-jaxrs2 now includes CDI support.

@derekm
Copy link
Contributor

derekm commented Feb 6, 2018

Oops, sorry, I was wrong... My test is lying to me! This is what our final upgrade will look like if CDI-enablement lasts until rc5, except without the .addPackage("io.swagger.v3.jaxrs2.integration.resources") part in the Arquillian @Deployment.

@noltedx
Copy link
Author

noltedx commented Apr 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants