Incidencia #12411

RMI lookup method fails.
Abrir Fecha: 2008-04-25 22:18 Última actualización: 2008-05-07 08:29

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
(Ninguno)
Hito:
(Ninguno)
Prioridad:
9 - Highest
Gravedad:
5 - Medium
Resolución:
Fixed
Fichero:
2

Details

Hi,

I'm implementing a RMI Client on my Pocket PC.
When I try to look up a service to execute a remote
method, the java virtual machine crashes.
I would really appreciate you take a look at this
possible bug.

Here is the code:
try {
Registry registry =
LocateRegistry.getRegistry("192.168.2.102"); //works fine
final String[] lista = registry.list(); //works fine
final TPVTagReceiver stub = (TPVTagReceiver)
registry.lookup("myservice"); //fails :(
stub.lecturaTag("example");

} catch (Exception e1) {
System.out.println(e1);
}


The jvm generated error file is attached.

Thank you.
Bye.

Ticket History (3/9 Histories)

2008-04-25 22:18 Updated by: miguel
  • File 2298: errF801.tmp is attached
2008-04-26 09:22 Updated by: freebeans
  • Resolución Update from Ninguno to Accepted
Comentario
Logged In: YES
user_id=14530

Thank you for your bug report.
The error occurred in ClassLoader.
I want to investigate the cause of this problem.
Would you upload source code to reploduce bug, please.
2008-04-26 09:23 Updated by: freebeans
  • Propietario Update from (Ninguno) to freebeans
2008-04-28 17:04 Updated by: miguel
  • File 2302: Server.java is attached
Comentario
Logged In: YES
user_id=34389

Here is the code:

//------------ SERVER ------------------------

import java.io.File;
import java.io.IOException;
import java.rmi.AccessException;
import java.rmi.AlreadyBoundException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;

public class Server implements Stub{

private static Registry registryLocal = null;
public static final String flagFile = "FLAG_FILE";

public Server(){
super();
}


public static void main(String[] args) {

final File file = new File(flagFile);
//Remember to lanuch rmiregistry command!:D
if(launchRMIServer()){
try {
if(file.createNewFile()){
while(file.exists()){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}else{
System.out.println("Could not create the flag file");
}
}catch (IOException e1){
e1.printStackTrace();
}
}else{
System.out.println("RMI Server failed!");
}
}

public static boolean launchRMIServer(){

//Set the path where the RMI server will find the codebase
boolean launchRMIServerOK = false;
final String userDir = System.getProperty("user.dir");
final File fileUserDir = new File(userDir);
final String pathRMI = fileUserDir.toURI() +
File.separator + "bin" + File.separator;
//PathRMI: current directori/bin/
System.setProperty("java.rmi.server.codebase", pathRMI);

try {
final Stub stub = (Stub)
UnicastRemoteObject.exportObject(new Server(), 0);
registryLocal = LocateRegistry.getRegistry();

//Unbind the service
try {
registryLocal.unbind("myservice");
} catch (NotBoundException e) {}

//Registry the service
registryLocal.bind("myservice", stub);
launchRMIServerOK = true;

} catch (AccessException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (AlreadyBoundException e) {
e.printStackTrace();
}

return launchRMIServerOK;
}

public void lecturaTag(String id) throws RemoteException {
//just print the message sent by the client
System.out.println("Message sent: " + id);
}
}


//------------ SERVER STOP ------------------------
import java.io.File;

public class StopServer {

/**
* @param args
*/
public static void main(String[] args) {
final File file = new File(Server.flagFile);
if(file.exists()){
if(!file.delete()){
System.out.println("Could not delete the flag file!");
}
}

}
}

//------------ STUB ------------------------
import java.rmi.Remote;
import java.rmi.RemoteException;

public interface Stub extends Remote {

void lecturaTag(String id) throws RemoteException;
}

//------------ CLIENT ------------------------
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class Client {

public static void main(String[] args) {
try {
Registry registry =
LocateRegistry.getRegistry("192.168.2.102"); //works fine
String[] list = registry.list(); //works fine
Stub stub = (Stub) registry.lookup("myservice"); //fails :(
stub.lecturaTag("example");
} catch (Exception e1) {
System.out.println(e1);
}
}
}

Don't hesitate to ask me any question.
2008-04-29 10:42 Updated by: freebeans
Comentario
Logged In: YES
user_id=14530

Thank you. I'll investigate the cause of the problem with
your code.
2008-04-29 15:16 Updated by: freebeans
  • Resolución Update from Accepted to Fixed
Comentario
Logged In: YES
user_id=14530

Fixed.
I'll release fixed module as Version 0.3.8.
2008-05-02 09:08 Updated by: freebeans
  • Prioridad Update from 5 - Medium to 9 - Highest
2008-05-05 17:17 Updated by: miguel
Comentario
Logged In: YES
user_id=34389

Thank you so much for fixing the bug. Now, i'm just
wondering when the fixed version will be released.
2008-05-07 08:29 Updated by: freebeans
  • Ticket Close date is changed to 2008-05-07 08:29
  • Estado Update from Open to Cerrado

Attachment File List

Editar

Please login to add comment to this ticket » Entrar