deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Esteve Avilés <eavil...@gmail.com>
Subject Re: Log error: BeanProvider shall not be used to create @Dependent scoped beans help
Date Thu, 12 Feb 2015 06:19:08 GMT
Mark,

Thanks for the reply.

We don't see in the code what you comment. Our implementation is based on:

https://github.com/jboss-developer/jboss-wfk-quickstarts/tree/2.6.x/deltaspike-exception-handling/src/main/java/org/jboss/as/quickstarts/deltaspike/exceptionhandling/rest


Thanks in advance.

Regards,

Esteve

On Mon, Feb 9, 2015 at 3:35 PM, Esteve Avilés <eavilesa@gmail.com> wrote:

> Mark,
>
> Thanks for the reply.
>
> We don't see in the code what you comment. I attach the exception handler
> package and you won't see the any usage.
>
> Thanks in advance.
>
> Regards,
>
> Esteve
>
>
> On Mon, Feb 9, 2015 at 3:06 PM, Mark Struberg <struberg@yahoo.de> wrote:
>
>> Hi Esteve!
>>
>> The reason why we log this message is that there might be some @Dependent
>> scoped beans which need cleanup. E.g. if they implement a @PreDestroy
>> method. This method will not get called if you get this bean via
>> BeanProvider#getContextualReference().
>>
>> There is an own method
>>
>> BeanProvider#getDependent()
>>
>> which gives you a DependentProvider<T> which implements get() and
>> destroy().
>> That way you can implement your code without those nasty messages. Plus
>> you will also be able to properly destroy your @Dependent scoped beans (if
>> needed).
>>
>> hth.
>>
>>
>> LieGrue,
>> strub
>>
>>
>>
>>
>>
>> > On Monday, 9 February 2015, 13:52, Esteve Avilés <eavilesa@gmail.com>
>> wrote:
>> > > 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
>> >
>>
>
>
>
> --
> Esteve Avilés
>



-- 
Esteve Avilés

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message