Search Results

Search found 202 results on 9 pages for 'rmi'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • java RMI newbie-- some basic questions about SSL and auth/.rate limiting an RMI service

    - by Arvind
    I am trying to work to secure a java based RMI service using SSL. I have some basic questions about the capabilities of using SSL. Specifically, from what I understand, the client and server connecting via SSL will need to have appropriate credential certificates in both client and server, for a client to be granted access to the server. Am I correct in my understanding? Also, what I want to know is, can a person who is already using my RMI service and has access to a client machine , make a copy of the certificate in the client machine to other client machines-- and then invoke my RMI service from those other machines as well? How do I prevent such a situation from occurring? I mean, in a REST API you can use OAuth authentication, can we have some kind of authentication in an RMI Service? Also, can I possibly limit usage of the RMI service? For eg, a specific client may be allowed to make only 5000 calls per day to my RMI service, and if he makes more calls the calls occurring after the 5000 calls limit are all denied? How do I do such rate limiting and/or authentication for my RMI Service?

    Read the article

  • RMI on client side generating exception when getting a reference to the RMI server

    - by Noona
    When I try to run an RMI client after running the RMI server I get the following exception: EncodeInterface exception: java.lang.ClassCastException: $Proxy30 cannot be cast to hw2.chat.backend.main.EncodeInterface java.lang.ClassCastException: $Proxy30 cannot be cast to hw2.chat.backend.main.EncodeInterface at hw2.chat.backend.main.EncodingRmiClient.initialiseRMIClient(EncodingRmiClient.java:26) And the relevant code in the RMI client is: EncodeInterface encodeInterface; Registry registry = LocateRegistry.getRegistry(host, portNumber); encodeInterface = (EncodeInterface)registry.lookup("RmiEncodingServer"); //line 26 And in the RMI server: try { EncodeInterface encodeInterface = new EncoderImpl(); Registry registry = LocateRegistry.getRegistry(); registry.rebind("RmiEncodingServer", encodeInterface); System.out.println("RmiEncodingServer is running..."); } EncodeInterface is the interface that extends Remote and that is present in the client side too. Host is "127.0.0.1" and portNumber is 1099 (I am assuming it should be the default value which is 1099 since I didn't specify it when I ran my RmiEncodingServer). If I don’t run the RMI server I get the same exception, any ideas as to why this is happening? thanks

    Read the article

  • java.rmi.UnmarshalException: unable to pull client classes by server

    - by andrews
    Hi, I have an RMI client/server set-up on two machines that works fine in a simple situation when the server doesn't require a client-side defned class. However, when I need to use a class defined on the client side I am unable to have the server unmarshall those classes. I suspect this is an issue with my java.rmi.server.codebase property that I pass in as argument to the client app. I followed Sun's RMI Tutorial trail and I think I have followed the steps exactly except that I don't specify a classpath argument when executing client and server because they execute in the directory right above the root package directory (however I tried that too with no effect). The exceptions I get when attempting to execute the different client-side combinations described in detail below are all the same: RmiServer exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: test.MyTask at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:353) at sun.rmi.transport.Transport$1.run(Transport.java:177) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:173) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:636) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) at $Proxy0.execute(Unknown Source) at test.myClient.main(myClient.java:32) The details are: My client/server rmi is set up over a home network behind a router. The router is assigned to a static ip address I will call myhostname. Appropriate port-mapping is set-up in the router that points to the right machines. role, machine, os, ip-address: server, venice, linux ubuntu 9.10, 10.0.1.2 client, naples, mac os x leopard, 10.0.1.4 I startup the server side as follows inside /home/andrews/workspace/epsilon/bin: 1 starting registry on the default port 1099: venice% rmiregistry & 2 starting web-server on port 2001 pointing to code base for common interfaces: venice% java webserver/ClassFileServer 2001 /home/andrew/workspace/epsilon/bin 3 starting server app (main class in test/myServer) which registers the server object: venice% java -Djava.rmi.server.codebase="http://myhostname:2001/" -Djava.security.policy=server.policy -Djava.rmi.server.hostname=myhostname test/myServer & Now the client side inside /Users/andrews/Development/Java/workspace/epsilon/bin: 1 start a local web server that can server client-side classes to the server (not sure if this is needed, but I added I tried it, and still no success; I have added port-mapping to the router for 2001 to venice, for 2002 to naples) naples$ java webserver/ClassFileServer 2002 /Users/andrews/Development/Java/workspace/epsilon/bin/ Trying to run the client (note: I don't specify the -cp argument because client executes right above the root package directory): 1 try #1 using an http hostname naples$ java -Djava.rmi.server.codebase=http://10.0.1.4:2002/ -Djava.security.policy=client.policy test.myClient myhostname Note 1: the myhostname argument at the end is passed-in to the client so that it resolves to server's rmi hostname. Note 2: I tried using localhost:2002 instead of 10.0.1.4:2002 too. Note 3: I tried using myhostname:2002 since myhostname is assigned to the router and I have proper port-mapping set-up, this address should resolve to naples and not venice 2 try #2: naples$ java -Djava.rmi.server.codebase=file:/Users/andrews/Development/Java/workspace/epsilon/bin/ -Djava.security.policy=client.policy test.myClient myhostname Note 1: the code base url format is correct, I created a small program to convert current file directory path into a url and used that. using file:///Users... has same effect. Other notes: 1 my server and client policy files correctly specify the path, as I've tested this setup with good and bad paths, and getting a security exception for bad path 2 this setup works if I don't use client-side defined objects, the client connects correctly to the server and the server executes. 3 when I place the client-side class on the server in the server's classpath, all executes fine. All help is appreciated.

    Read the article

  • Java RMI (Server: TCP Connection Idle/Client: Unmarshalexception (EOFException))

    - by Perry Dahl Christensen
    I'm trying to implement Sun Tutorials RMI application that calculates Pi. I'm having some serious problems and I cant find the solution eventhough I've been searching the entire web and several javaskilled people. I'm hoping you can put an end to my frustrations. The crazy thing is that I can run the application from the cmd on my desktop computer. Trying the exact same thing with the exact same code in the exact same directories on my laptop produces the following errors. The problem occures when I try to connect the client to the server. I don't believe that the error is due to my policyfile as I can run it on the desktop. It must be elsewhere. Have anyone tried the same and can you give me a hint as to where my problem is, please? POLICYFILE SERVER: grant { permission java.security.AllPermissions; permission java.net.SocketPermission"*", "connect, resolve"; }; POLICYFILE CLIENT: grant { permission java.security.AllPermissions; permission java.net.SocketPermission"*", "connect, resolve"; }; SERVERSIDE ERRORS: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\STUDENTcd\ C:start rmiregistry C:java -cp c:\java;c:\java\compute.jar -Djava.rmi.server.codebase=file:/c:/jav a/compute.jar -Djava.rmi.server.hostname=localhost -Djava.security.policy=c:/jav a/servertest.policy engine.ComputeEngine ComputeEngine bound Exception in thread "RMI TCP Connection(idle)" java.security.AccessControlExcept ion: access denied (java.net.SocketPermission 127.0.0.1:1440 accept,resolve) at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkAccept(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.checkAcceptPermi ssion(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.checkAcceptPermission(Unknown Sour ce) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Sou rce) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sour ce) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source ) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) CLIENTSIDE ERRORS: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\STUDENTcd\ C:java -cp c:\java;c:\java\compute.jar -Djava.rmi.server.codebase=file:\C:\jav a\files\ -Djava.security.policy=c:/java/clienttest.policy client.ComputePi local host 45 ComputePi exception: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is: java.io.EOFException at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source) at sun.rmi.server.UnicastRef.invoke(Unknown Source) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unkn own Source) at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) at $Proxy0.executeTask(Unknown Source) at client.ComputePi.main(ComputePi.java:18) Caused by: java.io.EOFException at java.io.DataInputStream.readByte(Unknown Source) ... 6 more C: Thanks in advance Perry

    Read the article

  • RMI applet is making requests on random ports and blocked consequently

    - by Dan
    /// I have set up RMI system successfully on local ubuntu srver. Registry port 1099 and remote object export on 1100(fixed by calling super(1100)) Now I am trying to make it work on Ubuntu over internet with a public IP. I could bind service properly with public ip.But the client applet is trying to connect to ubuntu server at random ports. Below is the error thrown by client applet: // Exception network: Connecting public-ip:1100 with proxy=DIRECT network: Connecting public-ip/cgi-bin/java-rmi.cgi?forward=1099 with proxy=DIRECT network: Connecting public-ip:3733 with proxy=DIRECT network: Connecting public-ip:3721 with proxy=DIRECT // java.rmi.ConnectException: Connection refused to host: public-ip; nested exception is: java.net.ConnectException: Connection refused: connect at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source)Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ... // // I have only 2 ports open on server, i.e., 1099(registry) and 1100(export). How can I fix ports in applet requests such that it does always connect server on same open port? // // Another issue.As I have bound service on public IP i.e. //public-ip:1099/ServiceName, a job running on server to send message to clinets is not able to make request to RMI service. public-ip URL does not work on same machine,i.e., server.Do you think I should use fixed socket factory?If so please give me code snippet and guide me how i can set it up. //Exception java.rmi.ConnectException: Connection refused to host: public-ip; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:194) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:148) at $Proxy5.getUserID(Unknown Source) at rmi.source.xxxxxx$JobScheduler.run(xxxxServerImpl.java:293) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:337) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:198) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at java.net.Socket.(Socket.java:425) at java.net.Socket.(Socket.java:208) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613) ... 9 more Coould you please help me? Thanks a lot in advance. Dan

    Read the article

  • Java RMI timeout in callback

    - by sakra
    We are using Java RMI for communication. An RMI client passes a processing request and an object with a callback method to an RMI server. The server invokes the callback when it is done with processing. The setup is similar to the one described in RMI Callbacks. Occasionally we are getting a "read time out" exception in the server upon invoking the callback method. The callback thread stalls for about a minute before the exception is raised. java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.net.SocketTimeoutException: Read timed out at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:286) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) at $Proxy2.finished(Unknown Source) at com.unrisk.db.grid.GridTask.invokeCallback(com.unrisk.db.grid.GridTask:1292) at com.unrisk.db.grid.GridTask.invokeCallbacks(com.unrisk.db.grid.GridTask:1304) at com.unrisk.db.service.tasks.EquityMDTask.afterRun(com.unrisk.db.service.tasks.EquityMDTask:276) at com.unrisk.db.grid.GridTask.run(com.unrisk.db.grid.GridTask:720) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:129) 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.tcp.TCPChannel.createConnection(TCPChannel.java:228) ... 12 more We are using Sun Java JDK 1.6.0_18 under Windows Server 2003 32-bit. Is it possible to work around the connection problems by tuning RMI related system properties?

    Read the article

  • Java RMI InitialContext: Equivalent of LocateRegistry.createRegistry(int) ?

    - by bguiz
    I am trying to some pretty basic RMI: // Context namingContext = new InitialContext(); Registry reg = LocateRegistry.createRegistry(9999); for ( int i = 0; i < objs.length; i++ ) { int id = objs[i].getID(); // namingContext.bind( "rmi:CustomObj" + id , objs[i] ); reg.bind( "CustomObj" + id , objs[i] ); } That works without a hitch, but for future purposes, I need to use InitialContext. Context namingContext = new InitialContext(); for ( int i = 0; i < objs.length; i++ ) { int id = objs[i].getID(); namingContext.bind( "rmi:CustomObj" + id , objs[i] ); } But I cannot get this to work. I have started rmiregistry from the command line. Is there an equivalent of LocateRegistry.createRegistry(int)? Or some other way to start the RMI registry / registry used by InitialContext from inside my class? (Instead of the command line) Stack trace: javax.naming.CommunicationException [Root exception is java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: bguiz.scratch.network.eg.Student] at com.sun.jndi.rmi.registry.RegistryContext.bind(RegistryContext.java:126) at com.sun.jndi.toolkit.url.GenericURLContext.bind(GenericURLContext.java:208) at javax.naming.InitialContext.bind(InitialContext.java:400) at bguiz.scratch.RMITest.main(RMITest.java:29) Caused by: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: bguiz.scratch.CustomObj at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250) ....(truncated) EDIT: I will delete my own question in a couple of days, as there seems to be no answer to this (I haven't been able to figure it out myself). Last call for any biters!

    Read the article

  • How to Achieve OC4J RMI Load Balancing

    - by fip
    This is an old, Oracle SOA and OC4J 10G topic. In fact this is not even a SOA topic per se. Questions of RMI load balancing arise when you developed custom web applications accessing human tasks running off a remote SOA 10G cluster. Having returned from a customer who faced challenges with OC4J RMI load balancing, I felt there is still some confusions in the field how OC4J RMI load balancing work. Hence I decide to dust off an old tech note that I wrote a few years back and share it with the general public. Here is the tech note: Overview A typical use case in Oracle SOA is that you are building web based, custom human tasks UI that will interact with the task services housed in a remote BPEL 10G cluster. Or, in a more generic way, you are just building a web based application in Java that needs to interact with the EJBs in a remote OC4J cluster. In either case, you are talking to an OC4J cluster as RMI client. Then immediately you must ask yourself the following questions: 1. How do I make sure that the web application, as an RMI client, even distribute its load against all the nodes in the remote OC4J cluster? 2. How do I make sure that the web application, as an RMI client, is resilient to the node failures in the remote OC4J cluster, so that in the unlikely case when one of the remote OC4J nodes fail, my web application will continue to function? That is the topic of how to achieve load balancing with OC4J RMI client. Solutions You need to configure and code RMI load balancing in two places: 1. Provider URL can be specified with a comma separated list of URLs, so that the initial lookup will land to one of the available URLs. 2. Choose a proper value for the oracle.j2ee.rmi.loadBalance property, which, along side with the PROVIDER_URL property, is one of the JNDI properties passed to the JNDI lookup.(http://docs.oracle.com/cd/B31017_01/web.1013/b28958/rmi.htm#BABDGFBI) More details below: About the PROVIDER_URL The JNDI property java.name.provider.url's job is, when the client looks up for a new context at the very first time in the client session, to provide a list of RMI context The value of the JNDI property java.name.provider.url goes by the format of a single URL, or a comma separate list of URLs. A single URL. For example: opmn:ormi://host1:6003:oc4j_instance1/appName1 A comma separated list of multiple URLs. For examples:  opmn:ormi://host1:6003:oc4j_instanc1/appName, opmn:ormi://host2:6003:oc4j_instance1/appName, opmn:ormi://host3:6003:oc4j_instance1/appName When the client looks up for a new Context the very first time in the client session, it sends a query against the OPMN referenced by the provider URL. The OPMN host and port specifies the destination of such query, and the OC4J instance name and appName are actually the “where clause” of the query. When the PROVIDER URL reference a single OPMN server Let's consider the case when the provider url only reference a single OPMN server of the destination cluster. In this case, that single OPMN server receives the query and returns a list of the qualified Contexts from all OC4Js within the cluster, even though there is a single OPMN server in the provider URL. A context represent a particular starting point at a particular server for subsequent object lookup. For example, if the URL is opmn:ormi://host1:6003:oc4j_instance1/appName, then, OPMN will return the following contexts: appName on oc4j_instance1 on host1 appName on oc4j_instance1 on host2, appName on oc4j_instance1 on host3,  (provided that host1, host2, host3 are all in the same cluster) Please note that One OPMN will be sufficient to find the list of all contexts from the entire cluster that satisfy the JNDI lookup query. You can do an experiment by shutting down appName on host1, and observe that OPMN on host1 will still be able to return you appname on host2 and appName on host3. When the PROVIDER URL reference a comma separated list of multiple OPMN servers When the JNDI propery java.naming.provider.url references a comma separated list of multiple URLs, the lookup will return the exact same things as with the single OPMN server: a list of qualified Contexts from the cluster. The purpose of having multiple OPMN servers is to provide high availability in the initial context creation, such that if OPMN at host1 is unavailable, client will try the lookup via OPMN on host2, and so on. After the initial lookup returns and cache a list of contexts, the JNDI URL(s) are no longer used in the same client session. That explains why removing the 3rd URL from the list of JNDI URLs will not stop the client from getting the EJB on the 3rd server. About the oracle.j2ee.rmi.loadBalance Property After the client acquires the list of contexts, it will cache it at the client side as “list of available RMI contexts”.  This list includes all the servers in the destination cluster. This list will stay in the cache until the client session (JVM) ends. The RMI load balancing against the destination cluster is happening at the client side, as the client is switching between the members of the list. Whether and how often the client will fresh the Context from the list of Context is based on the value of the  oracle.j2ee.rmi.loadBalance. The documentation at http://docs.oracle.com/cd/B31017_01/web.1013/b28958/rmi.htm#BABDGFBI list all the available values for the oracle.j2ee.rmi.loadBalance. Value Description client If specified, the client interacts with the OC4J process that was initially chosen at the first lookup for the entire conversation. context Used for a Web client (servlet or JSP) that will access EJBs in a clustered OC4J environment. If specified, a new Context object for a randomly-selected OC4J instance will be returned each time InitialContext() is invoked. lookup Used for a standalone client that will access EJBs in a clustered OC4J environment. If specified, a new Context object for a randomly-selected OC4J instance will be created each time the client calls Context.lookup(). Please note the regardless of the setting of oracle.j2ee.rmi.loadBalance property, the “refresh” only occurs at the client. The client can only choose from the "list of available context" that was returned and cached from the very first lookup. That is, the client will merely get a new Context object from the “list of available RMI contexts” from the cache at the client side. The client will NOT go to the OPMN server again to get the list. That also implies that if you are adding a node to the server cluster AFTER the client’s initial lookup, the client would not know it because neither the server nor the client will initiate a refresh of the “list of available servers” to reflect the new node. About High Availability (i.e. Resilience Against Node Failure of Remote OC4J Cluster) What we have discussed above is about load balancing. Let's also discuss high availability. This is how the High Availability works in RMI: when the client use the context but get an exception such as socket is closed, it knows that the server referenced by that Context is problematic and will try to get another unused Context from the “list of available contexts”. Again, this list is the list that was returned and cached at the very first lookup in the entire client session.

    Read the article

  • problem in start up my RMI server(under ISP) so that it can recieve remote calls over Internet.--Jav

    - by Lokesh Kumar
    i m creating a Client/Server application in which my server and client can be on the same or on different machines but both are under ISP. My RMI programs:- -Remote Intreface:- //Calculator.java public interface Calculator extends java.rmi.Remote { public long add(long a, long b) throws java.rmi.RemoteException; public long sub(long a, long b) throws java.rmi.RemoteException; public long mul(long a, long b) throws java.rmi.RemoteException; public long div(long a, long b) throws java.rmi.RemoteException; } Remote Interface Implementation:- //CalculatorImpl.java public class CalculatorImpl extends java.rmi.server.UnicastRemoteObject implements Calculator { public CalculatorImpl() throws java.rmi.RemoteException { super(); } public long add(long a, long b) throws java.rmi.RemoteException { return a + b; } public long sub(long a, long b) throws java.rmi.RemoteException { return a - b; } public long mul(long a, long b) throws java.rmi.RemoteException { return a * b; } public long div(long a, long b) throws java.rmi.RemoteException { return a / b; } } Server:- //CalculatorServer.java import java.rmi.Naming; import java.rmi.server.RemoteServer; public class CalculatorServer { public CalculatorServer() { try { Calculator c = new CalculatorImpl(); Naming.rebind("rmi://"+args[0]+":1099/CalculatorService", c); } catch (Exception e) { System.out.println("Trouble: " + e); } } public static void main(String args[]) { new CalculatorServer(); } } Client:- //CalculatorClient.java import java.rmi.Naming; import java.rmi.RemoteException; import java.net.MalformedURLException; import java.rmi.NotBoundException; public class CalculatorClient { public static void main(String[] args) { try { Calculator c = (Calculator)Naming.lookup("rmi://"+args[0]+"/CalculatorService"); System.out.println( c.sub(4, 3) ); System.out.println( c.add(4, 5) ); System.out.println( c.mul(3, 6) ); System.out.println( c.div(9, 3) ); } catch (MalformedURLException murle) { System.out.println(); System.out.println("MalformedURLException"); System.out.println(murle); } catch (RemoteException re) { System.out.println(); System.out.println("RemoteException"); System.out.println(re); } catch (NotBoundException nbe) { System.out.println(); System.out.println("NotBoundException"); System.out.println(nbe); } catch (java.lang.ArithmeticException ae) { System.out.println(); System.out.println("java.lang.ArithmeticException"); System.out.println(ae); } } } when both Server and client programs are on same machine:- i start my server program by passing my router static IP address:-192.168.1.35 in args[0] and my server starts...fine. and by passing the same Static IP address in my Client's args[0] also works fine. but:- when both Server and client programs are on different machines:- now,i m trying to start my Server Program by passing it's public IP address:59.178.198.247 in args[0] so that it can recieve call over internet. but i am unable to start it. and the following exception occurs:- Trouble: java.rmi.ConnectException: Connection refused to host: 59.178.198.247; nested exception is: java.net.ConnectException: Connection refused: connect i think it is due to NAT Problem because i am under ISP. so,my problem is that how can i start my RMI Server under ISP so that it can recieve remote calls from internet????

    Read the article

  • java RMI connection to server

    - by user85116
    I have a very simple rmi client / server application. I don't use the "rmiregistry" application though, I use this to create the server: server = new RemoteServer(); registry = LocateRegistry.createRegistry(PORT); registry.bind("RemoteServer", server); The client part is: registry = LocateRegistry.getRegistry(IPADDRESS, PORT); remote = (IRemoteServer) registry.lookup("RemoteServer"); Here is the fascinating problem: The application works perfectly when both server and client are running in my (private) local network. As soon as I put the server on a public server, the application hangs for a minute, then gives me the following error: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.ConnectException: Connection refused to host: 192.168.x.y; nested exception is: java.net.ConnectException: Connection timed out: connect at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source ... (the rest is truncated) The key I think is that the client (running on my private network) cannot connect to myself (my address is 192.168.x.y where x.y is some other numbers, but the real error message shows my ip address listed there) If I kill the rmi server on the public internet, then I instantly get a "connection refused to host: a.b.c.d") message, so I know that something at the server end is at least working. Any suggestions? EDIT: just to make this a little more clear: 192.168.x.y is the client address, a.b.c.d is the server address. The stacktrace shows the client cannot connect to the client.

    Read the article

  • Java RMI AccessControlException: access denied

    - by Gwilym
    Hey im getting a AccessControlException: access denied when attempting to start up a RMI app im writing, I cant work out why I get this exception if I open it on the default port 1099, or on another dynamic port, my policy file currently grants everything (will change when app is finished). I am stuck as to where It is going wrong, any help would but of great use My code public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws RemoteException, AlreadyBoundException, MalformedURLException { if (System.getSecurityManager() == null) { System.setSecurityManager ( new RMISecurityManager() ); } CreditCardServer ccs = new CreditCardServer(); int port = 1099; try { port = Integer.valueOf(args[0]); } catch (Exception e) { System.out.println("Invlaid Port"); } if (((port <= 65535) && (port >= 49152)) || port ==1099) { System.out.println("Valid Port"); } else { port = 1099; System.out.println("Port not in Dynamic Range 49152<-->65535"); } System.out.println(port); LocateRegistry.createRegistry(port); LocateRegistry.getRegistry().bind("CreditCardServer", ccs); while (true) { //hum? } } } The Stack Trace vega3 [ia32.linux] 23% java -Djava.security.policy=wideopen.policy -jar "BookStore-CreditCardServer.jar 65000" Valid Port 65000 Exception in thread "main" java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:342) at java.security.AccessController.checkPermission(AccessController.java:553) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1051) at java.net.Socket.connect(Socket.java:536) at java.net.Socket.connect(Socket.java:492) at java.net.Socket.<init>(Socket.java:389) at java.net.Socket.<init>(Socket.java:203) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340) at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source) at bookstorecreditcardserver.Main.main(Main.java:56) My Policy File grant { // Allow everything for now permission java.security.AllPermission; };

    Read the article

  • running an RMI server in command line and eclipse

    - by Noona
    I need to run my RMI server using the command line, my class files reside in this folder: C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\RmiServerClasses in package hw2.rmi.server The code base reside in this folder: C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\RmiServerCodeBase in package hw2.rmi.server I use the command line: java –classpath C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\RmiServerClasses\ -Djava.rmi.server.codebase=file:/C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer\ Djava.security.policy=c:\HW2\permissions.policy hw2.rmi.server.RmiEncodingServer but I get a "class not found" exception as follows: Exception in thread "main" java.lang.NoClassDefFoundError: ûclasspath Caused by: java.lang.ClassNotFoundException: ûclasspath at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) Could not find the main class: GÇôclasspath. Program will exit. where have I gone wrong? also, if you can provide instructions on how to run the server in eclipse, I added the following as a VM argument, but I get a class not found exception to a class that is in the RmiServerCodeBase: -Djava.security.policy=C:\workspace\distributedhw2\permissions.policy -Djava.rmi.server.codebase=file:/C:\workspace\distributedhw2\AgencyServers\RmiEncodingServer thanks

    Read the article

  • MutiHomed computers and rmi?

    - by ipkiss
    Hello, I am writing a program using rmi to connect server and clients together and got the following issue: My rmi server support both ethernet and wifi mode rmi clients can connect to the server either vi ethernet or wifi depending. That because s*ome clients can only run via ethernet* and some can only run via wifi. My question is: how can I make my rmi server connect to all clients in such situation? Thanks.

    Read the article

  • Client fails to connect with RMI registry when using ProcessBuilder

    - by xavier666
    If i'm creating the RMI registry from command line, the client has no problem in binding objects to the registry. However, if i'm starting the RMI registry using ProcessBuilder, it's giving error. This is my code for creating rmiregistry using ProcessBuilder ProcessBuilder obj = new ProcessBuilder ("rmiregistry","2500"); Process obj_process = obj.start(); The error that i'm getting for using ProcessBuilder when I'm trying to bind to my own RMI registry java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: node_func node_func is an interface Any ideas?

    Read the article

  • Java RMI : connection refused

    - by mihsathe
    I have written following code for the client of RMI. But getting java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused: connect code : import java.rmi.*; import java.net.*; import java.rmi.registry.*; class client { public static void main(String [] ars) { Iface serv; Registry r; String serveraddr = ars[0]; String serverport = ars[1]; String text = "Hey jude"; System.out.println("Sending" + text); try{ r = LocateRegistry.getRegistry( serveraddr, (new Integer(serverport)).intValue() ); serv = (Iface) r.lookup("rmi://server"); serv.receive(text); } catch(Exception e){ System.out.println(e); } } }

    Read the article

  • RMI-applets - Cannot understand error message

    - by aeter
    In a simple RMI game I'm writing (an assignment in uni), I reveice: java.rmi.MarshalException: error marshalling arguments; nested exception is: java.net.SocketException: Broken pipe at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:138) at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178) at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132) at $Proxy2.drawWorld(Unknown Source) at PlayerServerImpl$1.actionPerformed(PlayerServerImpl.java:180) at javax.swing.Timer.fireActionPerformed(Timer.java:271) at javax.swing.Timer$DoPostEvent.run(Timer.java:201) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) at java.awt.EventQueue.dispatchEvent(EventQueue.java:597) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) The error message appears after the second Player is registered with the RMI Server and the server starts to send the image (the array of pixels) to the 2 applets. The PlayerImpl and the PlayerServerImpl both extend UnicastRemoteObject. I have been struggling with other error messages for some time now, but I cannot understand how to troubleshoot this one. Please help. The relevant parts of the code are: PlayerServerImpl.java: ... timer = new Timer(10, new ActionListener() { // every 10 milliseconds do: @Override public void actionPerformed(ActionEvent e) { ... BufferedImage buff_image = new BufferedImage(GAME_APPLET_WIDTH, GAME_APPLET_HEIGHT, BufferedImage.TYPE_INT_RGB); // create a graphics context on the buffered image Graphics buff_g = buff_image.createGraphics(); ... // draw the score somewhere on the screen buff_g.drawString(score, GAME_APPLET_WIDTH - 20, 10); ... int[] rgbs = new int[GAME_APPLET_WIDTH * GAME_APPLET_HEIGHT]; int imgPixelsGrabbed[] = buff_image.getRGB(0,0,GAME_APPLET_WIDTH,GAME_APPLET_HEIGHT,rgbs,0,GAME_APPLET_WIDTH); // send the new state to the applets for (Player player : players) { player.drawWorld(imgPixelsGrabbed); System.out.println("Sent image to player"); } PlayerImpl.java: private PlayerApplet applet; public PlayerImpl(PlayerApplet applet) throws RemoteException { super(); this.applet = applet; } ... @Override public void drawWorld(int[] imgPixelsGrabbed) throws RemoteException { applet.setWorld(imgPixelsGrabbed); applet.repaint(); } ... PlayerApplet.java: ... private int[] world; // an array of pixels for the new image to be drawn ... // register players player = new PlayerImpl(applet); String serverIPAddressPort = ipAddressField.getText(); if (validateIPAddressPort(serverIPAddressPort)) { server = (PlayerServer) Naming.lookup("rmi://" + serverIPAddressPort + "/PlayerServer"); server.register(player); idPlayer = server.sendPlayerID(); ... @Override public void update(Graphics g) { buff_img = createImage((ImageProducer) new MemoryImageSource(getWidth(), getHeight(), world, 0, getWidth())); Graphics gr = buff_img.getGraphics(); paint(gr); g.drawImage(buff_img, 0, 0, this); } public void setWorld(int[] world) { this.world = world; }

    Read the article

  • Spring/RMI server error

    - by 4herpsand7derpsago
    We have a Spring MVC web app (WAR) deploying to Tomcat (6.0.35) that launches a thread inside a separate JVM at deploy time (don't ask why - not my design) and then communicates with that thread via RMI over port 8888. Despite being totally convoluded, this was working perfectly fine up until yesterday, and now the thread is failing at startup and despite our best efforts to add logging into the mix, we are hitting a wall. This is the only exception we are able to find in the logs: Jun 12, 2012 3:11:36 AM com.ourapp.ImageController destroy SEVERE: Shutdown Error: Lookup of RMI stub failed; nested exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is: java.net.ConnectException: Connection refused Jun 12, 2012 3:11:37 AM org.apache.catalina.core.StandardContext listenerStop SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListener java.lang.NoClassDefFoundError: org/springframework/web/context/ContextCleanupListener at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:80) at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:3973) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4577) at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1165) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1271) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:662) Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) ... 12 more The ImageController is the Spring MVC Controller that is responsible for kicking off this daemon/spawned RMI thread. Based on the verbage of this error, does anybody have any idea what might be causing this "connection refused" error? Running a netstat -an | grep 8888 (this is a Linux machine) produces no output which means nothing is listening on that port. Thanks in advance for any ideas/suggestions that lead to a fix. Edit: Here's another ConnectionException we're seeing: Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at java.net.Socket.<init>(Socket.java:375) at java.net.Socket.<init>(Socket.java:189) at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22) at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128) at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595) ... 74 more

    Read the article

  • RMI no such object in table, Server communication error

    - by ben-casey
    My goal is to create a Distributed computing program that launches a server and client at the same time. I need it to be able to install on a couple of machines and have all the machines communicating with each other, i.e. Master node and 5 slave nodes all from one application. My problem is that I cannot properly use unicastRef, I'm thinking that it is a problem with launching everything on the same port, is there a better way I am overlooking? this is part of my code (the part that matters) try { RMIServer obj = new RMIServer(); obj.start(5225); } catch (Exception e) { e.printStackTrace(); } try { System.out.println("We are slave's "); Registry rr = LocateRegistry.getRegistry("127.0.0.1", Store.PORT, new RClient()); Call ss = (Call) rr.lookup("FILLER"); System.out.println(ss.getHello()); } catch (Exception e) { e.printStackTrace(); } } this is my main class (above) this is the server class (below) public RMIServer() { } public void start(int port) throws Exception { try { Registry registry = LocateRegistry.createRegistry(port, new RClient(), new RServer()); Call stuff = new Call(); registry.bind("FILLER", stuff); System.out.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } I don't know what I am missing or what I am overlooking but the output looks like this. Listen on 5225 Listen on 8776 Server ready We are slave's Listen on 8776 java.rmi.NoSuchObjectException: no such object in table at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at Main.main(Main.java:62) line 62 is this ::: Call ss = (Call) rr.lookup("FILLER");

    Read the article

  • Running an RMI registry on one computer and connecting to it from another

    - by Hippopotamus
    Hello. I am doing a student assignment, using java RMI. I've programmed a simple RMI-server application that provides method which return some strings to the client. When I start the server on localhost and connect to it by client on the same computer, everything goes well. However, I am not able to do this between two computers on home network. The computers both have no trouble of connecting by a simple C program with similar functionality, so I guess the problem is with JVM here. I am binding the class to rmiregistry with try{ ComputeImpl R = new ComputeImpl(); Naming.rebind("rmi://localhost/ComputeService",R); } catch(Exception e){ System.out.println("Trouble: " +e); } And I'm doing the lookup for RMI registry in the client application with providing the argument while launching the application: StringBuffer rmi_address = new StringBuffer(); rmi_address.append("rmi://").append(args[1]).append("/ComputeService"); Compute R = (Compute) Naming.lookup(rmi_address.toString()); Is the problem with my code or with JVM? Thanks in advance.

    Read the article

  • Help needed to resolve RMI RemoteException

    - by Gabriel Parenza
    Hello friends, Any idea why do I get RemoteException while trying to invoke methods on Unix machine from Windows. I am inside the network and dont think this is because of firewall problem as I can do "telnet" from Windows to Unix box after starting the RMI server at the unix box. I also could not understand why is it going to local loopback IP? Stack Trace:: RemoteException occured, details java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is: java.net.ConnectException: Connection refused: connect Many thanks in advance.

    Read the article

  • RMI java doesn't create skeleton class

    - by pavithra
    I wrote a remote service MyremoteImpl.java and used following command after compiled it. rmic MyRemoteImpl I learned that this method suppose to create stub class and a skeleton class but I can only see the stub class, why is that? The other problem I faced after run rmiregistry I started the service but it gives following error, I doubt I get this error as I'm missing skeleton class? java.net.MalformedURLException: invalid URL String: Remote Hello at java.rmi.Naming.parseURL(Unknown Source) at java.rmi.Naming.rebind(Unknown Source) at RMIservice.MyRemoteImpl.main(MyRemoteImpl.java:22) Caused by: java.net.URISyntaxException: Illegal character in path at index 6: Remote Hello at java.net.URI$Parser.fail(Unknown Source) at java.net.URI$Parser.checkChars(Unknown Source) at java.net.URI$Parser.parseHierarchical(Unknown Source) at java.net.URI$Parser.parse(Unknown Source) at java.net.URI.<init>(Unknown Source) at java.rmi.Naming.intParseURL(Unknown Source) ... 3 more Please help me to solve this, Thanx in advance!!!

    Read the article

  • Tutoriel Java : Comprendre le fonctionnement de RMI (Remote Method Invocation), par Alain Defrance

    Bonjour, Le RMI (ou Remote Method Invocation) est très souvent utilisé, soit directement, soit dans des couches sous-jacentes. RMI est par exemple utilisé pour exposer des EJB SessionBeans. Notre objectif va être de démystifier RMI en comprenant ses méchanismes. Nous allons analyser comment une invocation à distance est possible en allant jusqu'a implémenter notre propre version allégée de RMI. Bien entendu, afin de nous focaliser sur les objectifs de cet article, certains prérequis sont nécessaires. Aucun rappel sur l'utilisation la gestion d'un réseau en Java ne sera fait. Article disponible ici : http://alain-defrance.developpez.com...2SE/micro-rmi/...

    Read the article

  • How to run RMI in NetBeans?

    - by Samurai
    We can run RMI in netbeans by following steps. Right click build.xml - Run target - Other targets - startRMI But what i need is to start RMI registry through Java code. Is it possible? Help me.

    Read the article

  • JBoss RMI Transaction

    - by EasyName
    Hi, How can i can achieve remote transaction while using Remote EJB (over RMI/IIOP or RMI/JRMP). Is that JBoss 4.0 support this kind of transaction or should i use jotm or atomikos? Thanks in advance

    Read the article

1 2 3 4 5 6 7 8 9  | Next Page >