users@glassfish.java.net

Local access to an EJB

From: <forums_at_java.net>
Date: Mon, 31 Oct 2011 09:43:02 -0500 (CDT)

I have an EJB running in Glassfish 3.1.1 (build 12)

@Local
public interface MyService{ ....... }

@Startup
@Singleton
@EJB(name = "java:global/MyService", beanInterface = MyService.class,
beanName="MyService")
public class MyServiceImpl implements ScheduleService{ ....... }

It deploys well. My problem is when I try to use it. All the examples for
JNDI I've seen I can cast the object I get to the interface like:

MyService svc=(MyService)new
InitialContext().lookup("java:global/MyService");

This is giving me a ClassCastException. If I use reflection I can use the
object.

 

 


--
[Message sent by forum member 'fawzib']
View Post: http://forums.java.net/node/858733