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