Ticket #12411

RMI lookup method fails.
Eröffnet am: 2008-04-25 22:18 Letztes Update: 2008-05-07 08:29

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
(Keine)
Meilenstein:
(Keine)
Priorität:
9 - Höchste
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
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-Verlauf (3/9 Historien)

2008-04-25 22:18 Aktualisiert von: miguel
  • File 2298: errF801.tmp is attached
2008-04-26 09:22 Aktualisiert von: freebeans
  • Lösung Update from Keine to Accepted
Kommentar
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 Aktualisiert von: freebeans
  • Verantwortlicher Update from (Keine) to freebeans
2008-04-28 17:04 Aktualisiert von: miguel
  • File 2302: Server.java is attached
Kommentar
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 Aktualisiert von: freebeans
Kommentar
Logged In: YES
user_id=14530

Thank you. I'll investigate the cause of the problem with
your code.
2008-04-29 15:16 Aktualisiert von: freebeans
  • Lösung Update from Accepted to Gefixt
Kommentar
Logged In: YES
user_id=14530

Fixed.
I'll release fixed module as Version 0.3.8.
2008-05-02 09:08 Aktualisiert von: freebeans
  • Priorität Update from 5 - Mittel to 9 - Höchste
2008-05-05 17:17 Aktualisiert von: miguel
Kommentar
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 Aktualisiert von: freebeans
  • Ticket Close date is changed to 2008-05-07 08:29
  • Status Update from Offen to Geschlossen

Dateianhangliste

Bearbeiten

Please login to add comment to this ticket » Anmelden