Re: JBoss3.0 & Tomcat4 server error
Posted By:
Cindy_Zhang
Posted On:
Tuesday, April 23, 2002 07:02 AM
Try this:
Properties prop = new Properties();
try{
prop.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
prop.put(Context.PROVIDER_URL, "jnp://localhost:1099");
/** if the application server requires username and
password, add the PRINCIPAL AND CREDENTIALS **/
prop.put(Context.SECURITY_PRINCIPAL,"username");
prop.put(Context.SECURITY_CREDENTIALS,"password");
}catch(Exception e){
e.printStackTrace();
}
try{
InitialContext ic = new InitialContext(prop);
java.lang.Object objref = ic.lookup
("ejb/DocSettingEJBTable");
DocSettingEJBTableHome home =
(DocSettingEJBTableHome)
PortableRemoteObject.narrow
(objref, DocSettingEJBTableHome.class);
DocSettingEJBTableBean bean = home.create();
}catch(Exception e){
e.printStackTrace();
}
Make sure that you have the beans deployed and created a jar file for the remote interface, and import the jar file in your ejb connector.
Hope the above helps a bit.
Good luck
Cindy