RMI problem: Naming.unbind() but unused server object still living

F

F C

Good Morning

I have a RMI related question:

Our system:
a web application is running in Tomcat 5,
a RMI registry is started by a shell script

Wa have a fire wall so the remote service object use a particular
supplied port (no anonymous port).

Due to the security architecture,
the service/remote object can not be created
outside of the Tomcat Java Virtual Machines.

So, a servlet in the web application is creating and binding the
remote object:

public void jspInit()
{
service = new ServiceImpl();
Naming.rebind(bindUrl, service);
}


public void jspDestroy()
{
Naming.unbind(bindUrl);
service = null;
System.gc();
}

private Service service;


The problem is the following,
when the servlet is destroyed then reinitialized:
the service instance is unbinded (see method jspDestroy)
but still alive
so when the servlet is reinitialized (see method jspInit)
the new service instance is not binded
because it induces an exception because
it compete for the same non anonymous port with the previous unbinded
service instance.

Port already in use: 13000; nested exception is:
java.net.BindException: Address already in use
java.rmi.server.ExportException: Port already in use: ; nested
exception is:
java.net.BindException: Address already in use
at sun.rmi.transport.tcp.TCPTransport.listen(TCPTransport.java:243)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:

Thank you for any idea

PS:
please reply on the newsgroup
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top