|
From: David D. <hap...@hu...> - 2006-09-12 13:48:40
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content=3D"text/html;charset=3DGB2312" http-equiv=3D"Content-Type=
">
<title></title>
</head>
<body bgcolor=3D"#ffffff" text=3D"#000000">
Sharedata,<br>
<br>
Instead of explicitly starting a registry service, I u=
se the
following bit of code (it's generally available in tutorials) for m=
y
services.<br>
<br>
It works out pretty well because the first service to =
start will
automatically create its own registry. Following services will use =
the
same registry if they use the same port number.<br>
<br>
<br>
public void exportService() throws RemoteException {<b=
r>
System.out.println("Exporting =
Service...");<br>
//reProps is a local Propert=
ies object that holds my
configuration settings.<br>
//I use this so that I can c=
ontrol my server applications in
a *nix like manager (edit the configuration with a text editor, then<br>
//restart the service.<br>
//Use the given port setting=
"port=3D" or 1099 by default.<br>
int port =3D Integer.parseInt(=
reProps.getProperty("port","1099"));<br>
System.out.println("\tUsing po=
rt "+port);<br>
Registry r;<br>
try {<br>
//First, attemp=
t to get an existing registry.<br>
System=
.out.println("\tAttempting to use existing service
Registry.");<br>
r =3D =
LocateRegistry.getRegistry(port);<br>
System=
.out.println("\tRegistry found; exporting service.");<br>
r.rebi=
nd(getName(), this);<br>
} catch (RemoteException ex) {=
<br>
//If we got her=
e, couldn't get a local registry (usually
because it doesn't exist yet.<br>
System=
.out.println("\tNo existing Registry; creating local
Registry.");<br>
r =3D =
LocateRegistry.createRegistry(port);<br>
System=
.out.println("\tRegistry created; exporting
service.");<br>
r.rebi=
nd(getName(), this);<br>
}<br>
System.out.println("Service ex=
ported as "+getName()+" on port
"+port);<br>
}<br>
<br>
I've had good success with this code under JSWrapper, and it works well
as cross-platform, too.<br>
<br>
Let me know if this helps.<br>
David Days<br>
<br>
sharedata wrote:
<blockquote
cite=3D"mid...@we..."
type=3D"cite">
<div>I am using windows XP. I'ld like to start rmiregistry in
background and not in a command window on the task bar. How can I do it?<=
/div>
<p> __________________________________________________<br>
=B8=CF=BF=EC=D7=A2=B2=E1=D1=C5=BB=A2=B3=AC=B4=F3=C8=DD=C1=BF=C3=E2=B7=D1=D3=
=CA=CF=E4?<br>
<a class=3D"moz-txt-link-freetext" href=3D"http://cn.mail.yahoo.com">http=
://cn.mail.yahoo.com</a>
</p>
<pre wrap=3D"">
<hr size=3D"4" width=3D"90%">
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job ea=
sier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronim=
o
<a class=3D"moz-txt-link-freetext" href=3D"http://sel.as-us.falkag.net/se=
l?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D121642">http://sel.as-us.falk=
ag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D121642</=
a></pre>
<pre wrap=3D"">
<hr size=3D"4" width=3D"90%">
_______________________________________________
Wrapper-user mailing list
<a class=3D"moz-txt-link-abbreviated" href=3D"mailto:Wrapper-user@lists.s=
ourceforge.net">Wra...@li...</a>
<a class=3D"moz-txt-link-freetext" href=3D"https://lists.sourceforge.net/=
lists/listinfo/wrapper-user">https://lists.sourceforge.net/lists/listinfo=
/wrapper-user</a>
</pre>
</blockquote>
</body>
</html>
|