Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  RemoteException in RMI: cant bind my server  (Read 919 times)
0 Members and 1 Guest are viewing this topic.
Offline Serethos

Junior Member




Java games rock!


« Posted 2006-02-14 13:10:58 »

Im very sad. Although im not very trained in using rmi this example worked yesterday
with little modifications. its just a very basic rmi program:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
/**
* Remote Interface
*/

import java.rmi.Remote;
import java.rmi.RemoteException;

public interface IRemote extends Remote
{
    public void test() throws RemoteException;
}


/**
* Server
*/

import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

public class HelloServer extends UnicastRemoteObject implements IRemote
{
    public HelloServer() throws RemoteException
    {
        super();
    }

    public void test() throws RemoteException
    {
       System.out.println("REMOTE CALL");
    }

    public static void main(String args[])
    {
        try
        {
            if (System.getSecurityManager() == null)
            {
                System.setSecurityManager(new RMISecurityManager());
            }

            HelloServer h = new HelloServer();
            Naming.rebind("rmi://localhost/Hello", h);

            System.out.println("[DerServer]registrierte Objekte nach dem Binden");
           
            for (int i = 0; i < Naming.list("rmi://localhost/").length; i++)
            {
                System.out.println("[Server] "+ Naming.list("rmi://localhost/")[i]);
            }

            System.out.println("[Server] ready.");
        } catch (Exception re)
        {
            System.out.println("Exception: " + re);
        }
    }
}


The problem is that i get this exception thrwon by the rebind() method:
1  
2  
3  
Exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
   java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
   java.lang.ClassNotFoundException: IRemote


Im using Eclipse 3.1 and Java 1.5 (so no rmic). Moreover im using as vm Arguments for Eclipse
1  
2  
-Djava.security.policy=grant_all.policy
-classpath .


the rmiregistry is running and working, if i dont implement the remote interface i can call it
using Naming.<...>

Why the **** hell cant it find the IRemote interface ?!
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #1 - Posted 2006-02-15 02:23:12 »

Just make sure that any class that you are trying to use remotely is Searlizeable.  If you can't figure out which one, just make them all Serializeable until you figure it out.  That is usually the cause of the UnmarshalException

Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2006-02-15 05:49:55 »

It cant find IRemote because ist not available to the remote machine.  It has to be available either locally in the classpath or through a URL accessible source to both machines

This can be for a numerb of reasons:

(1) YOu dont have a Jar with IRemote in the classpath on  the remote mach9ne
(2) You DO have a Jar with IRemote in the classpath but its bot the same version as the one on the sending machine.
(3) You arent getting it on the cleitn side froma  URL that is accessible to the server.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #3 - Posted 2006-02-15 05:50:30 »

Not entirely sure why we are even dicussing RMi here though,.

RMI is pretty usless for games and certaonly more trouble then its worth.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Serethos

Junior Member




Java games rock!


« Reply #4 - Posted 2006-02-15 11:28:42 »

ok, problem is solved, but im not really sure why:

i have to mention that for test purposes my rmi client/server-pait is _one_ eclipse project
and shares the same /bin directory. the problem seemed to be, that i didnt define the
-Djava.rmi.server.codebase="file:/ (...)" vm-argument.
i only gave the vm the location of the security-property file and a normal classpath.

what i can not understand is that im using the rmi.server.codebase argument the first
time but i already ran the example. i cant see a difference ...
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (20 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!