Hi,

Please, I need some help. We have created a RestEntityExceptionsHandler
annotated with @ExceptionHandler and the log appears with this warning
message every second:

[Server:dev-two] 13:46:30,207 WARNING
[org.apache.deltaspike.core.api.provider.BeanProvider]
(ajp-lxapldes3.xarxa.interna/172.28.191.50:8209-5) BeanProvider shall not
be used to create @Dependent scoped beans. Bean: Managed Bean [class
cat.tmb.tdo.ocicommerce.rest.exceptionhandling.handlers.rest.RestEntityExceptionsHandler]
with qualifiers [@Any @Default]


Could you please provide some feedback?

This is the class:

import
cat.tmb.tdo.ocicommerce.domain.exceptionhandling.OciCommerceEntityHasChildrenException;
import
cat.tmb.tdo.ocicommerce.domain.exceptionhandling.OciCommerceEntityNotFoundException;
import
cat.tmb.tdo.ocicommerce.domain.exceptionhandling.OciCommerceIncorrectModelDataException;
import cat.tmb.tdo.ocicommerce.rest.exceptionhandling.rest.RestRequest;
import org.apache.deltaspike.core.api.exception.control.ExceptionHandler;
import org.apache.deltaspike.core.api.exception.control.Handles;
import
org.apache.deltaspike.core.api.exception.control.event.ExceptionEvent;

import javax.persistence.EntityNotFoundException;
import javax.persistence.NoResultException;
import javax.validation.ConstraintViolationException;
import javax.ws.rs.core.Response;

import static cat.tmb.tdo.ocicommerce.rest.util.FluentDictionary.*;

/**
 * Entity related exceptions handling.
 *
 * @author upe00196
 */
@ExceptionHandler
public class RestEntityExceptionsHandler extends RestBaseHandler {

    private static final String ENTITY_HAS_CHILDREN_ERROR_CODE = "0003";
    private static final String ENTITY_NOT_FOUND_ERROR_CODE = "0004";
    private static final String CONSTRAINT_VIOLATION_ERROR_CODE = "0011";
    private static final String INCORRECT_MODEL_DATA_ERROR_CODE = "0014";

    /**
     * Handles the case when an entity cannot be removed because it has
children entities associated with it
     * that should be removed first.
     *
     * @param evt
     * @param builder
     */
    public void handleEntityHasChildren(@Handles @RestRequest
ExceptionEvent<OciCommerceEntityHasChildrenException> evt,
                                        Response.ResponseBuilder builder) {
        buildResponseFromCode(
                ENTITY_HAS_CHILDREN_ERROR_CODE,
                Response.Status.CONFLICT,
                builder);
        evt.handled();
    }


Thanks in advance.

Regards,

-- 
Esteve Avilés

Reply via email to