thx for your respond Veshnu Ramakrishnan.
J have found somewhere then properties for J2ee server should be:
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnamingCNCtxFactory");
props.put(Context.PROVIDER_URL, "iiop://localhost:<port>");
and i change my client class to:
import javax.naming.*;
import java.rmi.*;
import java.util.Properties;
import javax.rmi.*;
import headfirst.*;
import javax.ejb.*;
public class DoradcaKlient {
public static void main(String[] args) {
new DoradcaKlient().doDziela();
}
public void doDziela(){
Context ic =null;
DoradcaHome ibaz = null;
Doradca doradca = null;
try{
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
props.put(Context.PROVIDER_URL, "iiop://localhost:4848");
//, "com.sun.jndi.cosnaming.CNCtxFactory"
ic = new InitialContext(props);
Object o = ic.lookup("Doradca");
ibaz = (DoradcaHome)PortableRemoteObject.narrow(o,DoradcaHome.class);
doradca = ibaz.create();
System.out.println(doradca.getPorada());
}catch(Exception ex){
ex.printStackTrace();
}
}
}
but now i have another problem:
javax.naming.CommunicationException: Cannot connect to ORB [Root exception is or
g.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe]
at com.sun.jndi.cosnaming.CNCtx.setOrbAndRootContext(CNCtx.java:362)
at com.sun.jndi.cosnaming.CNCtx.initUsingIiopUrl(CNCtx.java:289)
at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:245)
at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(CNCtx.java:209)
at com.sun.jndi.cosnaming.CNCtx.<init>(CNCtx.java:69)
at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(CNCtxFactory.ja
va:32)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
67)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247
)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at DoradcaKlient.doDziela(DoradcaKlient.java:28)
at DoradcaKlient.main(DoradcaKlient.java:11)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed:
Maybe
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(
ORBUtilSystemException.java:2372)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectionAbort(
ORBUtilSystemException.java:2390)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBit
s(SocketOrChannelConnectionImpl.java:354)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.handleE
vent(SocketOrChannelConnectionImpl.java:1098)
at com.sun.corba.se.impl.transport.SelectorImpl.run(SelectorImpl.java:28
2)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 211 completed:
No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenR
eadingConnection(ORBUtilSystemException.java:2456)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.ioexceptionWhenR
eadingConnection(ORBUtilSystemException.java:2474)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHea
der(MessageBase.java:116)
at com.sun.corba.se.impl.transport.CorbaContactInfoBase.createMessageMed
iator(CorbaContactInfoBase.java:150)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readBit
s(SocketOrChannelConnectionImpl.java:314)
... 2 more
Caused by: java.io.IOException: End-of-stream
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.readFul
ly(SocketOrChannelConnectionImpl.java:602)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.read(So
cketOrChannelConnectionImpl.java:521)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.readGIOPHea
der(MessageBase.java:112)
... 4 more
and i am in the same point