Skip to Content
0
Former Member
Aug 19, 2010 at 07:50 PM

How to call method of one EJB3.0 project in another EJB3.0 project

114 Views

Hi,

I would be thankful if someone could help me in this -

I am using SAP Netweaver 7.2 and have two EJB3.0 projects.

Now I am trying to instantiate a class of one EJB project into another and when I get a run time exception as -

javax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError

I have tried to add it under the Java Build Path -> Projects but it only helps during compile time.

I have also tried checking the projects under "Project References" but it still gives the same problem

Here is the code and where exactly its failing -

import java.util.ArrayList;
import java.util.logging.Logger;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.csagroup.wsecomm.OrderSearch;
import org.csagroup.wsecomm.SalesOrderSearchQueryInImplBean;

import VendaOrders.ServiceClientImpl;

import com.sap.scheduler.runtime.JobContext;
import com.sap.scheduler.runtime.JobParameter;
import com.sap.scheduler.runtime.mdb.MDBJobImplementation;
import com.sap.xi.appl.se.global.SalesOrderID;
/**
 * Message-Driven Bean implementation class for: HelloWorldBean
 *
 */
@MessageDriven(
		activationConfig = { 
				
				@ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "JobDefinition='HelloWorldJob'"),
				@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
public class HelloWorldBean extends MDBJobImplementation {	
	

	/**
     * @see MessageListener#onMessage(Message)
     */
	
	public void onJob(JobContext ctx) {
    	Logger logger = ctx.getLogger();
    	    	
    	logger.info("Hello World Testing onJob().....");
    	
    	try
    	{
    		logger.info("Before Order Search...");
    		OrderSearch os = new OrderSearch();   *// this is where it fails*
    		logger.info("Before os...");
    		SalesOrderID salesOrderIdBeginRange = new SalesOrderID();
    		logger.info("Before salesOrderIdBeginRange...");
    		salesOrderIdBeginRange.setValue("1");
    		logger.info("After setValue(1)");
    		
    		SalesOrderID salesOrderIdEndRange = new SalesOrderID();
    		logger.info("Before salesOrderIdEndRange");
        	salesOrderIdEndRange.setValue("99999");
        	
        	logger.info("After 99999");
        	
        	os.setBeginRange(salesOrderIdBeginRange);
        	os.setEndRange(salesOrderIdEndRange); 
        	
        	SalesOrderSearchQueryInImplBean salesOrderSearchQueryInImplBean = new SalesOrderSearchQueryInImplBean();
    		
        	logger.info("After salesOrderSearchQueryInImplBean");
		
    	} catch (Exception e){logger.info("Exception is...." + e.getLocalizedMessage());}
        // TODO Auto-generated method stub
        
    }

}

I am able to see the message in my logs till "Before Order Search.." and fails when I try to instantiate OrderSearch class which is in another EJB 3.0 project.

Thanks for the help in advance.

Edited by: Shiv Khullar on Aug 19, 2010 10:30 PM