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");
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.
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);
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!");
}
}
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.