cancel
Showing results for 
Search instead for 
Did you mean: 

Call EJB from a XI Javamapping

Former Member
0 Kudos

I have developed a simple EAR which contains a CMP with local and remote interfaces. This cmp may be successfully called using the remote-interface from a client (j2se) project. Now i like to call the same CMP from within a XI JavaMapping. In the execute method i am using the following code:

		InitialContext ctx;
		MeraConfigurationLocal configLocal = null;
		try {			
			ctx = new InitialContext();
			Object obj = ctx.lookup("localejbs/mgb.ch/XIMera_EAR/MeraConfigurationBean");
			if (trace != null) 
				trace.addInfo("Got object from jndi: "+obj);
			MeraConfigurationLocalHome configHome =	(MeraConfigurationLocalHome)obj;
			if (configHome !=null) {
				if (trace != null) 
					trace.addInfo("ConfigurationLocalHome: "+configHome);									
			}
			configLocal = configHome.create();
		} catch (Exception e) {
			throw new StreamTransformationException(e.getMessage(), e);
		}		
		int port = Integer.parseInt(
				configLocal.ReadParam(MeraResourcePoolDispatcherService.CFG_GENERAL_LISTENER_PORT));
		if (trace != null) 
			trace.addInfo("Got listenerport from localejbs/mgb.ch/XIMera_EAR/MeraConfigBean: "+port);

after calling ctx.lookup ... i got the following traceentry in xi:

  <Trace level="1" type="T">*** START APPLICATION TRACE ***</Trace> 
  <Trace level="2" type="T">Got object from jndi: ch.migros.mdds.xi.mera.ejb.MeraConfigurationLocalHomeImpl0@6adcb430</Trace> 
  <Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace> 

when i try to cast this obj into a MeraConfigurationLocal the system is throwing a ClassCastException

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello.

Check my wiki article:

http://wiki.sdn.sap.com/wiki/display/stage/SapNetweaverProcessIntegration.CallEjb3.0methodfromJavaclassmappingPI7.1

(SapNetweaver Process Integration. Call Ejb 3.0 method from Java class mapping PI 7.1)