Leonard Solomyak

Greenhorn
+ Follow
since Feb 12, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Leonard Solomyak

Hi,
Can somebody tell HOW to use LOCAL INTERFACES with JNDI for WebShre 5 and specifically WSAD 5??
It is very urgent !
Thank you
Leonard
20 years ago
HI,
I was trying to use Local interfaces with WebSphere 5, specifically with WADS where
I do all development.
To generate entity beans I use bottom-up approach. WASD generated Local interfaces
by default, with the associated JNDI names.
I can use Universal Client to access beans' methods via the Local interfaces but the
problem occures when I put the LOOKUP implementation code into the bean.
In my case a session bean creates an entity bean inside one container. Apparently
JNDI refused to work: NamingException was thrown, saying that the specified in the lookup
JNDI name not found.
I tryed different values for the JNDI name, which I can see in the descriptors but all unsuccessfully.
The JNDI name got resolved only when I added remote interfaces to the entity bean. WSAD by default
readdressed JNDI name in from local to the remote home interface.
I am asking
1. How can I use local interfaces via JNDI service in WSAD and WAS 5 ?
2. How can I use JNDI service for remote and local interfaces for the same bean ?
Regards
Leonard
20 years ago
Hi,
I am having serious problem with resolving JNDI lookups on the ejbs in the WSAD 5. Iintitialize the JNDI factory as follows
env.put Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:2809");
Than I try to implement the lookup
context = new InitialContext(env);
Object service = context.lookup(jndiName);
The WSAD responding with the following diagnostic
---------------------------------------------------------
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R javax.naming.NameNotFoundException: ejb/UsersLocalHome
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1503)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1457)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1167)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:132)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at javax.naming.InitialContext.lookup(InitialContext.java:359)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at za.co.fnb.util.facade.ServiceLocator.getService(ServiceLocator.java:45)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at za.co.fnb.util.facade.ServiceLocator.locateService(ServiceLocator.java:56)
[03/08/20 11:05:56:192 GMT+02:00] 6b8684b7 SystemErr R at za.co.fnb.custodyonline.model.control.ejb.UserSessionBean.testEntity(UserSessionBean.java:75)
[03/08/20 11:05:56:202 GMT+02:00] 6b8684b7 SystemErr R at za.co.fnb.custodyonline.model.control.ejb.EJSLocalStatefulUserSession_b39352f4.testEntity(EJSLocalStatefulUserSession_b39352f4.java:41)
[03/08/20 11:05:56:202 GMT+02:00] 6b8684b7 SystemErr R at java.lang.reflect.Method.invoke(Native Method)
---------------------------------------------------------

The server is definitely listening on the port as was tested before.
The JNDI name is correct according to the deployment descriptor and Universal Client, which I can use to access the ejb interfaces.
What is the problem ??
Regards
Leonard
20 years ago
try WEB-INF/lib,
do not forget specify taglib location in JSP
Good luck
21 years ago
Hi,
This is the most difficult puzzle of WAS I spent many hours to resolve and unsuccessfully...
The application designed to start the stateless session bean called MsgListenerBootBean from the servlet, and the following JNDI error occurs:
javax.naming.NameNotFoundException: ejb/strate/safeDP1/MsgListenerBootBean
When restarting the server, it may not give an error, but if I keep restarting the application concenquentually, the JNDI error will occur again, not necessary with this bean, but another one, which should be instantiated within the mentioned above MsgListenerBootBean bean, as follows
javax.naming.NameNotFoundException: ejb/strate/safeDP1/MsgInFacadeBean
OR with the more trace information
javax.naming.NameNotFoundException: ejb/strate/safeDP1/MsgInFacadeBean
at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1435)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1115)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at za.co.strate.safe.beans.common.ServiceLocator.internalCachingLookupObject(ServiceLocator.java:122)
at za.co.strate.safe.beans.common.ServiceLocator.lookUpHome(ServiceLocator.java:255)
at za.co.strate.safe.beans.messaging.ejb.MsgListenerBootBean.init(MsgListenerBootBean.java:236)
at za.co.strate.safe.beans.messaging.ejb.MsgListenerBootBean.ejbCreate(MsgListenerBootBean.java:217)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.container.StatelessBeanO.<init>(StatelessBeanO.java:96)
at com.ibm.ejs.container.CMStatelessBeanO.<init>(CMStatelessBeanO.java:29)
at com.ibm.ejs.container.CMStatelessBeanOFactory.create(CMStatelessBeanOFactory.java:17)
at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:941)
at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:990)
at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:66)
at com.ibm.ejs.container.activator.Activator.activateBean(Activator.java:171)
at com.ibm.ejs.container.EJSContainer.preInvoke(EJSContainer.java:2152)
at za.co.strate.safe.beans.messaging.interfaces.EJSRemoteStatelessMsgListenerBootBean.startBoot(EJSRemoteStatelessMsgListenerBootBean.java:24)
at za.co.strate.safe.beans.messaging.interfaces._MsgListenerBootBean_Stub.startBoot(_MsgListenerBootBean_Stub.java:256)
at za.co.strate.safe.beans.messaging.servlet.MsgServlet.init(MsgServlet.java:65)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doInit(ServletManager.java:802)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._init(StrictLifecycleServlet.java:137)
at com.ibm.servlet.engine.webapp.PreInitializedServletState.init(StrictLifecycleServlet.java:243)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.init(StrictLifecycleServlet.java:103)
at com.ibm.servlet.engine.webapp.ServletInstance.init(ServletManager.java:388)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.servlet.engine.webapp.ServletManager.addServlet(ServletManager.java:84)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:226)
at com.ibm.servlet.engine.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:357)
at com.ibm.servlet.engine.webapp.WebApp.loadServletManager(WebApp.java:1001)
at com.ibm.servlet.engine.webapp.WebApp.init(WebApp.java:133)
at com.ibm.servlet.engine.srt.WebGroup.loadWebApp(WebGroup.java:234)
at com.ibm.servlet.engine.srt.WebGroup.init(WebGroup.java:139)
at com.ibm.servlet.engine.ServletEngine.addWebApplication(ServletEngine.java:633)
at com.ibm.ws.runtime.WebContainer.install(WebContainer.java:36)
at com.ibm.ws.runtime.Server.startModule(Server.java:615)
at com.ibm.ejs.sm.active.ActiveModule.startModule(ActiveModule.java:509)
at com.ibm.ejs.sm.active.ActiveModule.startAction(ActiveModule.java:355)
at com.ibm.ejs.sm.active.ActiveObject.startObject(ActiveObject.java:709)
at com.ibm.ejs.sm.active.ActiveObject.start(ActiveObject.java:131)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:93)
at com.ibm.ejs.sm.active.ActiveObject.invokeContainedObject(ActiveObject.java:512)
at com.ibm.ejs.sm.agent.AdminAgentImpl.activeObjectInvocation(AdminAgentImpl.java:110)
at com.ibm.ejs.sm.agent.AdminAgentImpl.invokeActiveObject(AdminAgentImpl.java:62)
at com.ibm.ejs.sm.agent._AdminAgentImpl_Tie._invoke(_AdminAgentImpl_Tie.java:80)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2294)
at com.ibm.CORBA.iiop.OrbWorker.run(OrbWorker.java:185)
at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run(ThreadPool.java:95)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
It is very difficult to establish regularity of this error, but obviously restarting the server helps to start clean...
here are the codes from the servlet and session bean
SERVLET
....................
public void init() throws ServletException {
super.init();
log.debug("Im starting");
boolean listenersStarted = false;
boolean sendersStarted = false;
ServiceLocator sv = null;
ServletContext servletCtx = this.getServletContext();
try{
sv = ServiceLocator.getInstance();
String jndi = (String) servletCtx.getInitParameter("msgListenerBootBean_JNDI");
MsgListenerBootBeanHome bootBeanHome = (MsgListenerBootBeanHome) sv.lookUpHome(MsgListenerBootBeanHome.class, jndi);
bootBean = bootBeanHome.create();
listenersStarted = bootBean.startBoot();
}catch (Exception e){
log.error(e.getMessage(),e);
}

if (!listenersStarted) {
log.fatal("MsgListenerBootBean not started");
throw new ServletException("Msg List BOOT FAIL");
}
............
SESSION BEAN
..............
private void init() {
log.debug("init - start");
try {
ServiceLocator sv = ServiceLocator.getInstance();
String env = sv.lookupStringEnvironmentEntry("java:comp/env/enviroment");
Integer beanCount = sv.lookupIntegerEnvironmentEntry("java:comp/env/number_Of_Listener");
String msgInHomeJNDI = sv.lookupStringEnvironmentEntry("java:comp/env/msgInFacade_JNDI");
String logHomeJNDI = sv.lookupStringEnvironmentEntry("java:comp/env/logFacade_JNDI");
String qcfJNDI = sv.lookupStringEnvironmentEntry("java:comp/env/QConnectionFactory_JNDI");
log.debug("qcfJNDI-"+qcfJNDI);

MsgInFacadeBeanHome msgInHome = (MsgInFacadeBeanHome) sv.lookUpHome(MsgInFacadeBeanHome.class,msgInHomeJNDI);
SafeLogFacadeBeanHome logHome = (SafeLogFacadeBeanHome) sv.lookUpHome(SafeLogFacadeBeanHome.class,logHomeJNDI);
..................
I really do not know how to resolve this...
Leonard
21 years ago
WAS provides GUI to configure datasource, which is linked to the dependant ejbs via the Depoyment Descriptior.
If you wnat just to use plain SQL managed directly by your application, get the java.sql.Connection having database name and credentials.
Regards
Leonard
21 years ago
Hello,
Would it be possible to advize better way to populate queue defined in MQ (installed on Windows) with many records from the batch ?
Regards
Leonard
21 years ago