Here is some code from our system that looks up an entity bean. We are
running on JRun 3.0 sp2. There are a couple of things to note. First,
notice the line that sets up an RMISecurityManager. I found that EJB
lookups would return the error you describe if this is not done. Second,
note the properties that are being passed into the InitialContext. The
third and most obvious issue would be the lookup name that you are using.
By default a bean's home interface JNDI name is the name of the class that
implements the bean. It can be configured to be otherwise. Since you have
connected to the bean previously using this name, it is probably not the
problem.
System.setSecurityManager( new RMISecurityManager() );
/** The properties that will be used to build m_ctx. */
Properties ContextProperties = new Properties();
/** The InitialContext which will be used when talking to the
JNDI server. */
ContextProperties.setProperty( "java.naming.factory.initial",
"allaire.ejipt.ContextFactory" );
ContextProperties.setProperty( "java.naming.provider.url",
"ejipt://127.0.0.1:2323" );
InitialContext ctx = new InitialContext( ContextProperties );
//Retrieve the remote interface
DSSUserHome home = (DSSUserHome)ctx.lookup( "DSSUserBean" );
DSSUser returnuser = null;
if( home != null )
{
returnuser = home.findByPrimaryKey( NetID );
}
-----Original Message-----
From: Nimmons, Buster [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 16, 2001 3:28 PM
To: JRun-Talk
Subject: lookup of Entity bean Home interface from session bean
I have an entity bean which I have successfully test from a servlet. Now I
have created a session bean to interact with the entity bean However when I
do the exact same JNDI lookup that I perform in the servlet I get a
nameNotFound exception. below is the code performing the lookup I have it
placed in the create() method of the session bean. Is this code correct and
where is the correct (most logical) place to do a home interface lookup.
this is on JRUN 3.1
try
{
InitialContext ic = new javax.naming.InitialContext();
IpimstablesHome home =
(IpimstablesHome)javax.rmi.PortableRemoteObject.narrow(ic.lookup("ipimstable
s"),IpimstablesHome.class);
}
catch (Exception ex)
{
System.out.println("(Try #2) Could not instantiate IpimstablesHome
object, The following exception was thrown - "+ex+" - "+ex.getMessage());
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists