How to Start Java RMI Server Application as Windows NT Service
Hi!!,
I have problem regarding the Installation of Java Application as NT Service this Java app in turn will start RMI Registry using LocateRegistry.createRegistry() at some specific port number. The Service is created successfully but i have problem regarding the Accessing of this Remote Object using Lookup() .(ie) I am able to get the RMI Registry Obj Refererce of the Java Rmi Application but couldn't able to Lookup for the Object registered to this Rmi Registry.I am not able to proceed after getting the Rmi Registry reference.
So any help Regarding this is appreciated.
Thanks in Advance.
with regards,
Ramakrishna M
Mail: [email protected]
Hello,
I have started a Java RMI Server Application as NT Service using JNT (download it from www.eworksmart.com/JNT/ ).
It is working fine.
S. Navaneethakrishnan
[email protected]
Similar Messages
-
How to start and stop Oracle Application Server from ANT
How to start and stop Oracle Application Server and Web application from ANT
Thanks in Advance.
ManiHi,
You can use: startManagedWebLogic.sh, it is in your domain directory and you have to execute it in this way
./startManagedWebLogic.sh managedServerName http://adminServerHost:adminServerPort
For instance, in my case I use:
unixserv01:/webportal/domains/appServerWeb/bin>startManagedWebLogic.sh managedServ01 http://pelma3w3per01.mesaperu.next:7001
You have to run it on the machine where the managed server was installed.
Best regards,
Raúl -
Java.rmi.server.ExportException: Listen failed on port: 1099;
Hi All,
I am trying to run RMI tutorial from sun's java tutorial. It has 8 parts. The last two parts are "Compiling the Example Programs" and "Running the Example Programs".
Until "Compiling the Example Programs", I am okay.
But I am stuck in the last part, "Running the Example Programs". When I use the command "rmiregistry", it gives me a list of exceptions as follows.
c:\home\ann\src>rmiregistry
java.rmi.server.ExportException: Listen failed on port: 1099; nested exception is:
java.net.SocketException: Permission denied: listen failed
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:312)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:218)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:190)
at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92)
at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:78)
at sun.rmi.registry.RegistryImpl.main(RegistryImpl.java:322)
Caused by: java.net.SocketException: Permission denied: listen failed
at java.net.PlainSocketImpl.socketListen(Native Method)
at java.net.PlainSocketImpl.listen(PlainSocketImpl.java:380)
at java.net.ServerSocket.bind(ServerSocket.java:320)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:97)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createServerSocket(RMIDirectSocketFactory.java:27)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createServerSocket(RMIMasterSocketFactory.java:333)
at sun.rmi.transport.tcp.TCPEndpoint.newServerSocket(TCPEndpoint.java:649)
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:299)
... 7 more
c:\home\ann\src>
Then, I try to use "start rmiregistry" command. At that time, a command window stating the above exception popup just for a while and closed automatically.
Now, I use jdk1.6.0_16 on Windows Vista.
Previously, I used j2sdk1.4.2_19. That time, I could run "start rmiregistry" properly and could try testing another RMI example application.
But if I use j2sdk1.4.2_19, compiling some statements in the sun's RMI tutorial gives me error. So, I change to use jdk1.6.0_16 for this tutorial. "jdk1.6.0_16" compiles all programs in the tutorial with no error. But I can't run the statement "start rmiregistry".
I use the command prompt from Vista's default Administrator account and already disable User Account Control too.
Any help, please!
Thanks a lot,
atzm111Hi,
This is the result of netstat -an
c:\home\ann\src>netstat -an
Active Connections
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:2868 0.0.0.0:0 LISTENING
TCP 0.0.0.0:3999 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING
TCP 192.168.1.102:139 0.0.0.0:0 LISTENING
TCP 192.168.1.102:49475 64.233.189.17:80 ESTABLISHED
TCP 192.168.1.102:49620 64.233.189.83:80 ESTABLISHED
TCP 192.168.1.102:49625 72.5.124.102:80 ESTABLISHED
TCP 192.168.1.102:49626 72.5.124.102:80 ESTABLISHED
TCP 192.168.1.102:49627 72.5.124.102:80 ESTABLISHED
TCP 192.168.1.102:49628 72.5.124.102:80 ESTABLISHED
TCP 192.168.1.102:49629 72.5.124.102:80 ESTABLISHED
TCP 192.168.1.102:49631 72.5.124.61:80 TIME_WAIT
TCP 192.168.1.102:49634 124.155.222.16:80 ESTABLISHED
TCP [::]:135 [::]:0 LISTENING
TCP [::]:49152 [::]:0 LISTENING
TCP [::]:49153 [::]:0 LISTENING
TCP [::]:49154 [::]:0 LISTENING
UDP 0.0.0.0:123 *:*
UDP 0.0.0.0:500 *:*
UDP 0.0.0.0:4500 *:*
UDP 0.0.0.0:5355 *:*
UDP 127.0.0.1:1900 *:*
UDP 127.0.0.1:51196 *:*
UDP 127.0.0.1:64757 *:*
UDP 192.168.1.102:137 *:*
UDP 192.168.1.102:138 *:*
UDP 192.168.1.102:1900 *:*
UDP 192.168.1.102:51195 *:*
UDP [::]:123 *:*
UDP [::]:500 *:*
UDP [::]:5355 *:*
UDP [::1]:1900 *:*
UDP [::1]:51193 *:*
UDP [fe80::100:7f:fffe%16]:1900 *:*
UDP [fe80::100:7f:fffe%16]:51194 *:*
UDP [fe80::18c1:1fa4:382b:261%12]:1900 *:*
UDP [fe80::18c1:1fa4:382b:261%12]:51191 *:*
UDP [fe80::69bc:321e:5e99:dc7c%11]:1900 *:*
UDP [fe80::69bc:321e:5e99:dc7c%11]:51192 *:*
UDP [fe80::a0a0:89c2:b2fd:e4b9%13]:1900 *:*
UDP [fe80::a0a0:89c2:b2fd:e4b9%13]:51190 *:*
c:\home\ann\src>
So, port 1099 is not in use. I don't know how to check your second fact. I'll find it out coz I can't ask you. :D
Thanks! -
I have write RMI program the problem it's that I don't now how to start it
This is my Interface
import java.rmi.*;
import java.rmi.Remote;
public interface DataInterface extends Remote {
public String testRemote() throws RemoteException ;
This is my server
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
public class DataServer extends UnicastRemoteObject implements DataInterface {
DataServer() throws RemoteException{
super();
public String testRemote() throws RemoteException{
return "Merge obiectul remote";
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
try{
//LocateRegistry.createRegistry(1099);
DataServer testServer = new DataServer();
Naming.rebind("//localhost/SERVER", testServer);
}catch(Exception e){
e.printStackTrace();
This is my client
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;
public class DataClient {
public static void main(String[] args) {
System.setSecurityManager(new RMISecurityManager());
try{
Remote remoteServer = Naming.lookup("//localhost/SERVER");
DataServer server = (DataServer)remoteServer;
System.out.println(server.testRemote());
} catch(Exception e){
e.printStackTrace();
And this is my policy file
grant {
permission java.net.SocketPermission "*:1024-65535",
"connect,accept";
permission java.net.SocketPermission "*:80", "connect";
All this files are in c:\temp and this directory is in my PATH variable. I've compilated the interface, server, client with
javac -classpath file.java
After that I generate with rmic the stub skel file in c:\temp. In this point I have all the files that I need. If is somebody kind to tell me from now what do I have to do to make this program work :)). Thanks for any help.so..u have everything ready..
open cmd prompt and say 'start rmiregistry' - >this opens a new cmd prompt for rmi registry.let it run
now first run ur server by saying 'java DataServer' // include options as u like. this should be running without terminating.
now open new cmd prompt for ur client and say 'java DataClient '.
thats all.
if you want to run the client from a different machine, then try copying the client file into another m/c after changing the code from 'localhost' to the ip address of the server m/c. then just say 'java DataClient '
hope this works fine! -
How to Convert an RMI Server into WINNT service
I have an RMI Server, that looks like the following
SimpleRMIServer.java
import java.io.*;
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
public class SimpleRMIServer
public static void main(String[] argv) {
System.setSecurityManager(new RMISecurityManager());
try {
LocateRegistry.createRegistry(1099);
SimpleRMIImpl implementation = new SimpleRMIImpl("SimpleRMIImpl instance");
// SimpleRMIImpl implementation = new SimpleRMIImpl("SimpleRMIImpl instance");
System.out.println("SimpleRMIImpl ready");
catch (Exception e) {
System.out.println("Exception occurred: " + e);
the SimpleRMIImpl.java also is available. (SimpleRMIImpl.class)
now the problem is how to convert this Server to a service.
I have seen a java class that extends a service class have been converted to a service like the following
TestService.java
// TestService.java
// (C) Copyright 1995 - 1999 Microsoft Corporation. All rights reserved.
import java.io.*;
import com.ms.service.*;
public
class TestService extends Service
static
// Uncomment to disable the assassin. The service will fail to respond
// in the time specified in the last waithint for the third pause
// event received. If the assassin is enabled (i.e. this line is commented
// out, the default), then the service will be forcibly killed.
//Service.disableassassin = true;
int pausecount;
int intcount;
public TestService (String[] args) throws IOException
System.out.println("Sending updated pending status");
CheckPoint(1000);
System.out.println("Sending running status with all controls");
setRunning(ACCEPT_SHUTDOWN | ACCEPT_PAUSE_CONTINUE | ACCEPT_STOP);
System.out.println("Started");
protected
boolean handleStop ()
setStopping(5000);
System.out.println("dying");
return true;
protected
boolean handlePause ()
pausecount++;
if (pausecount == 3)
System.out.println("pause #3, sleeping for 30 seconds, should be killed in 2+5 seconds");
setPausing(2000);
try
Thread.sleep(30000);
catch (InterruptedException e)
System.out.println("interrupted");
else
System.out.println("received pause #"+pausecount+", pausing for 2 seconds");
setPausing(5000);
try
Thread.sleep(2000);
catch (InterruptedException e)
System.out.println("interrupted");
System.out.println("sending paused");
setPaused();
System.out.println("sent paused");
return false;
protected
boolean handleContinue ()
System.out.println("received continue, continuing after 2 seconds");
setContinuing(5000);
try
Thread.sleep(2000);
catch (InterruptedException e)
System.out.println("interrupted");
System.out.println("sending running");
setRunning();
System.out.println("sent running after continue");
return false;
protected
boolean handleShutdown ()
System.out.println("received shutdown, treating as stop");
return handleStop();
protected
boolean handleInterrogate ()
System.out.println("received interrogate");
setServiceStatus(getServiceStatus());
System.out.println("sent status for interrogate");
intcount++;
if (intcount == 3)
System.out.println("received 3rd interrogate, stopping self in 5 seconds");
try
Thread.sleep(5000);
catch (InterruptedException iex)
System.out.println("interrupted");
System.out.println("stopping");
StopServiceEventHandler(1000);
return false;
using the jntsvc.exe tool, that code have been converted to an executable, then installed as a service.
I've tried to embed the RMIServer code in the constructor for this service, but it didn't work
Hope you have a clear understanding of what I'm saying
any help, highly appreciated
thanx in advance
here is my email [email protected]
regardsOur second installment of "Questions from the Past"
Dear viewer, check out Tomcat's source, I believe they implement Tomcat as a service so just follow what they did.
Steve - your answer Guru
Tune in next week for our third installment of "Questions from the past" -
Dynamically changing java.rmi.server.hostname
Hi all,
I am trying to change the java.rmi.server.hostname value dynamically to force my rmi stubs to be exposed on a particular ip
The java app is started with a default value of 172.30.30.200 for the java.rmi.server.hostname attribute using the -D parameter. Before the binding is done, I set the value of the java.rmi.server.hostname in the system properties to localhost and then call the rebind (code snippet below).
After this, if I use a jndi browser, I do not see the entries for the localhost. However, I see the entries for 172.30.30.200.
The release notes for 1.4.2 and 1.5.0 indicate that this attribute can be changed dynamically; does not say how though.
http://java.sun.com/j2se/1.4/docs/guide/rmi/relnotes.html
Can anyone give me an idea as to what is happenning.
Thanks a lot for your help
Properties currentProperties = System.
String ipAddr = "localhost";
currentProperties.put("java.rmi.server.hostname", ipAddr);
System.setProperties(currentProperties);
UnicastRemoteObject.exportObject(this);
InitialContext ctx=new InitialContext();
ctx.rebind(getObjectName().toString(), this);java.rmi.server.hostname should be set to whatever hostname or IP address the client should use when trying to connect to the server. It only needs to be set in JVMs which export remote objects, i.e. in server JVMs.
-
Starting the RMI server on Windows
Hi
I am just trying to use the three files in suns tutorial: http://java.sun.com/javase/6/docs/technotes/guides/rmi/hello/hello-world.html
Hello.java - a remote interface
Server.java - a remote object implementation that implements the remote interface
Client.java - a simple client that invokes a method of the remote interface
I have started the rmiregistry by running "start rmiregistry" in the java bin directory. There is no output in this window, i hope this is correct.
But when I try to run the server I get the following message:
Server exception: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: Hello
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: HelloI'm suspecting it has to do with the codebase parameter that I have omitted. But even if I try to add it I can't seem to figure out a way for it to start.I have started the rmiregistry by running "start rmiregistry" in the java bin directory. There is no output in this window, i hope this is correct. This is correct.
I'm suspecting it has to do with the codebase parameter that I have omitted.Omitted from what?
But even if I try to add it I can't seem to figure out a way for it to start.'It' being what?
The RMI 'codebase' is a list of URLs where classes can be found. You define it in your server JVM via the java.rmi.server.codebase property. Normally the URLs are http: URLs, which means you need an HTTP server which will serve classes or JAR files from the specified URLs.
Alternatively you can:
(a) start the client with a classpath that contains the classes mentioned in the remote interface, including itself, and
(b) (i) start the Registry ditto, or
(b) (ii) start the Registry inside the server JVM via LocateRegistry.createRegistry. -
Java.rmi.server.ExportException: while stopping weblogic Managed server
Hello,
I am getting the below error while I try to stop the weblogic managed server from the stop script in the server. I am able to do it thru the console.
the weblogic version is 9.23.
-server -Xms1536m -Xmx1536m
Stopping Weblogic Server...
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 9990; nested exception is:
java.net.BindException: Address already in use
I am a newbie , so anyone could help me figure out the things I need to check so that I can troubleshoot the issue?
thanks in advance.Are you using a custom script or <domain>/bin/stopManagedWebLogic.sh ?
The msg you've informed seems to be an error that happens when you try to start a managed server that is trying to use a port that is already in use. -
My RMI Server application Not work under Linux: Exception: Connection reset
Under Red Hat Linux 8.0 my RMI server application, when I try to bind the Impl class, sends me the exception:
"java.rmi.UnmarshalException: Error unmarshaling return header;
nested exception is: java.net.SocketException: Connection reset".
And it works under Windows 2000 without any problem.
What could it be?
Many thanks,
Ales.Hi Ales,
Try to change your /etc/hosts file, and change the line that says :
127.0.0.1 MDK localhost.localdomain localhost
(where MDK is the machine's name).
Remove MDK from this line and add a new one mapping it to a 'real' outside IP address, visible (check firewall!!!) to the network from where you are approaching the Linux Box
Good luck,
Aart -
About java.rmi.server.UnicastRemoteObject
Hi friends
Just now I started studying about RMI. In Implementing Remote Interface class we extends java.rmi.server.UnicastRemoteObject class we also have java.server.RemoteObject also why we specifically extends UnicastRemoteObject what is the significance of it
can anyone help me plz
thank uUnicastRemoteObject is a base class that can make your object a remote object. (If you create an object that DOESN'T extend UnicastRemoteObject, then it's methods cannot be accessed remotely.
-
I install oracle 9ias 9.0.3,but i don't know how to start the oc4j server.
thanks for any help?hi
Refer "Starting and Stopping OC4J" from
http://otn.oracle.com/tech/java/oc4j/doc_library/902/A95880_01/html/toc.htm
hope this helps.
shrini -
How to start 2 RMI servers on same machine ??
Hello friends,
I am developing databackup project USING RMI
i want to start servers on same machine and client may be on different machine.
we tried it used as on different port . but it stil not working.
so can u provide me solution for that ,
how to start that two server on the same machine. ?
reply me soon
thanksGhanshyam,
It is possible to run multiple RMI servers as long as the port is different. For instance if you run the RMI daemon using port 2700:
rmid -port 2700and RMI daemon using port 2800:
rmid -port 2800You will see these ports open if you do an nmap or netstat -aMake sure you bind your separate RMI instances on separate ports when calling Naming.bind()Anthony
Message was edited by:
abargnesi
Message was edited by:
abargnesi -
Java.rmi.server.ExportException...
I am making a bridge code.
the server is in a package called bridgeserver.
The client in a package called bridgeclient.
I have compiled all files in the packages.
I do rmic bridgeserver.BridgeServer(name of server program) from jdk1.3
I do c:\jdk1.3 >rmic bridgeclient\BridgeClient(name of client).
then start rmiregistry
then when I do java bridgeserver.BridgeServer(runnign thr server) I get the follwowing exceptions:
java.rmi.server.ExportException : Unable to access remote reference,
nested exception is
java.rmi.server.SkeletonNotFoundException:
Skeleton class not found :bridgeserver.BridgeServer_Skel;nested exception is ;
java.lang.ClassNotFoundException :bridgeserver.BridgeServer-Skel
Is there sometyhign wrong with the classpath?on your rmic line include the option
-v1.2
This should get rid of skeleton junk. (But of course may uncover other problems.) -
Reading java.rmi.server.hostname property
When try to read java.rmi.server.hostname property within my server I got following exception:
Exception in thread "main" java.security.AccessControlException: access denied (
java.util.PropertyPermission java.rmi.server.hostname read)
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.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at engine.ComputeEngine.main(ComputeEngine.java:22)
Any idea how to read this property from program.
SyedLooks as if you need to create a security manager or add a security policy file.
To create a security manager, add:
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
to the server's 'main' method.
Then, at program startup, pass in a security policy file:
java ... -Djava.security.policy=[<pathname>]security.policy [<classpath>]/<RMI server name>
Where the file security.policy might contain:
grant {
// Allow everything for now
permission java.security.AllPermission;
Amoong other privileges. -
I'm trying to run an RMI application (under Windows XP, one machine for client and server) like this:
at server side:
java -Djava.rmi.server.codebase=file://\..\..\..\j\ -Djava.security.policy=file:.\polityka.txt sss
- and it works fine, but at client side:
java -Djava.security.policy=file:.\polityka.txt -Djava.rmi.server.codebase=file://\..\..\..\j\ kkk
results in:
Exception in thread "main" java.lang.NoClassDefFoundError: PrzykladowaKlasa
at kkk.main(kkk.java:31)
when I'm listing directory (at client side) got with System.getProperty("java.rmi.server.codebase") i get this
file://\..\..\..\j\
OdleglaKlasa_Stub.class
PrzykladowaKlasa.class
Folder Structure is:
|------j\
| |------(*_Stub.class, and ClassNeededByClient.class)
|------2\
| |------Server\
| | |------(serwer files)
| |------Klient\
| | |------(klient files)
I'm fresh in RMI and Codebase poperty, but with some exp with Java...
(policy files are allright - grant {permission java.security.AllPermission;};)
Any help will be appreciated.I've come back to this issue again (since I am moving code around to different systems again). Using linux I can use -Djava.rmi.server.codebase=file://$PWD/build/
Presumably there is a similar command in WIndows.
Maybe you are looking for
-
Is there a way to create a function that concatenates
Hello, I constantly find myself needing to create a forumla tha concatenates employee's ID, last name, and first name. Is there a way to create a function in Crystal that will allow me to create a function that already has this concatenation in plac
-
I have a table this table contains 2 group ( group for company x and group for company y) I connect the table with list to let list box show the data of the table but I want to add a line separation between 2 groups of the table I add the record betw
-
Material Master for Creating new MM Transaction for creating material
hai techies, i have a scenario where the client is already using a transaction to catch the related fields like material number, quantity and other related fields. but until now they have been using this as a central source of point to create a mater
-
Hi, Can anyone point me to some general documentation on BEA Weblogic i18n? Thanks
-
Download EBS 12.1.3
Hi All, Can I download EBS 12.1.3 from edelievery.oracle.com. On Edelivery 12.1.1 is avlable. Or do I need to apply patches on 12.1.1 to increase path level to 12.1.3 Thanks,