users@glassfish.java.net

Problem connecting to Session EJB from application client

From: <glassfish_at_javadesktop.org>
Date: Thu, 16 Aug 2007 17:01:45 PDT

Hi All,

I am having problem connecting to Session EJB from my application client. The client works fine if it is run with NetBeans IDE. When it's run with appclient, it gives me the error:

javax.naming.NamingException: ejb ref resolution error for remote business inter
facedcm.MessagingRemote [Root exception is java.lang.ClassNotFoundException: dcm.MessagingRemote]
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:350)
        at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(
RemoteBusinessObjectFactory.java:61)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3
04)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314
)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at messagingclient.MsgClient.startMessaging(MsgClient.java:70)
        at messagingclient.MsgClient.main(MsgClient.java:50)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:23
2)
        at com.sun.enterprise.appclient.MainWithModuleSupport.<init>(MainWithMod
uleSupport.java:329)
        at com.sun.enterprise.appclient.Main.main(Main.java:180)
Caused by: java.lang.ClassNotFoundException: dcm.MessagingRemote
        at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader
.java:724)
        at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.jav
a:614)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:568)
        at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:320)
        ... 13 more

It seems like the interface is not found. I have tried using two InitialContext lookup approached with no success.

1. InitialContext ctx = new InitialContext();
            MessagingRemote messagingRem = (MessagingRemote)ctx.lookup("MessagingBean#dcm.MessagingRemote");

2. Properties props = new Properties();

            props.setProperty("java.naming.factory.initial",
                             "com.sun.enterprise.naming.SerialInitContextFactory");
            props.setProperty("java.naming.factory.url.pkgs",
                             "com.sun.enterprise.naming");
            props.setProperty("java.naming.factory.state",
                             "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
            props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
            props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
            
            InitialContext ctx = new InitialContext(props);
            MessagingRemote messagingRem = (MessagingRemote)ctx.lookup("MessagingBean#dcm.MessagingRemote");

Does anyone have any idea what has gone wrong here? I am using Sun Application Server PE 9.0 with Java EE 5.

Thanks. Your help is really appreciated.
Noble
[Message sent by forum member 'lesmantec' (lesmantec)]

http://forums.java.net/jive/thread.jspa?messageID=231248