Remote interface lookup-problem in Glassfish3

Posted by andersmo on Stack Overflow See other posts from Stack Overflow or by andersmo
Published on 2010-05-21T07:21:39Z Indexed on 2010/05/21 7:30 UTC
Read the original article Hit count: 209

Filed under:
|
|
|

I have deployed a war-file, with actionclasses and a facade, and a jar-file with ejb-components (a stateless bean, a couple of entities and a persistence.xml) on glassfish3. My problem is that i cant find my remote interface to the stateless bean from my facade.

My bean and interface looks like:

@Remote
public interface RecordService {...


@Stateless(name="RecordServiceBean", mappedName="ejb/RecordServiceJNDI")
public class RecordServiceImpl implements RecordService {

 @PersistenceContext(unitName="record_persistence_ctx")
 private EntityManager em;...

and if i look in the server.log the portable jndi looks like:

Portable JNDI names for EJB RecordServiceBean : [java:global/recordEjb/RecordServiceBean, java:global/recordEjb/RecordServiceBean!domain.service.RecordService]|#]

and my facade:

...InitialContext ctx= new InitialContext();
    try{
       recordService = (RecordService) ctx.lookup("java:global/recordEjb/RecordServiceBean!domain.service.RecordService");
      }
      catch(Throwable t){
       System.out.println("ooops");
       try{
        recordService = (RecordService)ctx.lookup("java:global/recordEjb/RecordServiceImpl");
       }
       catch(Throwable t2){
        System.out.println("noooo!");
       }...



  }

and when the facade makes the first call this exception occur:

javax.naming.NamingException: Lookup failed for 'java:global/recordEjb/RecordServiceBean!domain.service.RecordService' in SerialContext  [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacedomain.service.RecordService [Root exception is java.lang.ClassNotFoundException: domain.service.RecordService]]

and the second call:

javax.naming.NamingException: Lookup failed for 'java:global/recordEjb/RecordServiceBean' in SerialContext  [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacedomain.service.RecordService [Root exception is java.lang.ClassNotFoundException: domain.service.RecordService]]

I have also tested to inject the bean with the @EJB-annotation:

@EJB(name="RecordServiceBean")
 private RecordService recordService;

But that doesnt work either. What have i missed? I tried with an ejb-jar.xml but that shouldnt be nessesary. Is there anyone who can tell me how to fix this problem?

© Stack Overflow or respective owner

Related posts about glassfishv3

Related posts about ejb3