Skip to main content

@Asynchronous EJB method not being invoked as such from a @PostConstruct

1 reply [Last post]
emailnbw
Offline
Joined: 2008-05-28
Points: 0

I have a @Singleton @Startup no-interface EJB deployed in GF 3.1.2.

It's @PostConstruct method calls a method in on the same bean which is annotated with @Asynchronous.

That async method calls SessionContext.wasCancelCalled().

When wasCancelCalled() is called it throws a java.lang.IllegalStateException: Must be invoked from an async method.

The spec states that Singleton beans support reentrant calls.

Why does it not see this as the async method that it is? Can someone shed some light on this?

Thanks,

-Noah

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mvatkina
Offline
Joined: 2005-04-04
Points: 0

Do you call it directly or through a proxy ref? It should go through the
EJB container to become async.

-marina

Noah White wrote:
> I have a @Singleton @Startup no-interface EJB deployed in GF 3.1.2.
>
> It's @PostConstruct method calls a method in on the same bean which is annotated with @Asynchronous.
>
> That async method calls SessionContext.wasCancelCalled().
>
> When wasCancelCalled() is called it throws a java.lang.IllegalStateException: Must be invoked from an async method.
>
> The spec states that Singleton beans support reentrant calls.
>
> Why does it not see this as the async method that it is? Can someone shed some light on this?
>
> Thanks,
>
> -Noah
>
>