File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes initial context problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "initial context problem" Watch "initial context problem" New topic
Author

initial context problem

Maximilian Trenks
Ranch Hand

Joined: Jul 22, 2002
Posts: 104
ok guys, this one is really strange to me.
some days ago i wrote a helloworld application with an application client, which runs perfectly.
i tried to write a bmp entity bean, in which the datasource shall be located via the initialcontext. the whole procedure is similar to the way my helloworld client looks up the hellworld bean in my helloworld application. as i found out that my source files are gone, i decompiled my class file to be sure to pass the necessary properties.
my bean doesn't find the data source, even with the properties i used in the helloworld client. then i tried to look up the datasource and later the home interface of my helloworld bean and guess what, nothing worked.
so here is the error and the code:
C:\stage\bmp\ibm>java Test
javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context using the provider
url: "iiop://localhost:2809". Make sure that the host and port information is correct and that the server identified by the provider url is
a running name server. If no port number is specified, the default port number 2809 is used. Other possible causes include the network envi
ronment or workstation network configuration. Root exception is org.omg.CORBA.TRANSIENT: Connection refused: connect:host=maxwell,port=2809
minor code: 4942F301 completed: No
at com.ibm.CORBA.transport.TransportConnectionBase.connect(TransportConnectionBase.java:353)
at com.ibm.rmi.transport.TCPTransport.getConnection(TCPTransport.java:178)
at com.ibm.rmi.iiop.TransportManager.get(TransportManager.java:84)
at com.ibm.rmi.iiop.GIOPImpl.locate(GIOPImpl.java:177)
at com.ibm.rmi.corba.Corbaloc.locateUsingINS(Corbaloc.java:301)
at com.ibm.rmi.corba.Corbaloc.resolve(Corbaloc.java:363)
at com.ibm.rmi.corba.ORB.string_to_object(ORB.java:2596)
at com.ibm.ws.naming.util.WsnInitCtxFactory.stringToObject(WsnInitCtxFactory.java:1232)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1083)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:676)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:604)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:478)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at Test.setConnection(Test.java:26)
at Test.main(Test.java:36)

************************************CODE:
import java.rmi.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.InitialContext;
import javax.naming.*;
import java.util.*;

public class Test {
private InitialContext context;
private Connection myCon = null;
public void setConnection() {
try {
Properties properties = new Properties();
properties.put("java.naming.provider.url", "iiop://localhost:2809");
properties.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
context = new InitialContext(properties);
/*javax.sql.DataSource ds = (javax.sql.DataSource)
context.lookup("PersonSource");
myCon = ds.getConnection();*/
Object object2 = context.lookup("HelloWorldHome");
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
Test t = new Test();
t.setConnection();
}
}
************************************************
Is there a possibility in Websphere to see the JNDI tree ? Where can the JNDI Server be configured or where can I found out what my properties are like ?
Many thanx for your answers,
Max


Student of Business Informatics<br />Kepler University Linz, Austria
Maximilian Trenks
Ranch Hand

Joined: Jul 22, 2002
Posts: 104
this one is my bad. port was wrong, the right one was 900. but now i got a new error. anybody knows where the implfactory.properties is hidden ?
Unable to read required resource: implfactory.properties
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java(Inlined Compiled Code))
at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))
at java.io.InputStreamReader.<init>(InputStreamReader.java(Inlined Compiled Code))
at java.util.Properties.load(Properties.java(Compiled Code))
at com.ibm.ws.util.ImplFactory$1.run(ImplFactory.java:38)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ws.util.ImplFactory.<clinit>(ImplFactory.java:33)
at com.ibm.ejs.jts.jts.CurrentFactory.<clinit>(CurrentFactory.java:56)
at com.ibm.ejs.jts.jts.ClientInterceptor.initializeControlSet(ClientInterceptor.java:544)
at com.ibm.ejs.jts.jts.ClientInterceptor.send_request(ClientInterceptor.java:239)
at com.ibm.rmi.pi.InterceptorManager.iterateSendRequest(InterceptorManager.java:385)
at com.ibm.rmi.iiop.ClientRequestImpl.<init>(ClientRequestImpl.java:122)
at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:142)
at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:101)
at com.ibm.CORBA.iiop.ClientDelegate._createRequest(ClientDelegate.java:2411)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1276)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1175)
at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1928)
at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:245)
at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:37)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1090)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:676)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:604)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:478)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at Test.setConnection(Test.java:26)
at Test.main(Test.java:36)
javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context using the provider
url: "iiop://localhost:900". Make sure that the host and port information is correct and that the server identified by the provider url is a
running name server. If no port number is specified, the default port number 2809 is used. Other possible causes include the network envir
onment or workstation network configuration. Root exception is org.omg.CORBA.UNKNOWN: minor code: 0 completed: Maybe
at com.ibm.CORBA.iiop.ClientDelegate.intercept(ClientDelegate.java:966)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:528)
at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:713)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:258)
at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:38)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1090)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:676)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:604)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:478)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at Test.setConnection(Test.java:26)
at Test.main(Test.java:36)
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
OK Maximilian.
You should not use "java" to start an application client in WebSphere. You have to use the launchClient batch file (read in the InfoCenter on the J2EE client container). This is the only way to avoid the GIOP problem -- this is caused by using the wrong JDK (My guess is you have Sun's JDK installed on your machine and your "java" command is using it).
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Maximilian Trenks
Ranch Hand

Joined: Jul 22, 2002
Posts: 104
hi kyle,
thanx for your reply.
let suppose i would like to install application clients on some customers' PCs. they dont have a launchclient tool available, how do i start the application clients then ? is there a biiiiiig jar file that contains all websphere classes i need to be able to run an app client on these machines ?
can you please also take a look at my cmp problem. this one is really urgent for me and nobody answerd :-(
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Well, the answer is that you install the J2EE application client on all your client PC's. That's the way that it works.
Kyle
Jay Saraiya
Greenhorn

Joined: Aug 25, 2004
Posts: 1
I am trying to call an EJB running on a WAS5.1 server from WAS5.0 server. Do you see any compatibility issue there ? If there is,how do we overcome that ?
Here is the exception that I am getting.

javax.naming.ServiceUnavailableException: A communication failure occurred while attempting to obtain an initial context with the provider URL: "iiop://uszhoit42907:2809". Make sure that any bootstrap address information in the URL is correct and that the target name server is running. A bootstrap address with no port specification defaults to port 2809. Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration. Root exception is
java.lang.NullPointerException
at com.ibm.debug.DebugPortableInterceptor.send_request(Unknown Source)
at com.ibm.rmi.pi.InterceptorManager.iterateSendRequest(InterceptorManager.java:385)
at com.ibm.rmi.iiop.ClientRequestImpl.<init>(ClientRequestImpl.java:122)
at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:142)
at com.ibm.rmi.iiop.GIOPImpl.createRequest(GIOPImpl.java:101)
at com.ibm.CORBA.iiop.ClientDelegate._createRequest(ClientDelegate.java:2411)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1276)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1175)
at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1928)
at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:245)
at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(Unknown Source)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1112)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:677)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:605)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:480)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:408)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:131)
at javax.naming.InitialContext.lookup(InitialContext.java:359)
at com.zurich.nc.common.ejb.EJBUtil.getHome(EJBUtil.java:109)
at com.zurich.nc.common.ejb.EJBUtil.getHome(EJBUtil.java:54)
at com.zurich.nc.org.server.OrgServerFactory.getOfficeService(OrgServerFactory.java:168)
at com.zurich.rp.specialhandling.dao.DesignatedClaimTeamDAO.getOfficeInterface(DesignatedClaimTeamDAO.java:393)
at com.zurich.rp.specialhandling.dao.DesignatedClaimTeamDAO.getListPairs(DesignatedClaimTeamDAO.java:582)
at com.zurich.rp.ui.dropdown.DropDownLoader.getServiceList(DropDownLoader.java:255)
at com.zurich.rp.ui.dropdown.DropDownLoader.getDropDown(DropDownLoader.java:59)
at com.zurich.rp.ui.util.DropDownLoaderPlugin.init(DropDownLoaderPlugin.java:65)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doInit(StrictServletInstance.java:82)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._init(StrictLifecycleServlet.java:147)
at com.ibm.ws.webcontainer.servlet.PreInitializedServletState.init(StrictLifecycleServlet.java:270)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.init(StrictLifecycleServlet.java:113)
at com.ibm.ws.webcontainer.servlet.ServletInstance.init(ServletInstance.java:189)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.addServlet(WebAppServletManager.java:870)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:224)
at com.ibm.ws.webcontainer.webapp.WebAppServletManager.loadAutoLoadServlets(WebAppServletManager.java:542)
at com.ibm.ws.webcontainer.webapp.WebApp.loadServletManager(WebApp.java:1270)
at com.ibm.ws.webcontainer.webapp.WebApp.init(WebApp.java:277)
at com.ibm.ws.webcontainer.srt.WebGroup.loadWebApp(WebGroup.java:396)
at com.ibm.ws.webcontainer.srt.WebGroup.init(WebGroup.java:216)
at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java:984)
at com.ibm.ws.runtime.component.WebContainerImpl.install(WebContainerImpl.java:136)
at com.ibm.ws.runtime.component.WebContainerImpl.start(WebContainerImpl.java:356)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:415)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:787)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:351)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:575)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:268)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:485)
at java.lang.reflect.Method.invoke(Native Method)
at com.tivoli.jmx.modelmbean.MMBInvoker.invoke(MMBInvoker.java:46)
at com.tivoli.jmx.modelmbean.MMBInvoker.invokeOperation(MMBInvoker.java:115)
at com.tivoli.jmx.modelmbean.DynamicModelMBeanSupport.invoke(DynamicModelMBeanSupport.java:409)
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:323)
at com.tivoli.jmx.GenericMBeanSupport.invoke(GenericMBeanSupport.java:178)
at com.tivoli.jmx.MBeanAccess.invoke(MBeanAccess.java:113)
at com.tivoli.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:290)
at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:658)
at com.ibm.ws.console.core.mbean.MBeanHelper.invoke(MBeanHelper.java:141)
at com.ibm.ws.console.appdeployment.ApplicationDeploymentCollectionAction.perform(ApplicationDeploymentCollectionAction.java:315)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1791)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java(Compiled Code))
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java(Inlined Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java(Compiled Code))
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java(Compiled Code))
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java(Compiled Code))
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java(Compiled Code))
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java(Compiled Code))
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java(Compiled Code))
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java(Compiled Code))
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compiled Code))
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: initial context problem