Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RMI server Solaris issue ?!

 
herve attia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I tried to run the RMI SERVER developed under Windows2000 on solaris.
When I run like this , it works :
java -Djava.security.policy=FBN.policy -Djava.rmi.server.codebase=file:server.jar -jar server.jar -host localhost
but It uses the host name or IP address...I got the following
java -Djava.security.policy=FBN.policy -Djava.rmi.server.codebase=file:server.jar -jar server.jar -host titan
Data Server exception: Transport protocol not supported by server
java.rmi.MarshalException: Transport protocol not supported by server
at
sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:208)
at
sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:174)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:318)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at
suncertify.server.DataServer.main(suncertify/server/DataServer.java:366)

I bind my object as following :
...
//build the naming binding name
String name = "//" + host + ":" + port +"/DataServer";

// Create instance of DataRemote
DataServer engine = new DataServer(dbname, threadSafe, trace);
//bind the Data remote object to the RMI registry
Naming.rebind(name, engine);
Any clues will be appreciated.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I am not too good at these, but it is a Marshalling error, which leads me to go down the permissions/policy file route. What is in your policy file?
Wait a second. You are running the server. Why do you have to give it an IP or server name? It is the client that needs to give the IP address or server name to know where to look for the server.
The server automatically gets the IP address/server name of that machine.
This is the code I had

but you might have needed the hostname and port to change the port.
Oh well, I said that this wasn't me strong suit
When things aren't my strong suit, I tend to go the easy way out, and keeping at simple as possible. That's why I didn't care that it used the default port.

Mark
[ February 08, 2002: Message edited by: Mark Spritzler ]
 
herve attia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark,
My policy file grants all the permission.
grant {
// Allow everything for now
permission java.security.AllPermission;
};

My understanding with RMI is when you bind the object to the registry, you need to specify the host name and the port. if you do not mention them, RMI will take the default value : localhost and 1099 .
So, and any case, we could build the bind name as following :

String name = "//" + host + ":" + port +"/DataServer";

DataServer engine = new DataServer(dbname, threadSafe, trace);
//bind the Data remote object to the RMI registry
Naming.rebind(name, engine);


Does anyone use this approach ?
Or maybe, we should do as following (I have not tried yet):

String name = "//DataServer";
DataServer engine = new DataServer(...);
Naming.rebind(name, engine);

rmiregistry <port>
java -Djava.security.policy=FBN.policy
-Djava.rmi.server.codebase=file:server.jar
-Djava.rmi.server.hostname=<hostname>
-jar server.jar

thanks
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

String name = "//DataServer";
DataServer engine = new DataServer(...);
Naming.rebind(name, engine);

That like what I did.

It automatically takes the default port. As far as host being localhost, well isn't that what you want anyway. Meaning you want it on the machine your are running your server on.
There can still be a name like RMI://myServer.com/MyEngine for the client
the myServer.com is in the DNS Server. But don't worry about that having the Assessor type in a direct IP Address is fine.
Mark
 
herve attia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark,
I have a question regarding your approach :

String userDirectory = System.getProperty("user.dir"); Data database = new Data(userDirectory + "//db.db"); String connectionName = "connectionFactory"; connectionFactory.FBNDatabase = database; server.setStatus("Binding Connection Factory"); Naming.rebind(connectionName, connectionFactory);


Do you start the registry within the server program (LocalRegistry API)?
If not, How do you set the port for the binding process ?
My understanding is if you start the registry with a different port on command line (start rmiregistry <1000> ) , we should set the binding name as following :
String name = "rmi://:" + port +"/connectionFactory";
Actually, I made those modifications (not yet tested on networked environment):


Properties systemProperties =
new Properties( System.getProperties() );
systemProperties.put("java.rmi.server.hostname", host);
System.setProperties(systemProperties);

//install a security manager
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}

String name = "DataServer";
DataServer engine = new DataServer(...);
Registry myRegistry = LocateRegistry.createRegistry(port );
myRegistry.rebind( name, engine);

It is working locally ....
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of line sbefore what I had posted I have the line

and in the server I never had to have "rmi://localhost:1099/connectionFactory
just "connectionFactory"
Mark
 
herve attia
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I fixed all the issue on networked Unix environment.
I configured my server as following :
--------------------------------------
DataServer engine = new DataServer(...);

Registry myRegistry = LocateRegistry.createRegistry(port );
myRegistry.rebind( "DataServer", engine);

and the client :
------------------
name = "rmi://" + host + ":" + port +"/DataServer";
dc = (DataRemote) Naming.lookup(name);

I don't know if it is related to Unix platform, but if I set the name as "//" + host + ":" + port +"/DataServer" rather than "rmi://" + host + ":" + port +"/DataServer";
I got the "Transport protocol not supported by server " error ?!
Anyways, I guess it is really important to test under Unix (Font system different)....I don't really think that Sun examiner works with Windows platform
Regards,
herve
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic