May be Jboss store some context information in the thread context: if you
start a thread, these information are missing. Starting a thread in the EJB
container is *****illegal*****.
If you need to call an EJB method time to time, on a regular basis, you
cannot create a Thread in the EJB container. You can solve this problem by
adding a "Timer service" in a RMI server.
Create RMI object which manage remote timers. This object must run in a
separate RMI server so that it can call you EJB method on a regular basis.
public interface TimerService extends Remote {
TimerID create(long milliseconds, TimableEJB timable) throws
Remote Exception;
void resume(TimerID id) throws Remote Exception;
... and so on ...
}
public interface Timable {
void onTimer() throzs RemoteException;
}
The EJB interface:
public interface MyBean extends EJBObject, Timable {
... other remote methods here ...
}
Then, you need to register your EJB with the Timer service:
MyBean bean = .... the EJB to be registered ...
TimerService tserv = ... get the remote interface from the RMI
server ...
TimerID id = tserv.create(1000000, bean);
// This code is not tested, just an idea....
You can deploy RMI object in some J2ee servers such as BEA WLS. I
don't know for ejbBoss, else you can start a separate server process.
Tibo.
>-----Original Message-----
>From: Ashish Kalra [mailto:[EMAIL PROTECTED]]
>Sent: Friday, January 05, 2001 11:56 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Thread on the EJBServer
>
>
>Can you also please suggest some options for how to achieve
>something I am
>trying to achieve?
>
>Thanks,
>-ashish
>
> -----Original Message-----
> From: Bono, Chris [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, January 05, 2001 10:38 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Thread on the EJBServer
>
> Ashish,
> I am not familiar w/ JBoss but one thing I do know is
>you should not
>be
> starting a thread from an ejb
>
> Chris
>
> >>>The thread is started through static code in one
> >>>of the beans.
>
> -----Original Message-----
> From: Ashish Kalra [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 05, 2001 6:37 AM
> To: [EMAIL PROTECTED]
> Subject: Thread on the EJBServer
>
>
> I need a thread on the EJB Server which needs to keep
>doing some
>background
> processing all the while. This thread is another class
>which from
>time to
> time should be able to access a bean and invoke its
>method. I am
>trying to
> get reference to the Home Interface by using look up with the
>Initial
> Context. I get a ClassNotFoundException which says
>that the Home
>class for
> the Bean could not be found. This thread class and
>Bean are in the
>same jar
> in Jboss's deploy folder. The thread is started
>through static code
>in one
> of the beans.
>
> Any help will be greatly appreciated.
> Thanks,
> -ashish
>
>
>===============================================================
>============
> To unsubscribe, send email to [EMAIL PROTECTED]
>and include in
>the body
> of the message "signoff EJB-INTEREST". For general
>help, send email
>to
> [EMAIL PROTECTED] and include in the body of the
>message "help".
>
>
>===============================================================
>============
> To unsubscribe, send email to [EMAIL PROTECTED]
>and include in
>the body
> of the message "signoff EJB-INTEREST". For general
>help, send email
>to
> [EMAIL PROTECTED] and include in the body of the
>message "help".
>
>===============================================================
>============
>To unsubscribe, send email to [EMAIL PROTECTED] and
>include in the body
>of the message "signoff EJB-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".