[jboss-jira] [JBoss JIRA] (JBJCA-1388) Validator is created using rar ClassLoader as the TCCL

Lin Gao (Jira) issues at jboss.org
Wed Apr 10 23:06:01 EDT 2019


     [ https://issues.jboss.org/browse/JBJCA-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lin Gao updated JBJCA-1388:
---------------------------
    Description: 
[org.jboss.jca.core.rar.EndpointImpl.activate|https://github.com/ironjacamar/ironjacamar/blob/1.4/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java#L165] is setting the TCCL to be that of the resource adapter's ClassLoader, which would be the rar's custom module if the rar is deployed as a JBoss module, however inside this same block it is creating the Bean Validator, so it goes looking for the provider in the rar's module instead of the JBoss IJ module.

This would lead to the following exception if the rar is deployed as a module:

{code}
ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0215: Failed to resume activity org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1 at 3f9a21a1. To resume normal operation it is recommended that you restart the server.: java.lang.RuntimeException: javax.resource.ResourceException: IJ000852: Validation exception
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:273)
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.access$300(MessageDrivenComponent.java:63)
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.resume(MessageDrivenComponent.java:109)
	at org.jboss.as.server.suspend.SuspendController.resume(SuspendController.java:126)
	at org.jboss.as.server.ServerService.finishBoot(ServerService.java:430)
	at org.jboss.as.server.ServerService.boot(ServerService.java:398)
	at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:370)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.resource.ResourceException: IJ000852: Validation exception
	at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:177)
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:271)
	... 7 more
Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
	at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
	at org.jboss.jca.core.bv.BeanValidationUtil.createValidatorFactory(BeanValidationUtil.java:51)
	at org.jboss.jca.core.bv.BeanValidationUtil.createValidator(BeanValidationUtil.java:63)
	at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:165)
	... 8 more
{code}

A workaround is add the implementation specific module to the customer's rar module:

{code}
<module name="org.hibernate.validator" services="export"/>
{code}

But dependency on org.hibernate.validator of a rar module should be internal by the IJ implementation, so that dependency should not be necessary.

  was:
[org.jboss.jca.core.rar.EndpointImpl.activate|https://github.com/ironjacamar/ironjacamar/blob/1.4/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java#L165] is setting the TCCL to be that of the resource adapter's ClassLoader, which would be the rar's custom module if the rar is deployed as a JBoss module, however inside this same block it is creating the Bean Validator, so it goes looking for the provider in the rar's module instead of the JBoss IJ module.

This would lead to the following exception if the rar is deployed as a module:

{code}
ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0215: Failed to resume activity org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1 at 3f9a21a1. To resume normal operation it is recommended that you restart the server.: java.lang.RuntimeException: javax.resource.ResourceException: IJ000852: Validation exception
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:273)
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.access$300(MessageDrivenComponent.java:63)
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.resume(MessageDrivenComponent.java:109)
	at org.jboss.as.server.suspend.SuspendController.resume(SuspendController.java:126)
	at org.jboss.as.server.ServerService.finishBoot(ServerService.java:430)
	at org.jboss.as.server.ServerService.boot(ServerService.java:398)
	at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:370)
	at java.lang.Thread.run(Thread.java:748)
Caused by: javax.resource.ResourceException: IJ000852: Validation exception
	at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:177)
	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:271)
	... 7 more
Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
	at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
	at org.jboss.jca.core.bv.BeanValidationUtil.createValidatorFactory(BeanValidationUtil.java:51)
	at org.jboss.jca.core.bv.BeanValidationUtil.createValidator(BeanValidationUtil.java:63)
	at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:165)
	... 8 more
{code}

A workaround is add the implementation specific module to the customer's rar module:

{code}
<module name="org.hibernate.validator" services="export"/>
{code}





> Validator is created using rar ClassLoader as the TCCL
> ------------------------------------------------------
>
>                 Key: JBJCA-1388
>                 URL: https://issues.jboss.org/browse/JBJCA-1388
>             Project: IronJacamar
>          Issue Type: Bug
>          Components: Core
>         Environment: In WildFly master
>            Reporter: Lin Gao
>            Assignee: Lin Gao
>            Priority: Major
>
> [org.jboss.jca.core.rar.EndpointImpl.activate|https://github.com/ironjacamar/ironjacamar/blob/1.4/core/src/main/java/org/jboss/jca/core/rar/EndpointImpl.java#L165] is setting the TCCL to be that of the resource adapter's ClassLoader, which would be the rar's custom module if the rar is deployed as a JBoss module, however inside this same block it is creating the Bean Validator, so it goes looking for the provider in the rar's module instead of the JBoss IJ module.
> This would lead to the following exception if the rar is deployed as a module:
> {code}
> ERROR [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0215: Failed to resume activity org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1 at 3f9a21a1. To resume normal operation it is recommended that you restart the server.: java.lang.RuntimeException: javax.resource.ResourceException: IJ000852: Validation exception
> 	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:273)
> 	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.access$300(MessageDrivenComponent.java:63)
> 	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.resume(MessageDrivenComponent.java:109)
> 	at org.jboss.as.server.suspend.SuspendController.resume(SuspendController.java:126)
> 	at org.jboss.as.server.ServerService.finishBoot(ServerService.java:430)
> 	at org.jboss.as.server.ServerService.boot(ServerService.java:398)
> 	at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:370)
> 	at java.lang.Thread.run(Thread.java:748)
> Caused by: javax.resource.ResourceException: IJ000852: Validation exception
> 	at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:177)
> 	at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent.activate(MessageDrivenComponent.java:271)
> 	... 7 more
> Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
> 	at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
> 	at org.jboss.jca.core.bv.BeanValidationUtil.createValidatorFactory(BeanValidationUtil.java:51)
> 	at org.jboss.jca.core.bv.BeanValidationUtil.createValidator(BeanValidationUtil.java:63)
> 	at org.jboss.jca.core.rar.EndpointImpl.activate(EndpointImpl.java:165)
> 	... 8 more
> {code}
> A workaround is add the implementation specific module to the customer's rar module:
> {code}
> <module name="org.hibernate.validator" services="export"/>
> {code}
> But dependency on org.hibernate.validator of a rar module should be internal by the IJ implementation, so that dependency should not be necessary.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list