I configured Grizzly + Jersey2 and I started to use "jersey-cdi2-se" but when jersey-bean-validation is included, it didn't work
First, at compile time I getting this Error
Exception in thread "main" java.lang.IllegalArgumentException: Can not set javax.validation.ValidatorFactory field org.glassfish.jersey.server.validation.internal.ValidationBinder$ConfiguredValidatorProvider.factory to org.hibernate.validator.internal.engine.ConfigurationImpl at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) at java.lang.reflect.Field.set(Field.java:764) at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:94) at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:335) at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:346) at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:69) at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:71) at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:117) at org.glassfish.jersey.inject.cdi.se.injector.JerseyInjectionTarget.inject(JerseyInjectionTarget.java:171) at org.glassfish.jersey.inject.cdi.se.bean.SupplierClassBean.create(SupplierClassBean.java:127) at org.glassfish.jersey.inject.cdi.se.bean.SupplierClassBean.create(SupplierClassBean.java:89) at org.jboss.weld.contexts.AbstractContext.get(AbstractContext.java:96) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:676) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:699) at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:64) at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:86) at org.glassfish.jersey.inject.cdi.se.bean.SupplierBeanBridge.getSupplier(SupplierBeanBridge.java:162) at org.glassfish.jersey.inject.cdi.se.bean.SupplierBeanBridge.create(SupplierBeanBridge.java:133) at org.jboss.weld.contexts.unbound.DependentContextImpl.get(DependentContextImpl.java:70) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:676) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:699) at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:64) at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:86) at org.glassfish.jersey.inject.cdi.se.CdiSeInjectionManager.getInstanceInternal(CdiSeInjectionManager.java:183) at org.glassfish.jersey.inject.cdi.se.CdiSeInjectionManager.getInstance(CdiSeInjectionManager.java:166) at org.glassfish.jersey.server.model.internal.ResourceMethodInvokerConfigurator.lambda$postInit$0(ResourceMethodInvokerConfigurator.java:78) at org.glassfish.jersey.server.model.ResourceMethodInvoker$Builder.build(ResourceMethodInvoker.java:218) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createInflector(RuntimeModelBuilder.java:130) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createMethodRouter(RuntimeModelBuilder.java:117) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createResourceMethodRouters(RuntimeModelBuilder.java:311) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.buildModel(RuntimeModelBuilder.java:200) at org.glassfish.jersey.server.internal.routing.Routing$Builder.buildStage(Routing.java:247) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:422) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316) at org.glassfish.jersey.internal.Errors.process(Errors.java:316) at org.glassfish.jersey.internal.Errors.process(Errors.java:298) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:269) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:334) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:117)
I tried to register org.glassfish.jersey.server.validation.internal.ValidationBinder and the error disappears but bean validation is ignored and the service doesn't work.
If I use jersey-hk2 bean validation start to work but without CDI.
I configured Grizzly + Jersey2 and I started to use "jersey-cdi2-se" but when jersey-bean-validation is included, it didn't work
First, at compile time I getting this Error
Exception in thread "main" java.lang.IllegalArgumentException: Can not set javax.validation.ValidatorFactory field org.glassfish.jersey.server.validation.internal.ValidationBinder$ConfiguredValidatorProvider.factory to org.hibernate.validator.internal.engine.ConfigurationImpl at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167) at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171) at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) at java.lang.reflect.Field.set(Field.java:764) at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:94) at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:335) at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:346) at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:69) at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:71) at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:117) at org.glassfish.jersey.inject.cdi.se.injector.JerseyInjectionTarget.inject(JerseyInjectionTarget.java:171) at org.glassfish.jersey.inject.cdi.se.bean.SupplierClassBean.create(SupplierClassBean.java:127) at org.glassfish.jersey.inject.cdi.se.bean.SupplierClassBean.create(SupplierClassBean.java:89) at org.jboss.weld.contexts.AbstractContext.get(AbstractContext.java:96) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:676) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:699) at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:64) at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:86) at org.glassfish.jersey.inject.cdi.se.bean.SupplierBeanBridge.getSupplier(SupplierBeanBridge.java:162) at org.glassfish.jersey.inject.cdi.se.bean.SupplierBeanBridge.create(SupplierBeanBridge.java:133) at org.jboss.weld.contexts.unbound.DependentContextImpl.get(DependentContextImpl.java:70) at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100) at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:676) at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:699) at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:64) at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:86) at org.glassfish.jersey.inject.cdi.se.CdiSeInjectionManager.getInstanceInternal(CdiSeInjectionManager.java:183) at org.glassfish.jersey.inject.cdi.se.CdiSeInjectionManager.getInstance(CdiSeInjectionManager.java:166) at org.glassfish.jersey.server.model.internal.ResourceMethodInvokerConfigurator.lambda$postInit$0(ResourceMethodInvokerConfigurator.java:78) at org.glassfish.jersey.server.model.ResourceMethodInvoker$Builder.build(ResourceMethodInvoker.java:218) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createInflector(RuntimeModelBuilder.java:130) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createMethodRouter(RuntimeModelBuilder.java:117) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.createResourceMethodRouters(RuntimeModelBuilder.java:311) at org.glassfish.jersey.server.internal.routing.RuntimeModelBuilder.buildModel(RuntimeModelBuilder.java:200) at org.glassfish.jersey.server.internal.routing.Routing$Builder.buildStage(Routing.java:247) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:422) at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316) at org.glassfish.jersey.internal.Errors.process(Errors.java:316) at org.glassfish.jersey.internal.Errors.process(Errors.java:298) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:269) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:334) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:117)
I tried to register org.glassfish.jersey.server.validation.internal.ValidationBinder and the error disappears but bean validation is ignored and the service doesn't work.
If I use jersey-hk2 bean validation start to work but without CDI.