I am running 3.0.7 and have 30 Entity Beans and 8 or so MDBs.  What I have done 
is put a Thread.sleep(5000) in my MDB's before they call a generic ping on the 
session beans.  The ping forces the session beans to start which also starts a 
bunch of my logic that calls entity beans.  If the beans are not ready then I 
get the same error.  Note that you make need a longer sleep time if you have 
more entity, session and mdbs.  Below is the meat of making the MDB wait:

    public void startService() throws Exception {
        new UpdateThread().start();
        setUpReceiver();
    }

    private class UpdateThread extends Thread {
        private final static int sleepTime = 5000;   
        public UpdateThread() {
            this.setPriority(Thread.MIN_PRIORITY);
        }
        public void run() {
            try {
                this.sleep(sleepTime);
            } catch (java.lang.InterruptedException e) {
                //e.printStackTrace();
            }
            try {
                touchStateDBSession();
            } catch(Exception e) {
                System.out.println("StateDBCleanService.UpdateThread.run() - 
Error="+e.getMessage());
            }
        }     
    }

    private void touchStateDBSession() {
        InitialContext lContext = null;
        StateDBSessionHome stateDBSessionHome = null;
        StateDBSession stateDBSession = null;
        try {
            lContext = new InitialContext();
            stateDBSessionHome = (StateDBSessionHome) 
lContext.lookup("ejb/StateDBSession");
            stateDBSession = (StateDBSession)stateDBSessionHome.create();
            stateDBSession.ping();
        } catch(Exception fe) {
            fe.printStackTrace();
        } finally {
            if(stateDBSession!=null) {
                try {
                    stateDBSession.remove();
                } catch(Exception e) { }
                stateDBSession = null;
            }
            stateDBSessionHome = null;
            if(lContext!=null) {
                try {
                    lContext.close();
                } catch(Exception e) { }
                lContext = null;
            }
        }
    }        



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3919651#3919651

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3919651


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to