Probably not the right group and I'm new to ejb's and am having a problem
getting a sesson bean going from within an Action class (a class from the apache
struts framework which probably doesn't make a difference what the class is). Is
this on the right track to doing this correctly, though I get the following
error.
javax.naming.NameNotFoundException: ConfigHome not
found
at com.evermind.server.rmi.RMIContext.lookup(JAX, Compiled Code) at com.evermind.server.hm.f4(JAX, Compiled Code) at com.evermind.server.hm.lookup(JAX, Compiled Code) at javax.naming.InitialContext.lookup(InitialContext.java, Compiled Code) My Sesson bean is made up of the following:
ConfigHome - home interface ConfigBean - session bean Config - ejbobject interface My ejb-jar.xml file looks like this.
<session>
<display-name>Configuration Session Bean</display-name> <ejb-name>com.neuroquest.cais.ejb.config.Config</ejb-name> <home>com.neuroquest.cais.ejb.config.ConfigHome</home> <remote>com.neuroquest.cais.ejb.config.Config</remote> <ejb-class>com.neuroquest.cais.ejb.config.ConfigBean</ejb-class> <session-type>Stateless</session-type> </session> Any help much appreciated. ----------------------------------
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { String initCtxFactory =
getInitParameter(Context.INITIAL_CONTEXT_FACTORY);
String providerURL = getInitParameter(Context.PROVIDER_URL); try
{
Properties env = System.getProperties(); env.put(Context.INITIAL_CONTEXT_FACTORY, initCtxFactory); env.put(Context.PROVIDER_URL, providerURL); Context ctx = new
InitialContext(env);
ConfigHome home =
(ConfigHome) ctx.lookup("ConfigHome");
ConfigBean cfgBean =
home.create();
cfgBean.doMyMethod(); } catch (Exception e) { log(e); e.printStackTrace(); } |
- Re: init'ing a session bean in Action G.L. Grobe
- Re: init'ing a session bean in Action Ana Narvaez Vila