I use a method like the one shown below to call an ejb from the same
application,
where the call looks like

    MyEJBHome home = (MyEJBHome ) getJNDIObject("ejb/MyEJB ",
MemberPartHome.class);

    private Object getJNDIObject(String location, Class narrowClass) throws
NamingException
    {
        Context context;
        Object obj;
        try
        {
            context = new InitialContext();
            System.out.println("Context Made");
            
            obj = context.lookup( location );
            System.out.println("Object retrieved > " + obj);
        }
        catch(NamingException ne)
        {
            System.err.println("Unable to find named object: " + location );
            ne.printStackTrace();
            throw new NamingException( ne.getMessage() );
        }

        Object home = PortableRemoteObject.narrow(obj, narrowClass);
       
        return home;
    }

If you modify to context definition 

to      context = new InitialContext( env );

and env is ( input your data )
        
        Properties env = new Properties();

        env.put( Context.INITIAL_CONTEXT_FACTORY, javaNamingFactoryInitial
);
        env.put( Context.PROVIDER_URL, javaNamingProviderUrl );
        env.put( Context.SECURITY_PRINCIPAL, javaNamingSecurityPrincipal );
        env.put( Context.SECURITY_CREDENTIALS, javaNamingSecurityCredentials
);

You should be able to define a different application on the same, or some
other machine.




-----Original Message-----
From: Pavan Dinavahi [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 10, 2001 1:39 PM
To: Orion-Interest
Subject: Cross Linking ejb's from different Applications?


My ejb needs a ref for another ejb which is in a different application in
the same server.
I am having Lookup problems.
My ejb-jar.xml specifies the <ejb-ref>
My problem is i wanna know what i should specify in the orion-ejb-jar.xml
for
location for ejb-ref tag:<ejb-ref-mapping location="???" name="name as in
ejb ref in ejb-jar.xml" />

DO i need anything special in the orion-application.xml for namespaces ??.

I really appreciate anyone who can give me a step by step procedure for
enabling cross linking ejb's from different applications.

Thanks,
Pavan


Reply via email to