users@tyrus.java.net

Re: CDI Interceptor on a WebSocket endpoint

From: Arun Gupta <arun.p.gupta_at_oracle.com>
Date: Mon, 25 Feb 2013 15:18:39 -0800

Hi Stepan,

Thanks for filing the issue, I'll follow it there.

Arun

On 2/25/13 2:39 PM, Stepan Kopriva wrote:
> Hi Arun,
>
> I have deployed your sample on the latest GF
> http://dlc.sun.com.edgesuite.net/glassfish/4.0/nightly/glassfish-4.0-b78-02_22_2013.zip
> and was able to get the Exception.
>
> I have logged the following bug: http://java.net/jira/browse/TYRUS-107
>
> Stepan
>
>
> On Feb 18, 2013, at 8:37 PM, Arun Gupta <arun.p.gupta_at_oracle.com
> <mailto:arun.p.gupta_at_oracle.com>> wrote:
>
>> Attached.
>>
>> Arun
>>
>> On 2/18/13 11:29 AM, Stepan Kopriva wrote:
>>> Hi Arun,
>>>
>>> could you send me the case you are deploying please? I will take a look.
>>>
>>> Stepan
>>>
>>>
>>> On Feb 17, 2013, at 2:42 AM, Arun Gupta <arun.p.gupta_at_oracle.com
>>> <mailto:arun.p.gupta_at_oracle.com>> wrote:
>>>
>>>> Deployed a POJO endpoint as defined at:
>>>>
>>>> @WebSocketEndpoint(value="/websocket-cdi")
>>>> @Logging
>>>> public class MyEndpointWithCDI {
>>>>
>>>> @Inject MyBean bean;
>>>>
>>>> @WebSocketMessage
>>>> public String sayHello(String name) {
>>>> return bean.sayHello(name);
>>>> }
>>>> }
>>>>
>>>> @Logging is a standard CDI interceptor with @AroundInvoke and
>>>> MyBean is a POJO. Deploying this application throws the following
>>>> exception:
>>>>
>>>> INFO: Closing down : org.glassfish.tyrus.server.TyrusEndpoint_at_361cb3dd
>>>> INFO: Closing down : org.glassfish.tyrus.server.TyrusEndpoint_at_23a18c70
>>>> SEVERE: Exception during invocation of
>>>> InjectionManager.destroyManagedObject on
>>>> org.glassfish.tyrus.servlet.TyrusServletFilter_at_2add39c5 of web
>>>> module
>>>> StandardEngine[glassfish-web].StandardHost[server].StandardContext[/injection]
>>>> java.lang.IllegalStateException: Unknown JCDI-enabled managed bean
>>>> org.glassfish.tyrus.servlet.TyrusServletFilter_at_2add39c5 of class
>>>> class org.glassfish.tyrus.servlet.TyrusServletFilter
>>>> at
>>>> com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.destroyManagedBean(ManagedBeanManagerImpl.java:622)
>>>> at
>>>> com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.destroyManagedObject(InjectionManagerImpl.java:439)
>>>> at
>>>> com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.destroyManagedObject(InjectionManagerImpl.java:414)
>>>> at
>>>> com.sun.web.server.WebContainerListener.preDestroy(WebContainerListener.java:186)
>>>> at
>>>> com.sun.web.server.WebContainerListener.containerEvent(WebContainerListener.java:151)
>>>> at
>>>> org.apache.catalina.core.ContainerBase.fireContainerEvent(ContainerBase.java:1579)
>>>> at
>>>> org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:334)
>>>> at
>>>> org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:5322)
>>>> at
>>>> org.apache.catalina.core.StandardContext.stop(StandardContext.java:6085)
>>>>
>>>> Invoking the endpoint throws the following message in server.log:
>>>>
>>>> SEVERE: No valid EE environment for injection of
>>>> org.glassfish.injection.MyEndpointWithCDI
>>>> SEVERE: No valid EE environment for injection of
>>>> org.glassfish.injection.MyBean
>>>>
>>>> However the communication between client and endpoint works as
>>>> expected.
>>>>
>>>> What should happen if a CDI interceptor is enabled on a WebSocket
>>>> endpoint ?
>>>>
>>>> Arun
>>>>
>>>> --
>>>> http://twitter.com/arungupta
>>>> http://blogs.oracle.com/arungupta
>>>>
>>
>> --
>> http://twitter.com/arungupta
>> http://blogs.oracle.com/arungupta
>>
>> <injection.zip>
>

-- 
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta