tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Purcell <tpurc...@chariotsolutions.com>
Subject Re: InitialContext JNDI Lookup
Date Thu, 22 Feb 2007 20:46:30 GMT

Hello

Here is my current lookup code. (Notice I've tried the two suggested
formats):

        InitialContext ctx = null;
        try {
            Properties env = new Properties();
            env.put("java.naming.factory.initial",
"org.apache.openejb.client.RemoteInitialContextFactory");
            env.put("java.naming.factory.host", "127.0.0.1");
            env.put("java.naming.factory.port", "4201");
            env.put("java.naming.security.principal", "system");
            env.put("java.naming.security.credentials", "manager");
            ctx = new InitialContext(env);
            System.out.println("Got Context: " + ctx);
        }
        catch ( NamingException ne ) {
            ne.printStackTrace();
        }
        String lookupStr = "";
        ConferenceCallSchedulerRemote ccsRemote = null;
        try{
            lookupStr = "ConferenceCallSchedulerLocalLocal";
            ccsRemote =
(ConferenceCallSchedulerRemote)ctx.lookup(lookupStr);
            System.out.println("Worked: " + lookupStr);
        }
        catch ( NamingException ne ) {
            ne.printStackTrace();
        }

        try{
            lookupStr = "ConferenceCallSchedulerRemote";
            ccsRemote =
(ConferenceCallSchedulerRemote)ctx.lookup(lookupStr);
            System.out.println("Worked: " + lookupStr);
        }
        catch ( NamingException ne ) {
            ne.printStackTrace();
        }

And current results:
Got Context: javax.naming.InitialContext@157f0dc
javax.naming.NameNotFoundException: /ConferenceCallSchedulerLocalLocal does
not exist in the system.  Check that the app was successfully deployed.
    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:211)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at com.chariotsolutions.soalab.ccs.test.RMITest.main(RMITest.java:285)
javax.naming.NameNotFoundException: /ConferenceCallSchedulerRemote does not
exist in the system.  Check that the app was successfully deployed.
    at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:211)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at com.chariotsolutions.soalab.ccs.test.RMITest.main(RMITest.java:294)



Mohammad Nour El-Din wrote:
> 
> Hi Tom...
> 
> Would you please try ConferenceCallSchedulerRemote and
> ConferenceCallSchedulerLocalLocal. Notice the name by which you lookup the
> local business interface, it has an extra Local postfix. BTW can you send
> the properties you give to the initial context.
> 
> On 2/22/07, Tom Purcell <tpurcell@chariotsolutions.com> wrote:
> 
>>
>> Hello
>>
>> Thanks for the response. Here's my bean and the interfaces:
>>
>> @Stateless
>> public class ConferenceCallSchedulerBean implements
>> ConferenceCallSchedulerLocal, ConferenceCallSchedulerRemote{
>>    <methods>
>> {
>>
>> @Local
>> public interface ConferenceCallSchedulerLocal{
>>    <methods>
>> {
>>
>> @Remote
>> public interface ConferenceCallSchedulerRemote{
>>    <methods>
>> {
>>
>> Here are the look up strings I tried:
>>            lookupStr =
>>
>> "java:comp/env/com.chariotsolutions.soalab.ccs.ejb.ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr =
>> "java:comp/env/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:comp/env/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:comp/env/ConferenceCallScheduler";
>>            lookupStr =
>> "com.chariotsolutions.soalab.ccs.ejb.ConferenceCallScheduler
>> /ConferenceCallSchedulerRemote";
>>            lookupStr =
>> "ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "ConferenceCallSchedulerRemote";
>>            lookupStr = "ConferenceCallScheduler";
>>            lookupStr =
>>
>> "java:comp/com.chariotsolutions.soalab.ccs.ejb.ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr =
>> "java:comp/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:comp/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:comp/ConferenceCallScheduler";
>>            lookupStr =
>>
>> "java:/com.chariotsolutions.soalab.ccs.ejb.ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr =
>> "java:/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:/ConferenceCallScheduler";
>>
>> I also tried a bean definition that looked like this:
>>
>> @Stateless(name="ConferenceCallScheduler",
>> mappedName="ejb/ConferenceCallScheduler")
>> public class ConferenceCallSchedulerBean implements
>> ConferenceCallSchedulerLocal, ConferenceCallSchedulerRemote{
>>    <methods>
>> {
>>
>> With these lookups:
>>            lookupStr =
>> "java:comp/env/ejb/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:comp/env/ejb/ConferenceCallScheduler";
>>            lookupStr =
>> "java:comp/ejb/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:comp/ejb/ConferenceCallScheduler";
>>            lookupStr =
>> "java:/ejb/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "java:/ejb/ConferenceCallScheduler";
>>            lookupStr =
>> "ejb/ConferenceCallScheduler/ConferenceCallSchedulerRemote";
>>            lookupStr = "ejb/ConferenceCallScheduler";
>>
>> Thanks
>> Tom
>>
>>
>>
>> Mohammad Nour El-Din wrote:
>> >
>> > Hi Tom...
>> >
>> > What combinations you have used ? does this EJB supports EJB2.1 home
>> and
>> > object interfaces or EJB3.0 business interface(s) ?
>> >
>> >
>> >
>> > On 2/22/07, Tom Purcell <tpurcell@chariotsolutions.com> wrote:
>> >
>> >>
>> >> Hello
>> >>
>> >> I have created an EJB3 stateless session bean using annotations (no
>> >> deployment descriptors) and packed it into a jar and packed the jar
>> into
>> >> an
>> >> ear (there is no web app yet and, therefore, no war). The ear
>> >> successfully
>> >> deploys to a Geronimo/Tomcat 2.0-M2 server.
>> >>
>> >> The problem I'm having is in the lookup from my client. I'm new to
>> >> OpenEJB
>> >> and Geronimo but not to EJB. I'm setting properties, giving them to
>> the
>> >> InitialContext and doing a lookup. But a lookup on what? What is the
>> >> format
>> >> for the JNDI name I wnat to find? I've tried a number of combinations
>> >> with
>> >> no luck.
>> >>
>> >> Thanks
>> >> Tom
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/InitialContext-JNDI-Lookup-tf3273209s2756.html#a9101357
>> >> Sent from the OpenEJB User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > Thanks
>> > - Mohammad Nour
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/InitialContext-JNDI-Lookup-tf3273209s2756.html#a9101836
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Thanks
> - Mohammad Nour
> 
> 

-- 
View this message in context: http://www.nabble.com/InitialContext-JNDI-Lookup-tf3273209s2756.html#a9108007
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message