0

i'm new in EJB3 technology and i have difficulties to call an Ejb Session from my Projetct1.EAR. My Ejb Session is defined in Projet2.EAR (EJB3 projet), and my IHM is in Project1.EAR (simple Java EE project), in the same server(WAS7).

1) Project2.EAR

package com.myejb;
@Local
public interface CustomerTask{
public Customer find(int number);
}

package com.myejb;
@Stateless
public class CustomerTaskImpl implements CustomerTask{
@PersistenceContext(name="my_persistenceunit")
EntityManager em;

public Customer find(int number){....}
}

2) Project1.EAR

public static void main(String[] args){

InitialContext ic = new InitialContext();

CustomerTask customerTask= (CustomerTask) ic.lookup("");
}

Anyone know the right way to call this EJB in my main function please? Thank you very much

ilias
  • 182
  • 1
  • 3
  • 13

2 Answers2

1

See the "Local client views" section of the EJB modules topic in the InfoCenter.

(Note that it's not possible to call a local EJB from another process, so you can't call a local EJB that resides in a server from a client main method.)

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
1

You need to mark your EJB interface as @Remote

mickfagan
  • 96
  • 3