RMI Tunneling

I am trying to understand how RMI Tunneling works, but I am very confused. One of my big issues is about java-rmi.cgi, it doesn't exist on new Windows JDK.
I follow some receipts to use Apache Tomcat for Tunneling RMI with a ServletHandler, but I was unsuccessful. Probably, these receipts are deprecated... I didn't found many topics about this subject, and what I had found was for older versions of JDK. Is it worthless to use RMI Tunneling?
Now, I am reading " [C.10 How can I make outgoing Java RMI calls through a local firewall?|http://java.sun.com/javase/6/docs/technotes/guides/rmi/faq.html#firewallOut] " of RMI FAQ.
I appreciate any help. Thanks.

Hi hesher,
There are two ways.
1)using java-rmin.cgi.
Just put java-rmi.cgi in /cgi-bin/.
2)using ServletHandler.
2.1)Install Tomcat6.
2.2)Read http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#servlet
and download ServletHandler.java from http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#servlet
2.3)Compile it by "javac -cp servlet.jar ServletHandlet.java]" where serlvet.jar (or servlet-api.jar) is located in /usr/share/tomcat6/lib and so on.
2.4)Deploy ServletHandler.class ..... in wbapps/rmi/WEB-INF/classes of Tomcat6.
2.5)Put a web.xml following in WEB-INF
&#12288;&#12288; <servlet>
&#12288;&#12288;&#12288;&#12288;<servlet-name>ServletHandler</servlet-name>
&#12288;&#12288;&#12288;&#12288;<servlet-class>ServletHandler</servlet-class>
&#12288;&#12288; </servlet>
&#12288;&#12288; <servlet-mapping>
&#12288;&#12288;&#12288;&#12288;<servlet-name>ServletHandler</servlet-name>
&#12288;&#12288;&#12288;&#12288;<url-pattern>/ServletHandler</url-pattern>
&#12288;&#12288;</servlet-mapping>
2.6)modify httpd.conf of apache.
&#12288; LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
&#12288; <Location /cgi-bin/java-rmi.cgi>
&#12288; ProxyPass ajp://localhost:8009/rmi/ServletHandler
&#12288; </Location>
2.7)Put "RMISocketFactory.setSocketFactory( new sun.rmi.transport.proxy.RMIHttpToCGISocketFactory());" in your java client main program.
That's all.
Good luck!
Ref.
1)http://sys.elec.kitami-it.ac.jp/users/ueda/blog/ in japanese&#12288;
2)http://java.sun.com/j2se/1.4.2/docs/guide/rmi/faq.html#servlet
3)http://forums.sun.com/thread.jspa?forumID=58&threadID=706008
4)http://forums.sun.com/index.jspa

Similar Messages

  • RMI Tunneling - Please Help

    Hello
    I am trying to get RMI tunneling to work and am having problems. I have read the documentation and have setup my environment as recommended. Specifically -- my rmi.xml file looks like this:
    <?xml version = '1.0' standalone = 'yes'?>
    <!DOCTYPE rmi-server PUBLIC "Orion RMI-server" "http://xmlns.oracle.com/ias/dtds/rmi-server.dtd">
    <rmi-server port="23791">     
    <log>
    <file path="../log/rmi.log"/>
    </log>
    </rmi-server>
    My global-web-application.xml file contains these entries:
    <servlet>
    <servlet-name>rmi</servlet-name>
    <servlet-class>com.evermind.server.rmi.RMIHttpTunnelServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>rmi</servlet-name>
    <url-pattern>/*.tunnelrmi</url-pattern>
    </servlet-mapping>
    The URL I am using to get the initial context is this:
    http:ormi://myserver:7777/NEATS
    When I attempt a lookup for one of my EJBs I get the following exception:
    javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException: No such domain/application: NEATS; nested exception is:
         javax.naming.AuthenticationException: No such domain/application: NEATS
    7777 is the port that my Oracle HTTP server listens on.
    This application is deployed in one of several OC4J components that I have configured in a single 9iAS instance. Is there some additional configuration I need to do for Apache to get the request forwarded to the right application? Maybe the multiple OC4J components are causing me trouble?
    Any help anyone can offer would be much appreciated!
    Thanks
    Chris Sargent

    Hi Chris!
    Did you ever get this to work? If so what was the solution!
    Thanks!

  • Jdk6  RMI Tunneling  - ServletHandler - GET Operation no supported

    Hi there
    I have downloaded the jdk6 docummentacion and I want to use the RMI tunneling sample. I have already set up the Apache/Tomcat in order to to a rewrite of the rmi-cgi call to the servlet
    RewriteEngine on
    RewriteLog /var/log/httpd/rewrite.log
    RewriteLogLevel 0
    RewriteRule cgi-bin/java-rmi\.cgi$ http://myhost/maindb_dev/rmi/tunnel
    And testing the call to the cgi program it changes the url to the servlet one. So the configuration of the Servlet is OK
    Then running the RMIClient provided by the jdk
    it catches a remote exception
    Error: Error unmarshaling return header; nested exception is:
         java.io.IOException: HTTP request failed
    java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
         java.io.IOException: HTTP request failed
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
         at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
         at java.rmi.Naming.lookup(Naming.java:84)
         at SampleRMIClient.main(SampleRMIClient.java:89)
    Caused by: java.io.IOException: HTTP request failed
         at sun.rmi.transport.proxy.HttpSendSocket.readNotify(HttpSendSocket.java:159)
         at sun.rmi.transport.proxy.HttpSendInputStream.read(HttpSendInputStream.java:66)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
         at java.io.DataInputStream.readByte(DataInputStream.java:248)
         at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:195)
         ... 4 more
    At the tomcat side the servletHandler outputs the following
    400Java RMI Client ErrorGET Operation not supported: Can only forward POST requests.
    So what it seems is that the RMI implementation uses a GET request instead of a POST. That is the one handle by the Servlet.
    Any body solved this?
    Thanks in advance
    Alfonso.

    Hello,
    JSR 262 (Web Services Connector for JMX Agents) offers an HTTP based Connector that is compliant with JConsole.
    The standard is not yet final but is already in public review and we don't expect major changes.
    The latest Reference Implementation (early access 3) can be downloaded from http://ws-jmx-connector.dev.java.net
    Reusing your Connector presentation I would say :
    Use of JMX WS Connector
    Advantages
    * Standard
    * Firewall friendly
    Disadvantages
    * Standalone. You need to add jars (quite a bunch actually) to JConsole classpath.
    * Less efficient than RMI or JMXMP.
    References
    Project web site : http://ws-jmx-connector.dev.java.net
    Article that cover the EA3 announcement : http://blogs.sun.com/jmxnetbeans/entry/web_services_connector_for_jmx#comments
    Article that details the Connector architecture :
    http://blogs.sun.com/jmxnetbeans/entry/up_the_metro_stack_to
    Thanks.
    Jean-Francois

  • Reconnect remote EJB using ORMI through RMI Tunnel

    Hello!
    My client application connecting to server EJB using ORMI.
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin".toUpperCase());
    env.put(Context.SECURITY_CREDENTIALS, passwordEncoder.encodePassword("admin", null).toUpperCase());
    env.put(Context.PROVIDER_URL, "ormi:http://host:7777/application");
    First connection passed. All works.
    But if connection between client and server broken, then client must reconnect to server... But it can't.
    Client pending and not response.
    I dump threads on client pending:
    First thread:
    java.lang.Thread.State: TIMED_WAITING (on object monitor)
         at java.lang.Object.wait(Native Method)
         - waiting on <0x230962d8> (a java.lang.Object)
         at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.poll(LinkedQueue.java:192)
         - locked <0x230962d8> (a java.lang.Object)
         at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:208)
         - locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
         at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:190)
         - locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
         - locked <0x2308cd68> (a java.io.BufferedInputStream)
         at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2249)
         at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2429)
         at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2499)
         at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2571)
         at java.io.ObjectInputStream.read(ObjectInputStream.java:820)
         at com.evermind.server.rmi.RMIConnection.readCommand(RMIConnection.java:162)
         at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:149)
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
         at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
         at java.lang.Thread.run(Thread.java:619)
    Second thread:
    java.lang.Thread.State: WAITING (on object monitor)
         at java.lang.Object.wait(Native Method)
         - waiting on <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
         at java.lang.Object.wait(Object.java:485)
         at com.evermind.server.rmi.RMIClientConnection.waitForResponseFromServer(RMIClientConnection.java:758)
         - locked <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
         at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:370)
         at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:179)
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:287)
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at StartUp$1.actionPerformed(StartUp.java:61)
    Look's like client trying get response from server, but server not answered... But server is alive! Why so?
    When i restart client all works fine...
    Please help!

    Hello!
    My client application connecting to server EJB using ORMI.
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin".toUpperCase());
    env.put(Context.SECURITY_CREDENTIALS, passwordEncoder.encodePassword("admin", null).toUpperCase());
    env.put(Context.PROVIDER_URL, "ormi:http://host:7777/application");
    First connection passed. All works.
    But if connection between client and server broken, then client must reconnect to server... But it can't.
    Client pending and not response.
    I dump threads on client pending:
    First thread:
    java.lang.Thread.State: TIMED_WAITING (on object monitor)
         at java.lang.Object.wait(Native Method)
         - waiting on <0x230962d8> (a java.lang.Object)
         at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.poll(LinkedQueue.java:192)
         - locked <0x230962d8> (a java.lang.Object)
         at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:208)
         - locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
         at oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream.read(TunnelledRmiTransport.java:190)
         - locked <0x2308ac90> (a oracle.oc4j.rmi.tunnelling.TunnelledRmiTransport$PluggableInputStream)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
         - locked <0x2308cd68> (a java.io.BufferedInputStream)
         at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2249)
         at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2429)
         at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2499)
         at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2571)
         at java.io.ObjectInputStream.read(ObjectInputStream.java:820)
         at com.evermind.server.rmi.RMIConnection.readCommand(RMIConnection.java:162)
         at com.evermind.server.rmi.RMIConnection.handleCommand(RMIConnection.java:149)
         at com.evermind.server.rmi.RMIConnection.listenForOrmiCommands(RMIConnection.java:127)
         at com.evermind.server.rmi.RMIConnection.run(RMIConnection.java:107)
         at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:814)
         at java.lang.Thread.run(Thread.java:619)
    Second thread:
    java.lang.Thread.State: WAITING (on object monitor)
         at java.lang.Object.wait(Native Method)
         - waiting on <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
         at java.lang.Object.wait(Object.java:485)
         at com.evermind.server.rmi.RMIClientConnection.waitForResponseFromServer(RMIClientConnection.java:758)
         - locked <0x229c0bc8> (a com.evermind.server.rmi.RMICall)
         at com.evermind.server.rmi.RMIClientConnection.waitForJndiResponse(RMIClientConnection.java:370)
         at com.evermind.server.rmi.RMIClientConnection.lookup(RMIClientConnection.java:179)
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:287)
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:51)
         at javax.naming.InitialContext.lookup(InitialContext.java:392)
         at StartUp$1.actionPerformed(StartUp.java:61)
    Look's like client trying get response from server, but server not answered... But server is alive! Why so?
    When i restart client all works fine...
    Please help!

  • HTTPS RMI Tunneling

    Hi,
    I'm currently having issues with the HTTPS Tunneling. When I make a client request to an EJB, I get the following exception:
    Server returned HTTP response code: 500 for URL: https://localhost:8889/SampleEJB.rmiTunnel [Root exception is java.io.IOException: Server returned HTTP response code: 500 for URL: https://localhost:8889/SampleEJB.rmiTunnel]
         at com.evermind.server.rmi.RMIClient.lookup(RMIClient.java:258)
         at com.evermind.server.rmi.RMIClientContext.lookup(RMIClientContext.java:50)
         at javax.naming.InitialContext.lookup(Unknown Source)
         at gov.dhs.visit.pkd.client.AggregatorClient.main(AggregatorClient.java:60)
    Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://localhost:8889/AggregatorEJB.rmiTunnel
    Here are the context properties I set when I invoke the client
    java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory
    java.naming.provider.url=https:ormi://localhost:7779/SampleEJB
    java.naming.security.principal=oc4jadmin
    java.naming.security.credentials=[pwd]
    javax.net.ssl.keystore=[keystore]
    javax.net.ssl.keystorePassword=[pwd]
    I added the following to rmi.xml
    <ssl-config keystore=[keystore location] keystore-password=[    ]/>
    I also added this to my secure-website.xml
    <default-web-app application="default" name="defaultWebApp" shared="true"/>
    Please help!
    Thanks.

    Nevermind. I resolved the issue. If anyone runs into a problem like this, let me know and I can provide assistance.

  • RMI tunneling & J2SE 5 problem

    Hi,
    I have a problem that just appeared by changing from jRE1.4 to 1.5 on client side
    My program uses RMI to load classes from a server. This server is protected by a firewall and the 80 port is not accessible.
    With JRE 1.4, the program was connecting to the server "port to port" by TCP, as we can see in this capture :
    10.0.0.1 TCP 30000 > 1301 [ACK] Seq=8310 Ack=4199 Win=14868 Len=0
    10.0.0.1 TCP 30000 > 1301 [PSH, ACK] Seq=8310 Ack=4199 Win=14868
    10.0.0.1 TCP 30000 > 1301 [ACK] Seq=8542 Ack=4199 Win=14868
    82.127.XX.XXX TCP 1301 > 30000 [ACK] Seq=4199 Ack=9948 Win=65535
    82.127.XX.XXX TCP 1304 > 30000 [SYN] Seq=0 Ack=0 Win=65535 Len=0
    10.0.0.1 TCP 30000 > 1301 [ACK] Seq=9948 Ack=4199 Win=14868
    With JRE 1.5, the program tries to connect to port 80 :
    10.0.0.1 TCP http > 2180 [SYN, ACK] Seq=0 Ack=1 Win=5840 Len=0
    82.127.XX.XXX TCP 2180 > http [ACK] Seq=1 Ack=1 Win=65535 Len=0
    82.127.XX.XXX HTTP POST /cgi-bin/java-rmi.cgi?forward=1099 HTTP/1.1
    82.127.XX.XXX TCP 2178 > 30000 [ACK] Seq=1338 Ack=526 Win=65010
    10.0.0.1 TCP [TCP Out-Of-Order] 30000 > 2178 [PSH, ACK] Seq=351
    82.127.XX.XXX TCP [TCP Dup ACK 129#1] 2178 > 30000 [ACK]
    82.127.XX.XXX HTTP POST /cgi-bin/java-rmi.cgi?forward=1099 HTTP/1.1
    10.0.0.1 TCP http > 2180 [ACK] Seq=1 Ack=389 Win=6432 Len=0
    10.0.0.1 HTTP HTTP/1.1 404 Not Found (text/html)
    ...and receives an error, since the port is not accessible.
    Error :
    java.io.IOException : HTTP request failed
    java.io.IOException: HTTP request failed
    at sun.rmi.transport.proxy.HttpSendSocket.readNotify(Unknown Source)
    at sun.rmi.transport.proxy.HttpSendInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at java.io.DataInputStream.readByte(Unknown Source)
    at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
    at sun.rmi.server.UnicastRef.invoke(Unknown Source)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at java.rmi.Naming.lookup(Unknown Source)
    at com.swingws.biweb.tools.tunneling.b.<init>(Unknown Source)
    at com.swingws.biweb.tools.tunneling.b.a(Unknown Source)
    at com.swingws.biweb.seriallink.LsServerSelectApplet.init(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Do you know why the behaviour of my program changed between the 2 JREs ?

    While Debugging, I found why it goes on HTTP connection :
    I reused the servlet code from the servletHandler Example.
    It is said that :
    When an RMI client initiates contact with a remote server,
    * it attempts to establish a connection using each of the following
    * protocols in turn, until one succeeds:
    * 1. Direct TCP connection.
    * 2. Direct HTTP connection.
    * 3. Proxy connection (SOCKS or HTTP).
    * 4. Connection on port 80 over HTTP to a CGI script.
    * 5. Proxy HTTP connection to CGI script on port 80.
    So, we can think the TCP connection doesn't work, that's why it goes through HTTP.
    Then my new question is :
    Why the server accepts TCP connections from clients with JRE1.4 and older but not for clients with JRE1.5 ?

  • Need opinions about RMI tunneling over HTTP please

    My Tomcat Server wants to talk with a JBoss Server.
    This communication has to go through a firewall, and I want to use
    the HTTP tunneling function.
    Can anybody please tell me if the HTTP tunnel has any disadvantages?
    How big is the performanceloss?
    Can anybody please give me a link how to do this? What configurations
    do I have to do where?
    Thanks!

    you do not have to do anything special for this, if you do not want to.
    All yours questions are answered here :
    http://java.sun.com/j2se/1.3/docs/guide/rmi/spec/rmi-arch6.html

  • RMI tunneling: JNDI lookup fails with : Disconnected: Type code out of range, is -29

    9iAS Release 2
    When trying to tunnel through Apache to the OC4J_home instance using ...
    http:ormi://<host>:<HTTPport>/<application> <admin><password>
    and then looking up a JNDI name ...
    TopicConnectionFactory connectionFactory =
    (TopicConnectionFactory)new InitialContext(p).lookup("jms/myTopicConnectionFactory");
    I get a NamingException thrown, with the message: Disconnected: Type code out of range, is -29.
    The jms.xml file is correct. It works against a standalone OC4J instance (therefore no tunneling) ...
    ormi://<host>:23791/<application> <admin><password>
    I'm connecting from a standalone client and using the RMIInitialContextFactory, the tunneling is working (changing oc4j username/password gets a SecurityException). What's missing? Do you have to change the jndi name when tunneling? What does -29 mean in english?

    Tunneling through the Apache HTTP server to an OC4J instance from remote standalone clients works on Linux installations of 9iAS but not on NT installations, failing with a 'Type Code out of range, is -29' error, JVM versions on client and server are the same. Also works against a standalone version of oc4j on NT, what's happening?

  • Operating System Advise

    I am currently running WINDOWS 98 SECOND EDITION and I am very happy with it,
    however I am now thinking about a 32 bit system such as WINDOWS NT, or WINDOWS
    2000 PRO, or XP PRO. If Sun offered an operating system I would probably go for that,
    as the new 64 bit solaris system is on the horizon I don't want to get left behind from more
    compatible and fluid systems that seemingly will offer more features and
    flexability especially where new networking is concerned.
    What is your advise? WINDOWS, SOLARIS, UNIX, LINUX?
    I am looking for easy policytool and RMI-tunnelling. 98 balks a little with policytool, you have to be so careful about root dir ect. Do you see a better system compatibility with any particular
    operating system?
    Thanks Nick46.
    [email protected]

    As a programmer, I find Windows 2000 Professional much better than the new XP Pro/Home. I have tried Professional. It is just 2000 with a few GUI Enhancements. It consumes a lot of memory (both physical and virtual.. and I cannot name a feature, or a program that I cannot develop on 2000. The Compatibility mode that XP Comes with sucks. I have a dual PIII 1GHz with 1024 Megs of RAM. I have tried both, and surely prefer windows 2000 over the newer version which is more of a hassle than anything else. Distinct problem .. Visual Studio 6 enterprise will not install properly. Requires MS Java 4.0 update for Visual J++ users like me. Windows Media player that comes with XP sucks.. use Winamp. There are many mp3 files that winamp plays which the WiMP does not recognize at all!
    Straight, Simple.. 32-bit Win 2000 Professional. Best of all.. costs less than XP.

  • Dont think RMi is HTTP tunneling through proxy firewall

    Hi Guys,
    Does anyone know how to monitor if RMI is using the option toHTTP tunnel through a proxy ???
    Many of clients sit behind firewalls/proxies that enable HTTP only. I thought RMI would, as a default, use HTTP tunneling POST, RESPONSe methods to get through, but it does not.
    Would that case be insted of using Naming.lokup("RMIServer"); that i should use
    Registry reg = LocateRegistry.getResgistry(serverAddress, serverPort);
    reg.lookup("RMIServer");
    Any help would be greatly appreciated.

    RMI doesn't have an option like that. Sockets do, and you get it for any socket including RMI by setting socksProxyHost and socksProxyPort.
    The RMI HTTP tunnelling thing happens when there is an HTTP server at the server side. which redirects the request to an RMI server via rmi-cgi.cgi or the RMI servlet. It's automatic, as a fallback, and you can enforce its use via a system property which you can find in the Javadoc Guide to Features/Remote Method Invocation/Useful java.rmi system properties.

  • RMI/Http Tunnelling

    Hi
    I m developing an intranet application. Using the following flow
    applet->servlet->bean->database->servlet->applet.
    For this flow to take place, should i be using rmi or http tunnelling. There is a lot of interaction between the client and the server database, so i m confused what option will be effiecient? and y

    Hi
    I m developing an intranet
    ping an intranet application. Using the following
    flow
    applet->servlet->bean->database->servlet->applet.
    For this flow to take place, should i
    place, should i be using rmi or http tunnelling.
    There is a lot of interaction between the client and
    the server database, so i m confused what option will
    be effiecient? and yJust curious! Shouldn't a servlet+DAO serve the purpose?

  • ClassCastException when RMI callback via HTTP tunneling

    Hello,
    I have a typical stock quote type of weblogic RMI application running WLS
    6.0. If I use T3 for client to register its stub on the server side, the
    server callback works fine. I use standard jndi lookup to find the server,
    if I simply switch the provider_url form:
    env.put(Context.PROVIDER_URL, "t3://192.168.1.5:7001");
    to
    env.put(Context.PROVIDER_URL, "http://192.168.1.5:7001");
    the client can still connect to server and register itself, but server
    callback fails:
    this client method: qClient.setFreshData(vList) generates the following
    error:
    java.lang.ClassCastException: ocsmon.wServerThread
    at weblogic.servlet.logging.CLFLogger.log(CLFLogger.java:65)
    at
    weblogic.servlet.logging.LogManagerHttp.log(LogManagerHttp.java:293)
    at weblogic.servlet.internal.HttpServer.log(HttpServer.java:670)
    at
    weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:
    851)
    at
    weblogic.rjvm.http.HTTPServerJVMConnection.sendMsg(HTTPServerJVMConnection.j
    ava:361)
    at
    weblogic.rjvm.MsgAbbrevJVMConnection.sendOutMsg(MsgAbbrevJVMConnection.java:
    367)
    at
    weblogic.rjvm.MsgAbbrevJVMConnection.sendMsg(MsgAbbrevJVMConnection.java:173
    at
    weblogic.rjvm.ConnectionManager.sendMsg(ConnectionManager.java:482)
    at weblogic.rjvm.RJVMImpl.send(RJVMImpl.java:419)
    at
    weblogic.rjvm.MsgAbbrevOutputStream.flushAndSendRaw(MsgAbbrevOutputStream.ja
    va:114)
    at
    weblogic.rjvm.MsgAbbrevOutputStream.flushAndSend(MsgAbbrevOutputStream.java:
    122)
    at
    weblogic.rjvm.MsgAbbrevOutputStream.sendRecv(MsgAbbrevOutputStream.java:144)
    at
    weblogic.rmi.internal.AbstractOutboundRequest.sendReceive(AbstractOutboundRe
    quest.java
    :84)
    at
    ocsmon.QuoteClientInterface_WLStub.setFreshData(QuoteClientInterface_WLStub.
    java:218)
    at ocsmon.wServerThread.run(wQuoteServer.java:350)
    ocsmon.wServerThread is the thread spawned on the server side that obtains
    the qClient stub from the server's registry and calls the refreshQuotes
    method on it. 'vList' is a Vector of Strings containing the quotes.
    What went wrong?
    thanks
    -Alan

    Hello,
    I have a typical stock quote type of weblogic RMI application running WLS
    6.0. If I use T3 for client to register its stub on the server side, the
    server callback works fine. I use standard jndi lookup to find the server,
    if I simply switch the provider_url form:
    env.put(Context.PROVIDER_URL, "t3://192.168.1.5:7001");
    to
    env.put(Context.PROVIDER_URL, "http://192.168.1.5:7001");
    the client can still connect to server and register itself, but server
    callback fails:
    this client method: qClient.setFreshData(vList) generates the following
    error:
    java.lang.ClassCastException: ocsmon.wServerThread
    at weblogic.servlet.logging.CLFLogger.log(CLFLogger.java:65)
    at
    weblogic.servlet.logging.LogManagerHttp.log(LogManagerHttp.java:293)
    at weblogic.servlet.internal.HttpServer.log(HttpServer.java:670)
    at
    weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImpl.java:
    851)
    at
    weblogic.rjvm.http.HTTPServerJVMConnection.sendMsg(HTTPServerJVMConnection.j
    ava:361)
    at
    weblogic.rjvm.MsgAbbrevJVMConnection.sendOutMsg(MsgAbbrevJVMConnection.java:
    367)
    at
    weblogic.rjvm.MsgAbbrevJVMConnection.sendMsg(MsgAbbrevJVMConnection.java:173
    at
    weblogic.rjvm.ConnectionManager.sendMsg(ConnectionManager.java:482)
    at weblogic.rjvm.RJVMImpl.send(RJVMImpl.java:419)
    at
    weblogic.rjvm.MsgAbbrevOutputStream.flushAndSendRaw(MsgAbbrevOutputStream.ja
    va:114)
    at
    weblogic.rjvm.MsgAbbrevOutputStream.flushAndSend(MsgAbbrevOutputStream.java:
    122)
    at
    weblogic.rjvm.MsgAbbrevOutputStream.sendRecv(MsgAbbrevOutputStream.java:144)
    at
    weblogic.rmi.internal.AbstractOutboundRequest.sendReceive(AbstractOutboundRe
    quest.java
    :84)
    at
    ocsmon.QuoteClientInterface_WLStub.setFreshData(QuoteClientInterface_WLStub.
    java:218)
    at ocsmon.wServerThread.run(wQuoteServer.java:350)
    ocsmon.wServerThread is the thread spawned on the server side that obtains
    the qClient stub from the server's registry and calls the refreshQuotes
    method on it. 'vList' is a Vector of Strings containing the quotes.
    What went wrong?
    thanks
    -Alan

  • RMI over HTTP Tunneling [Help needed Urgent]

    Hi Friends,
    This is a old topic in the forum, but I am learning RMI now, So for me it is a still new topic.
    Can anyone in the forum please send me the working code apart from sun implementation code. I stuck with the java-rmi.cgi file while executing, even though all other *.pl and *.cgi files are executing.
    Please help me.
    Thanks in advance,
    Harish

    See http://www.geocities.com/dmh2000/ApacheTomcatRMI.htm.

  • What are the limitations of using RMI over http with EJB?

    We have a requirement for an intranet application where the majority of the clients
    (Swing clients) will be able to connect directly using either T3 or IIOP. However,
    there are a number of clients that will need to traverse a firewall.
    We could use SOAP, but I dont want to lose the value that RMI gives us (clustering,
    security, statefullness support etc). I am thinking of using RMI over http - which
    Weblogic supports.
    I have been trying to find some documentation on the topic - but havent succeded
    so far. What I would like to understand is: What limitations I would have using
    RMI over http. Do I lose anything (apart from performance) using http?
    Regards,
    Nick

    You will have to enable tunneling on the server side and I have not heard of any
    complaints of using it.
    Shiva.
    Nick Minutello wrote:
    In fact, we are not using applets - and its not an internet application. We are
    using Java Webstart and Swing on our intranet (the problem of the size of the
    weblogic.jar is a pain - but well known)
    The question for me is; Apart from performance, are there any limitations to using
    RMI over http?
    Can we also use JMS over http?
    -Nick
    Shiva Paranandi <[email protected]> wrote:
    "Old wine new bottle".
    The biggest problem with the approach of Applets like
    stuff connecting to weblogic is the size of the classes that need to
    be supplied to the
    users. The applets/swing would need a lot of weblogic classes which you
    need to
    supply as jar file. This file can be in the order of MBs depending on
    the
    weblogic version. we had a similar kind of problem and migrated the applets
    to use
    servlets instead of directly invoking ejbs or jms topics etc. Having
    the applets
    connect
    to servlets you would still benefit from the features of clustering etc.
    and added to
    that
    you would reduce the number of remote calls.
    Shiva.
    Nick Minutello wrote:
    We have a requirement for an intranet application where the majorityof the clients
    (Swing clients) will be able to connect directly using either T3 orIIOP. However,
    there are a number of clients that will need to traverse a firewall.
    We could use SOAP, but I dont want to lose the value that RMI givesus (clustering,
    security, statefullness support etc). I am thinking of using RMI overhttp - which
    Weblogic supports.
    I have been trying to find some documentation on the topic - but haventsucceded
    so far. What I would like to understand is: What limitations I wouldhave using
    RMI over http. Do I lose anything (apart from performance) using http?
    Regards,
    Nick

  • Help needed in HTTP Tunneling - urgent

    Hi all,
    I urgently need a working code sample of a client which sends requests to a server that redirects the request to an RMI server via RMI servlet.
    Does any of you familiar of such a code sample?
    Thanks

    I'm sorry, but HTTP Tunneling is not working for me. I must have done something wrong.
    Let me describe my configuration:
    I have a server behind NAT router which connected to apache2 and tomcat 4.1 web servers. The apache2 and tomcat are not connected between them.
    I deployed war file on tomcat which contains the servlet for the HTTP Tunneling which its code is:
    public class RmiHttpTunnelerServlet extends HttpServlet
        public void init(ServletConfig config) throws ServletException
            super.init(config);
            System.out.println("Simplified RMI Servlet Handler loaded successfully.");
        public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            try
                String queryString = req.getQueryString();
                String command, param;
                int delim = queryString.indexOf("=");
                if (delim == -1)
                    command = queryString;
                    param = "";
                else
                    command = queryString.substring(0, delim);
                    param = queryString.substring(delim + 1);
                if (command.equalsIgnoreCase("forward"))
                    try
                        ServletForwardCommand.execute(req, res, param);
                    catch (ServletClientException e)
                        returnClientError(res, "client error : " + e.getMessage( ));
                        e.printStackTrace();
                    catch (ServletServerException e)
                        returnServerError(res, "internal server error : " + e.getMessage());
                        e.printStackTrace();
                else
                    returnClientError(res, "invalid command: " + command);
            catch (Exception e)
                returnServerError(res, "internal error: " + e.getMessage());
                e.printStackTrace();
        public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            returnClientError(res, "GET Operation not supported: Can only forward POST requests.");
        public void doPut(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
            returnClientError(res, "PUT Operation not supported: Can only forward POST requests.");
        public String getServletInfo()
            return "Simplified RMI Call Forwarding Servlet Servlet.<br>\n ";
        private static void returnClientError(HttpServletResponse res, String message) throws IOException
            res.sendError(HttpServletResponse.SC_BAD_REQUEST,
                          "<HTML><HEAD><TITLE>Java RMI Client Error < / TITLE > < / HEAD > < BODY > " +
                          "<H1>Java RMI Client Error</H1>" + message + "</BODY></HTML>");
            System.err.println(HttpServletResponse.SC_BAD_REQUEST + "Java RMI Client Error" + message);
        private static void returnServerError(HttpServletResponse res,
                                              String message) throws IOException
            res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                          "<HTML><HEAD>< TITLE > Java RMI Server Error < / TITLE > < / HEAD > < BODY > " +
                          "<H1>Java RMI Server Error < / H1 > " + message + " < / BODY > < / HTML > ");
            System.err.println(HttpServletResponse.SC_INTERNAL_SERVER_ERROR + "Java RMI Server Error : " + message);
        }There is also a utility class:
    public class ServletForwardCommand {
        public static void execute(HttpServletRequest request, HttpServletResponse response, String stringifiedPort)
            throws ServletClientException, ServletServerException, IOException {
            int port = convertStringToPort(stringifiedPort);
            Socket connectionToLocalServer = null;
            try {
                connectionToLocalServer = connectToLocalServer(port);
                forwardRequest(request, connectionToLocalServer);
                forwardResponse(response, connectionToLocalServer);
            } finally {
                if (null != connectionToLocalServer) {
                    connectionToLocalServer.close();
        private static int convertStringToPort(String stringfiedPort) throws ServletClientException {
            int returnValue;
            try {
                returnValue = Integer.parseInt(stringfiedPort);
            } catch (NumberFormatException e) {
                throw new ServletClientException("invalid port number: " + stringfiedPort);
            if (returnValue <= 0 || returnValue > 0xFFFF) {
                throw new ServletClientException("invalid port: " + returnValue);
            if (returnValue < 1024) {
                throw new ServletClientException("permission denied for port: " + returnValue);
            return returnValue;
        private static Socket connectToLocalServer(int port) throws ServletServerException {
            Socket returnValue;
            try {
                returnValue = new Socket(InetAddress.getLocalHost(), port);
            } catch (IOException e) {
                throw new ServletServerException("could not connect to " + "local port");
            return returnValue;
        private static void forwardRequest(HttpServletRequest request, Socket connectionToLocalServer)
            throws IOException, ServletClientException, ServletServerException {
            byte buffer[];
            DataInputStream clientIn = new DataInputStream(request.getInputStream());
            buffer = new byte[request.getContentLength()];
            try {
                clientIn.readFully(buffer);
            } catch (EOFException e) {
                throw new ServletClientException("unexpected EOF " + "reading request body");
            } catch (IOException e) {
                throw new ServletClientException("error reading request" + " body");
            DataOutputStream socketOut = null;
            // send to local server in HTTP
            try {
                socketOut = new DataOutputStream(connectionToLocalServer.getOutputStream());
                socketOut.writeBytes("POST / HTTP/1.0\r\n");
                socketOut.writeBytes("Content-length: " + request.getContentLength() + "\r\n\r\n");
                socketOut.write(buffer);
                socketOut.flush();
            } catch (IOException e) {
                throw new ServletServerException("error writing to server");
        private static void forwardResponse(HttpServletResponse response, Socket connectionToLocalServer)
            throws IOException, ServletClientException, ServletServerException {
            byte[] buffer;
            DataInputStream socketIn;
            try {
                socketIn = new DataInputStream(connectionToLocalServer.getInputStream());
            } catch (IOException e) {
                throw new ServletServerException("error reading from " + "server");
            String key = "Content-length:".toLowerCase();
            boolean contentLengthFound = false;
            String line;
            int responseContentLength = -1;
            do {
                try {
                    line = socketIn.readLine();
                } catch (IOException e) {
                    throw new ServletServerException("error reading from server");
                if (line == null) {
                    throw new ServletServerException("unexpected EOF reading server response");
                if (line.toLowerCase().startsWith(key)) {
                    responseContentLength = Integer.parseInt(line.substring(key.length()).trim());
                    contentLengthFound = true;
            while ((line.length() != 0) &&
                (line.charAt(0) != '\r') && (line.charAt(0) != '\n'));
            if (!contentLengthFound || responseContentLength < 0)
                throw new ServletServerException("missing or invalid content length in server response");
            buffer = new byte[responseContentLength];
            try {
                socketIn.readFully(buffer);
            } catch (EOFException e) {
                throw new ServletServerException("unexpected EOF reading server response");
            } catch (IOException e) {
                throw new ServletServerException("error reading from server");
            response.setStatus(HttpServletResponse.SC_OK);
            response.setContentType("application/octet-stream");
            response.setContentLength(buffer.length);
            try {
                OutputStream out = response.getOutputStream();
                out.write(buffer);
                out.flush();
            } catch (IOException e) {
                throw new ServletServerException("error writing response");
    }I checked also with packets monitoring tool, I couldn't see any http transportation.
    Any help will be appreciated.

Maybe you are looking for

  • Objects in Array / ArrayCollection with FlowLayout

    I am pretty baffled by what is happening here: I am attempting to create an array of visual elements/containers (s:Group, to be precise), and each Group will contain a set of Labels as elements. I've tried using both Array and ArrayCollection but am

  • IPhoto 6 - Imports by Roll!  WHY!!!

    So, after being very excited about getting iLife 6 and doing the upgrade, I'm dismayed to find that some nut at Apple thought importing by roll would make things better in some way. Yes we can use iPhoto to edit, but I don't, I use Photoshop and now

  • Standby DB on Windows OS

    When a windows server has to be restarted for OS upgrades (etc.), what guarantees that the Standby DB will startup in mount and recovery mode? I ahev checked the Windows registry and the ora_autostart registry key reads TRUE. All that says to me is t

  • Illegal XML character exception in Importing data imprt manager

    Did any one of you face Illegal XML character error while importing extracted data from ECC I googled and found out XML parser does not like to find '<' '&' in the data , is that true? if so what was the work around ?? BTW we are getting DEBMDM custo

  • Authorizations for testing of ABAP Web Services

    Can somebody tell me which authorizations/roles I need to assign to a user with SAP WAS 6.40 ABAP so that he will be able to test a simple ABAP Web Service with the Java Service home page of this service? I tried this with the roles SAP_BC_DWB_ABAPDE