+

Search Tips   |   Advanced Search

Troubleshooting bean validation in RAR modules

RAR beans that fail validation are not placed into service. When constraint violations occur, applications encounter resource connectivity issues that are different according to the bean type and how the RAR is deployed. This topic explains how to understand, service, and prevent these known issues.


RAR bean constraint violations

WebSphere Application Server displays a constraint violation exception and reports all constraint violations to the system log when it validates RAR bean instances that violate one or more constraints. The cause of all constraint violation must be determined and resolved to restore full connectivity to the affected resource.

Problem determination starts with consulting the RAR provider documentation for the valid values of the configuration properties that are indicated in the violations. If the property values are invalid, you must reconfigure them according to the documentation and restart the resource adapter. If the adapter is embedded in an application, then restart the application to restart the adapter; if the adapter is stand-alone, then restart the application server.

If a valid configuration property value is indicated in a violation, then the constraint might be incorrectly specified for the bean, or the bean is incorrectly computing the property value. In these cases, the RAR vendor must correct the problem.

If the problem is caused by a faulty constraint definition (implementation), then the bean validation provider must correct the problem. In these cases, if the RAR is provided by IBM , or the RAR uses the bean validation implementation supplied by the Application Server, then contact IBM support to continue problem determination.


ResourceAdapter beans

ResourceAdapter beans are validated when the server starts a Java 2 Connector (J2C) resource adapter. When validation fails, the server rejects the ResourceAdapter instance and the resulting constraint violation exception causes the J2C resource adapter to fail. Applications cannot establish outbound connections to the resource, and the resource cannot deliver messages to applications. For an embedded adapter, the application that embeds the adapter fails to start. In-doubt transactions that involve the resource cannot be recovered.

The following example is a ResourceAdapter bean, MyConnector, at heap address 7efa7efa. Two validation constraints are violated. The constraint violation exception causes J2CResourceAdapter_1285109360562 to fail:

[9/29/10 10:51:24:125 CDT] 00000000 BeanValidatio E     J2CA0238E: JavaBean com.my.company.adapter.MyConnector@7efa7efa failed Bean Validation due to one or more invalid
 configuration settings indicated in the following list of constraint violations:    ConstraintViolationImpl{interpolatedMessage='The minimum size is 2', propertyPath=dataBaseName, rootBeanClass=class      com.my.company.adapter.MyConnector, messageTemplate='The minimum size is 2'}
 ConstraintViolationImpl{interpolatedMessage='must be greater than or equal to 10', propertyPath=idleTimeout, rootBeanClass=class
    com.my.company.adapter.MyConnector, messageTemplate='{javax.validation.constraints.Min.message}'}
 [9/29/10 10:51:24:468 CDT] 00000000 RALifeCycleMa E     J2CA0128E: An Exception occurred while trying to start ResourceAdapter
  cells/IBM-46DF84D297BNode01Cell/nodes/IBM-46DF84D297BNode01/resources.xml#J2CResourceAdapter_1285109360562. The exception is:  com.ibm.ejs.j2c.metadata.ConstraintViolationException
 at com.ibm.ejs.j2c.metadata.BeanValidationHelper.validate(
 at com.ibm.ejs.j2c.RAWrapperImpl.createAndConfigureRA(
 at com.ibm.ejs.j2c.RAWrapperImpl.startRA(
 at com.ibm.ejs.j2c.RALifeCycleManagerImpl.startRA(
 at com.ibm.ejs.j2c.RALifeCycleManagerImpl.resourceProviderEvent(
. . .


ManagedConnectionFactory beans

ManagedConnectionFactory JavaBeans are validated during the initial JNDI lookup of a J2C connection factory.

When validation fails, the Application Server rejects the ManagedConnectionFactory instance and displays a naming exception to the application that performs the lookup. This exception indicates the causal constraint violation exception (javax.validation.ConstraintValidationException).

Applications cannot establish outbound connections to the resource. In-doubt transactions started over connections to the resource that were created by the connection factory cannot be recovered.

The following example is a ManagedConnectionFactory bean, MyMcf, at heap address 7dd07dd0, Two validation constraints are violated. The constraint violation exception causes the application to not obtain a connection factory required to create a connection to the resource, MyConnector:

[9/30/10 7:58:58:734 CDT] 00000023 BeanValidatio E    J2CA0238E: JavaBean com.my.company.adapter.MyMcf@7dd07dd0 failed Bean Validation due to one or more invalid
  configuration settings indicated in the following list of constraint violations:   ConstraintViolationImpl{interpolatedMessage='must be less than or equal to 30', propertyPath=mcfProperty2, rootBeanClass=class com.my.company.adapter.MyMcf, messageTemplate='{javax.validation.constraints.Max.message}'}
 ConstraintViolationImpl{interpolatedMessage='The value should be greater than 10', propertyPath=mcfProperty4, rootBeanClass=class com.my.company.adapter.MyMcf, messageTemplate='The value should be greater than 10'}
.
[9/30/10 7:58:58:765 CDT] 00000023 ConnectionFac E    J2CA0009E: An exception occurred while trying to instantiate the ManagedConnectionFactory class com.my.company.adapter.MyMcf
  used by resource j2c/MyConnector : com.ibm.ejs.j2c.metadata.ConstraintViolationException
 at com.ibm.ejs.j2c.metadata.BeanValidationHelper.validate(
 at com.ibm.ejs.j2c.ServerFunction.validate(
 at com.ibm.ejs.j2c.J2CUtilityClass.createMCFEntry(
   at javax.naming.InitialContext.lookup(
 at com.my.company.app.MyEjbImpl.testJbv(
. . . 


ActivationSpec bean violations

ActivationSpec beans are validated when the applications starts. This is when the Application Server initially activates message endpoints bound to J2C activation specifications. These activation specifications name the bean class in their configuration. When validation fails, the endpoint fails to activate and the resulting constraint violation exception causes the application hosting the endpoint to fail.

Because the J2C resource adapter containing the activation specification is started, applications can still establish connections to the resource. The resource can deliver messages to endpoints that have successfully activated. If the activation specification is defined within an embedded resource adapter, the server stops the adapter in the course of stopping the application. Failed transactional messages delivered by previous instances of the resource adapter containing the activation specification cannot be recovered.

The following example is an ActivationSpec bean, MyActSpec, at heap address 51625162. Two validation constraints are violated. The log shows the constraint violation exception that causes the application, my_company_app, to fail:

[9/29/10 10:52:05:125 CDT] 00000009 BeanValidatio E    J2CA0238E: JavaBean com.my.company.adapter.MyActSpec@51625162 failed Bean Validation due to one or more invalid
  configuration settings indicated in the following list of constraint violations:   ConstraintViolationImpl{interpolatedMessage='Size should be between 2 and 4', propertyPath=asProperty1, rootBeanClass=class com.my.company.adapter.MyActSpec, messageTemplate='Size should be between 2 and 4'}
 ConstraintViolationImpl{interpolatedMessage='Should be < 30', propertyPath=asProperty2, rootBeanClass=class com.my.company.adapter.MyActSpec, messageTemplate='Should be < 30'}
[9/29/10 10:52:05:171 CDT] 00000009 RAWrapperImpl E    J2CA0089E: The method activateEndpoint on ResourceAdapter JavaBean
   cells/IBM-46DF84D297BNode01Cell/nodes/IBM-46DF84D297BNode01/resources.xml#J2CResourceAdapter_1285109389828
 failed with the following exception:
  javax.resource.ResourceException: com.ibm.ejs.j2c.metadata.ConstraintViolationException
 at com.ibm.ejs.j2c.ActivationSpecWrapperImpl.validateActivation( at com.ibm.ejs.j2c.ActivationSpecWrapperImpl.createAndInitializ(
 at com.ibm.ejs.j2c.ActivationSpecWrapperImpl.activateEndpoint(
 [9/29/10 10:52:05:750 CDT] 00000009 ApplicationMg A   WSVR0217I: Stopping application: my_company_app
. . .


AdministeredObject beans

AdministeredObject beans are validated when the server starts a J2C resource adapter containing the administered object in its configuration. When validation fails, the server rejects the AdministeredObject instance and the resulting constraint violation exception causes the resource adapter to fail.

The following example is an AdministeredObject beans, MyAdminObj, at heap address 3a803a80. Two validation constraints are violated. The log shows the constraint violation exception that causes resource adapter to fail:

[9/29/10 10:51:25:125 CDT] 00000000 BeanValidatio E    J2CA0238E: JavaBean com.my.company.adapter.MyAdminObj@3a803a80 failed Bean Validation due to one or more invalid
  configuration settings indicated in the following list of constraint violations:   ConstraintViolationImpl{interpolatedMessage='The value should be greater than 10', propertyPath=aoProperty4, rootBeanClass=class com.my.company.adapter.MyAdminObj, messageTemplate='The value should be greater than 10'}
 [9/29/10 10:51:25:218 CDT] 00000000 AdminObjectSe A    J2CA0017I: An exception occurred while building the serializable for JNDI deployment of jms/MyAdminObj :
 com.ibm.ejs.j2c.metadata.ConstraintViolationException
 at com.ibm.ejs.j2c.metadata.BeanValidationHelper.validate(
 at com.ibm.ejs.j2c.metadata.BeanValidationHelper.validate(
 at com.ibm.ejs.j2c.AdminObjectSerBuilderImpl._createAndValidate(
 at com.ibm.ejs.j2c.AdminObjectSerBuilderImpl.createAndValidate(
 at com.ibm.ejs.j2c.RALifeCycleManagerImpl.startRA(
. . . 


Related concepts

  • JCA 1.6 support for annotations in RAR modules
  • Bean validation in RAR modules