how to access remote ejb server(in Internet) through proxy i
lyy9505 Apr 2, 2004 2:32 AMhi,everybody!
the jboss3.23 server box is the internet,and the client box
is in a lan which get to the internet through a proxy;
well,How can I set the code to make my client access the
server(It puzzle me about two weeks)
the fact is that server and client both in LAN,they run OK,
both in Internet(have their own WEB IP),they also run OK,
however,when server in Internet and Client box in LAN,I don't how to run them successfully!Help me?thanks.
the main code is here:
Context jndiContext = null;
String serverip = new String(jTextField3.getText());//get the serverip
Properties p = new Properties();
p.put( "http.proxySet", "true" );
p.put( "http.proxyHost", "192.168.0.161" );//the proxy internal ip
p.put( "http.proxyPort", "80" ); System.setProperties(p);
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, serverip);
try
{
jndiContext = new InitialContext(p);
System.out.println("initcontext!\n");
Object ref = jndiContext.lookup("LoginEJB");
LoginHome home = (LoginHome)PortableRemoteObject.narrow(ref,LoginHome.class);
Login hw = home.create();
...................................
well,the error code are following:
javax.naming.CommunicationException: Receive timed out [Root exception is java.n
et.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:11
15)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1192)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(Unknown Source)
at LoginClient.pressOK(LoginClient.java:114)
at LoginClient.actionPerformed(LoginClient.java:75)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
n Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(Unknown Source)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:10
93)
... 29 more
throwable exception