Skip to Content
Former Member
May 07, 2008 at 01:22 PM

Help needed in EJB - to call AS from EJB a Session Bean


Hi All ,

I have been strictly told not to use Web Services as all the applications are on the same server

actually I have to make an EJB invocation to an Application Service from the CAF layer from a Session Bean of another EJB Project(Not a CAF Service).

the CAF layer has 5 parts metadata , permissions , dictionary , ear and ejbmodule.

I added the ejbModule to the Build Path of the calling EJB Session Bean. And so I was able to access the operations of the Application Service which in turn accesses a BAPI(The Appl Service operation returns a String).

But while executing I got the exception java.lang.RuntimeException: java.lang.NoClassDefFoundError

My method :

Normally from a Dynamic Web Project acting as a client to an EJB Session bean, I was able to get access to EJB Local Interface by using

  private ConverterLocal converterBean = null;
  public void jspInit() {
    try {
     InitialContext ic = new InitialContext();
     converterBean = (ConverterLocal)
    } catch (Exception ex) {
   	 System.out.println("Couldn't create converter bean."+
BigDecimal dollarAmount =  converterBean.euroToDollar(value);

So I created a JNDI field in ejb-j2ee-engine.xml


And from my Session Bean , I tried to access it using the code in already existing Bean which was working fine

		try {
			InitialContext ctx = new InitialContext();
			bean = (BAPI_COMPANY_GETLISTBeanImpl)ctx.lookup("COMPANY");
		} catch (NamingException e) {
			System.out.println("Converter Bean can't be created");
			String send = bean.returnDetails();

And I tried to print the String , but I got the above error

I have a doubt :

1) How do I specify the JNDI name ie in the ejb-j2ee-engine.xml file , what should I add as the name of the ejb

is this sufficient , or are there more steps ??