Problem shutting down when creating ejb's inside another ejb
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Matt_Morley
Posted On:   Wednesday, May 29, 2002 06:26 AM

Hello, I am running the Oracle9iAS OC4J server. I have a EJB that uses other EJB's. When I create the other EJB's, and run my test application, the server will not shut down, the process just hangs after attempting a shut down. If I comment out the code that creates the other EJB's, then when the tester application runs, and then I stop the server, the sever shuts down properly. Here is my create code. It is called when the other methods need the ejb. private SDRMailMgr getSDRMailMgrEJB() { if (sdrMailMgrEJB==null){ Object objref = null; String ejbname = null; // set up Client calls to SDRAlertMgr and SDR MailMgr Bean if ( environment == null )    More>>

Hello,

I am running the Oracle9iAS OC4J server. I have a EJB that uses other EJB's. When I create the other EJB's, and run my test application, the server will not shut down, the process just hangs after attempting a shut down.

If I comment out the code that creates the other EJB's, then when the tester application runs, and then I stop the server, the sever shuts down properly.

Here is my create code. It is called when the other methods need the ejb.


private SDRMailMgr getSDRMailMgrEJB()

			{
			
if (sdrMailMgrEJB==null){
Object objref = null;
String ejbname = null;
// set up Client calls to SDRAlertMgr and SDR MailMgr Bean
if ( environment == null )
setClientEJBEnv();
try {
// lookUp SDRMailMgr EJB
Debug.println(Debug.INFO, "SDRWorkFlowManager: ejbCreate: Creating an initial context to SDRMailMgr");
Context ic = new InitialContext(environment);
ejbname = "SDRMailMgr";
//System.out.println("Looking for the EJB published as '" + "ormi://" + hostname + ":" + port + "/" + appname + "/" + ejbname + "'");
Debug.println(Debug.INFO, "SDRWorkFlowManager: ejbCreate: Looking for the EJB published as '" + (String) environment.get(Context.PROVIDER_URL));
objref = ic.lookup(ejbname);
if ( objref != null ) {
// get home interface for the Mail Manager EJB
mil.navy.navsup.sdr.component.mailmgr.ejb.SDRMailMgrHome homeInterface = (mil.navy.navsup.sdr.component.mailmgr.ejb.SDRMailMgrHome)
PortableRemoteObject.narrow(objref,
mil.navy.navsup.sdr.component.mailmgr.ejb.SDRMailMgrHome.class);
// get the remote interface for Mail Manager EJB
sdrMailMgrEJB = homeInterface.create();
}
// Test the EJBs
Debug.println(Debug.INFO, "SDRWorkFlowManager: ejbCreate: sdrMailMgrEBJ ping: "+ sdrMailMgrEJB.pingSDRMailMgrEJB());
} catch ( Exception e ) {
Debug.println(Debug.CRITICAL, "SDRWorkFlowManager: ejbCreate: Exception in SDRWorkFLowManagerBean.ejbCreate() : " + e.getMessage());
e.printStackTrace();
}
}
return sdrMailMgrEJB;
}


private void setClientEJBEnv()
			
{
String hostname = "localhost";
String port = "23841";
String username = "sdr";
String password = "sdr11";
String appname = "sdrdev";

environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
environment.put(Context.SECURITY_PRINCIPAL, username);
environment.put(Context.SECURITY_CREDENTIALS, password);
environment.put(Context.PROVIDER_URL, "ormi://" + hostname + ":" + port + "/" + appname);
}


Thanks for any help
Matt

   <<Less

Re: Problem shutting down when creating ejb's inside another ejb

Posted By:   Matt_Morley  
Posted On:   Wednesday, May 29, 2002 10:08 AM

Ok,

I answered my own question.

By using the default Context: Context ic = new InitialContext();

Everything works fine and the server shuts down cleanly.

New Question:

Why is getting the Context with properties bad in this case? Why won't the server shutdown cleanly? Why a default constructor when calling a EJB within a EJB?

If anyone knows, please let me know

Thanks,
Matt

About | Sitemap | Contact