-
Bug
-
Resolution: Done
-
Major
-
3.0.8.Final
-
None
While testing out Wildfly 8.1.0.RC1 I run into a "WELD-001456: Argument resolvedBean must not be null" exception. The ValidatorFactory provided by the LazyValidatorFactory belongs to a different application/class loader than the delegate. Most likely caused by the fix for RESTEASY-1008.
Fastest way to reproduce: start both our applications (can fail but works most of the time), redeploy App2, make rest call to App1 -> exception
Stacktrace from App1 (note the lines with JaxrsInjectionTarget and LazyValidatorFactory):
Preconditions.checkArgumentNotNull(Object, String) line: 40
BeanManagerImpl.getReference(InjectionPoint, Bean<?>, CreationalContext<?>) line: 766
ParameterInjectionPointImpl<T,X>.getValueToInject(BeanManagerImpl, CreationalContext<?>) line: 76
ConstructorInjectionPoint<T>.getParameterValues(BeanManagerImpl, CreationalContext<?>, CreationalContext<?>) line: 138
ConstructorInjectionPoint<T>.newInstance(BeanManagerImpl, CreationalContext<?>) line: 68
DefaultInstantiator<T>(AbstractInstantiator<T>).newInstance(CreationalContext<T>, BeanManagerImpl) line: 28
BeanInjectionTarget<T>(BasicInjectionTarget<T>).produce(CreationalContext<T>) line: 85
BeanInjectionTarget<T>.produce(CreationalContext<T>) line: 183
DestructibleBeanInstance<T>.createAndInjectBeans(BeanManager, InjectionTarget<T>) line: 53
DestructibleBeanInstance<T>.<init>(BeanManager, Class<T>) line: 33
ValidatorFactoryBean.createInstance(Class<T>) line: 206
ValidatorFactoryBean.createConstraintValidatorFactory(Configuration<?>) line: 192
ValidatorFactoryBean.create(CreationalContext<ValidatorFactory>) line: 119
ValidatorFactoryBean.create(CreationalContext) line: 52
ApplicationContextImpl(AbstractContext).get(Contextual<T>, CreationalContext<T>) line: 96
ContextBeanInstance<T>.getInstance() line: 98
ProxyMethodHandler.invoke(Object, Method, Method, Object[]) line: 99
ValidatorFactory$627848863$Proxy$_$$_WeldClientProxy.getValidator() line: not available [local variables unavailable]
LazyValidatorFactory.getValidator() line: 73
GeneralValidatorImpl.getValidator(HttpRequest) line: 556
GeneralValidatorImpl.validate(HttpRequest, Object, Class<?>...) line: 69
JaxrsInjectionTarget<T>.validate(HttpRequest, T) line: 108
JaxrsInjectionTarget<T>.inject(T, CreationalContext<T>) line: 69
WeldInjectionContext.inject(Object) line: 39
WeldInjectionInterceptor.processInvocation(InterceptorContext) line: 51
InterceptorContext.proceed() line: 309
If we look at the JaxrsInjectionTarget we see the following:
JaxrsInjectionTarget = this
clazz = our own rest resource class with the @Path annotation on it
delegate.beanManager = Weld BeanManager for App1
validator.validatorFactory.classLoader = ClassLoader for App2
To me it seems that there is only a single ResteasyProviderFactory for the entire WF instance. The application starting last (or getting redeployed) updates the context resolver list on the ResteasyProviderFactory with a LazyValidatorFactory.for the GeneralValidatorCDI key. The LazyValidatorFactory is bound to the classloader of the registering application. Hence a problem for App1 when it tries to resolve beans using the LazyValidatorFactory registered by App2.
- clones
-
RESTEASY-1008 Bean Validation + CDI + field injection not working
- Closed