Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling EJB from POJO class  RSS feed

 
raj joe
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to call a EJB from a POJO class , it is throwing the following error (below stack trace) I am using IBM RAD.

Exception in thread "P=37236 =0:CT" java.lang.NoClassDefFoundError: org/omg/CSI/EstablishContext
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:1747)
at java.lang.Class.getConstructor1(Class.java:2063)
at java.lang.Class.newInstance3(Class.java:331)
at java.lang.Class.newInstance(Class.java:305)
at com.ibm.rmi.pi.InterceptorManager.runPreInit(InterceptorManager.java:155)
at com.ibm.rmi.corba.ORB.initializeInterceptors(ORB.java:487)
at com.ibm.CORBA.iiop.ORB.initializeInterceptors(ORB.java:986)
at com.ibm.rmi.corba.ORB.orbParameters(ORB.java:1362)
at com.ibm.CORBA.iiop.ORB.orbParameters(ORB.java:1251)
at com.ibm.rmi.corba.ORB.set_parameters(ORB.java:1276)
at com.ibm.CORBA.iiop.ORB.set_parameters(ORB.java:1839)
at org.omg.CORBA.ORB.init(ORB.java:368)
at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:82)
at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:97)
at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:73)
at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:285)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:373)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:112)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:422)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:143)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
----------------------------------------------------------

note I have included the jars :

<classpathentry kind="lib" path="lib/iwsorb.jar"/>
<classpathentry kind="lib" path="lib/sas.jar"/>
<classpathentry kind="lib" path="lib/wssec.jar"/>
<classpathentry kind="lib" path="lib/bootstrap.jar"/>
<classpathentry kind="lib" path="lib/ebus405.jar"/>
<classpathentry kind="lib" path="lib/ecutils.jar"/>
<classpathentry kind="lib" path="lib/emf.jar"/>
<classpathentry kind="lib" path="lib/ibmorb.jar"/>
<classpathentry kind="lib" path="lib/ibmorbapi.jar"/>
<classpathentry kind="lib" path="lib/lmproxy.jar"/>
<classpathentry kind="lib" path="lib/naming.jar"/>
<classpathentry kind="lib" path="lib/namingclient.jar"/>
<classpathentry kind="lib" path="lib/ras.jar"/>
<classpathentry kind="lib" path="lib/wsexception.jar"/>
 
Kiran Kumar Chitturi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you place the code you have written for looking up the EJB
 
raj joe
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public MAPIService getBPMService()
{


BPMServiceHome BPMServiceHome = (BPMServiceHome) getBPMServiceHome();
BPMAPIService BPMService = null;


try
{
BPMService = BPMServiceHome.create();
}
catch (Exception e)
{
Logger.log(Logger.SEVERITY_ERROR, LoggerId.DEFAULT_ID,
"Util - getBPMService()");

e.printStackTrace();
}

Logger.log(Logger.SEVERITY_DETAIL, LoggerId.DEFAULT_ID,
"Util - getBPMService() - end");
return BPMService;
}

/**
* For getting service Home
*
* @return object
*/
private Object getBPMServiceHome()
{
Logger.log(Logger.SEVERITY_DETAIL, LoggerId.DEFAULT_ID,
"Util - getBPMServiceHome() - start");

String propertyFile = Constant.propertiesFile;

String factory = ReadConfiguration.getConfig(propertyFile, Constant.WF_FACTORY);
String url = ReadConfiguration.getConfig(propertyFile,Constant.WF_URL);
String credential = ReadConfiguration.getConfig(propertyFile,Constant.WF_CREDETIAL);
String principal = ReadConfiguration.getConfig(propertyFile,Constant.WF_PRINCIPAL);
String jndi = ReadConfiguration.getConfig(propertyFile,Constant.WF_JNDI);



Properties props = new Properties();

props.put("java.naming.factory.initial", factory);
props.put("java.naming.provider.url", url);
props.put("javax.naming.Context.SECURITY_CREDENTIALS", credential);
props.put("javax.naming.Context.SECURITY_PRINCIPAL", principal);

InitialContext initialContext;
Object obj = null;

try
{
initialContext = new InitialContext(props);
if (props != null)
{
obj = initialContext.lookup(jndi);
}
}
catch (NamingException e)
{
Logger.log(Logger.SEVERITY_ERROR, LoggerId.DEFAULT_ID,
"Util - getBPMServiceHome()");

e.printStackTrace();
}

Logger.log(Logger.SEVERITY_DETAIL, LoggerId.DEFAULT_ID,
"Util - getBPMServiceHome() - end");
return obj;

}


Config entries

WF_FACTORY=com.ibm.websphere.naming.WsnInitialContextFactory
WF_URL=corbaloc:iiop:ctsblrsun27:2815
WF_CREDETIAL=wps
WF_PRINCIPAL=wps
WF_JNDI=ejb/com/nyt/workflow/bpc/api/ejb/NYTBPMServiceHome
 
raj joe
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any help on this
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!