-
1. Re: No application context active in java.lang.Thread
gonorrhea Apr 6, 2009 5:44 PM (in response to resus)There is little mention or examples (see distro example projects) of using java.lang.Thread or java.lang.ThreadLocal in Seam apps.
Most likely there is another solution to your problem (perhaps asynchronous method call?)
Why don't you have a SLSB/SFSB that consumes the web service (i.e. makes the call to the web method in the exposed web service component) and then calls another method to complete processing?
Why is java.lang.Thread class even required here???
Assuming you are using an EJB3 component: as far as CMT is concerned, you can use different transaction attribute type declarations (i.e. REQUIRED, REQUIRESNEW, NOTSUPPORTED, etc) to achieve the correct transaction semantics for your use case.
Also be wary (this is a quote from DAllen's book):
Seam serializes concurrent requests that access the same conversation. This means only
one thread is allowed to access a conversation at any given time. -
2. Re: No application context active in java.lang.Thread
resus Apr 6, 2009 6:29 PM (in response to resus)My goal using java.lang.Thread was to reuse old code and framework used in another project.
Thanks for your quick response, I will investigate on the different solutions you mentioned an dsee if it is applicable to my application!
L.
-
3. Re: No application context active in java.lang.Thread
swd847 Apr 6, 2009 10:51 PM (in response to resus)You have to do like LifeCycle.beginCall() when the thread starts and LideCycle.endCall() when it ends.
-
4. Re: No application context active in java.lang.Thread
resus Apr 7, 2009 5:04 PM (in response to resus)The LifeCycle.beginCall()/LifeCycle.endCall() worked!
Thanks!
-
5. Re: No application context active in java.lang.Thread
amiliosanchez Feb 22, 2010 10:41 PM (in response to resus)I face similar issue, the begincall and endcall gives me contexts yes but I require those components which exist in the original contexts.
-
6. Re: No application context active in java.lang.Thread
resus Feb 23, 2010 1:19 PM (in response to resus)Not sure if I understand your question but you can get a component like this:
YourClass obj = (YourClass) Component.getInstance("yourClass");
with YourClass defined this way:
@Name("yourClass") @Stateful public class YourClassImpl implements YourClass{
-
7. Re: No application context active in java.lang.Thread
amiliosanchez Feb 23, 2010 9:31 PM (in response to resus)Whatever you get is associated with a new Contexts so all your scoped variables associated with the previous thread are no longer accessible.