cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

safter_maskan
Explorer
0 Kudos

Hi Shiv Khullar ;

I think you can call your metod with creating webservice from ejb, i didn't try but i think it is possible, you can try this.

best regards.

Former Member
0 Kudos

Hi,

I am not sure if my posting was in readable format.

As soon as try to add the code, all the formatting is lost.

I would explain once again - My code is generated by the webservice "Generate Client code" i.e using WSDL into an EJB 3.0 Project. Now I am trying to call a method of the bean which takes a class object (OrderSearch) as the parameter.

When I am trying to instantiate this OrderSearch class in my another EJB3.0 project its failing.

Safter- Thanks for your reply but can someone help me who has worked on a similar issue.

Thanks,

Shiv

Former Member
0 Kudos

Dependencies at compile time are not valid at runtime.

You should add a reference to the EAR application containing OrderSearch in the application-j2ee-engine.xml of your ear project.

To do that, check that both projects are open in NWDS, open the application-j2ee-engine.xml file, click in Add Reference and select "Select Application" in the popup.

I Hope it works for you.

Esteve