This content has been marked as final.
Show 4 replies
-
1. Re: EntityManager - IllegalStateException: No application context active
kapitanpetko Dec 4, 2009 2:39 AM (in response to chrisbird)Since this spins off a new thread, it has no access to Seam contexts. That's the way Seam works: contexts are bound to the (servlet) thread.
And you shouldn't use threads in an application server anyway. One way to solve it is to have a component with an asynchronous method that does the work and call it from StartupThread (which shouldn't be a Thread, so maybe just Startup is a better name. Read about it: Asynchronicity and messagingWhat exactly are you trying to achieve?
-
2. Re: EntityManager - IllegalStateException: No application context active
chrisbird Dec 4, 2009 8:56 AM (in response to chrisbird)I need a component that transfer data in background between two tables in time intervals and control this component from another component (accessed from facelet), for example:
@Name( "transferHome" )
public class transferHome extends EntityHome<AnyData>
{
...
@In
private StartupThread startupThread;
public void x( )
{
startupThread.y( );
}
...
} -
3. Re: EntityManager - IllegalStateException: No application context active
kapitanpetko Dec 4, 2009 9:00 AM (in response to chrisbird)So write a component with an asynchronous method and call it from TransferHome (without extending Thread). Something like:
public class Transfer { @Ascynchronous public void transfer() { } }
-
4. Re: EntityManager - IllegalStateException: No application context active
chrisbird Dec 4, 2009 10:15 AM (in response to chrisbird)Thanks for your answer! Asynchronous tasks aren’t covered in 'Seam in Action' which I was read.