users@glassfish.java.net

Access EJB within a servlet

From: <glassfish_at_javadesktop.org>
Date: Sun, 09 Nov 2008 13:07:49 PST

Hi dear developers :)

I deployed my ejb called SessionManager through glassfish. If I try to access it using a Java application client it works perfectly, but if I try using a Servlet (deployed into the same glassfish instance) I get: ejb ref resolution error for remote business interfacehelb.test.ejb.SessionManager [Root exception is java.lang.ClassNotFoundException: helb.test.ejb.SessionManager]
I believe this issue is related to glassfish as my source code works in Java app mode.
Anyway here's what I do:

[code]
        InitialContext ictx;
        SessionManager ism;
                try {
                        ictx = new InitialContext();
                        ism = (SessionManager) ictx.lookup("ejb/SessionManagerJNDI");
                
                } catch (NamingException e) {

                        e.printStackTrace();
                }
[/code]
Thanks ;)
[Message sent by forum member 'goundy' (goundy)]

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