Problem programming a java class (NotesException: Cannot service method call on uninitialized thread)

I am programming a java class to run in an applet. This applet is not yet embedded in a notes form, because i am still developing in Eclipse.

The class has one member variable “database”, which is initalized in the constructor:

database = NotesFactory.createSession().getDatabase(“”,“abc.nsf”)

In multiple public class methods I am building DocumentCollections with

DocumentCollection col = database.search(“form="activity"”);

After the fourth calling of one of the methods building a collection, i get a NotesException

“NotesException: Cannot service method call on uninitialized thread”.

I am wondering, why first everything runs fine and then this error occurs?

The class is not implemented Runnable.

Subject: Sounds like you session has been garbage collected…

Try:session = NotesFactory.createSession()

database = session.getDatabase(“”,“abc.nsf”)

Subject: RE: Sounds like you session has been garbage collected…

maybe you should try to initialize a notes thread before you try to access the document collection, by NotesThread.sinitThread() and kill the thread afterwards by NotesThread.stermThread()