banner

[Rule] Rules  [Home] Main Forum  [Portal] Portal  
[Members] Member Listing  [Statistics] Statistics  [Search] Search  [Reading Room] Reading Room 
[Register] Register  
[Login] Loginhttp  | https  ]
 
Forum Index Thảo luận hệ điều hành *nix Lỗi khi chạy RMI trong Ubuntu  XML
  [Question]   Lỗi khi chạy RMI trong Ubuntu 16/09/2009 03:39:13 (+0700) | #1 | 192876
eyestv
Member

[Minus]    0    [Plus]
Joined: 09/05/2008 13:55:20
Messages: 67
Offline
[Profile] [PM]
Em đang test 1 ứng dụng Java RMI

code thế này

Code:
import java.rmi.*;
public interface Calculator extends Remote 
{
 public int addNum(int x,int y) throws RemoteException;
}


Code:
import java.rmi.*;
public class CalculatorImpl implements Calculator 
{
	public int addNum(int x,int y) throws RemoteException
	{
	System.out.println("Client request to calculate");
	return (x+y);	
	}
}


Code:
import java.rmi.*;
import java.rmi.server.*;
public class CalculatorServer 
{
 public static void main (String args[])
 {
	 try
	 {
		 CalculatorImpl c = new CalculatorImpl();
		 System.out.println("Exporting Calculator...");
		 UnicastRemoteObject.exportObject(c);
		 Naming.bind("rmi://localhost/MyCalculator",c);
		 System.out.println("Register Calculator!");
	 }
	 catch (Exception e)
	 {
		 System.out.println(e);
	 }
 }
}


Em dùng Eclipse (đã add Plug-in RMI). Run thì nó chạy ra lỗi này

Code:
Exporting Calculator...
java.rmi.StubNotFoundException: Stub class not found: CalculatorImpl_Stub; nested exception is: 
	java.lang.ClassNotFoundException: CalculatorImpl_Stub


Em đã search, do chưa set CLASSPATH. Nhưng sau khi set CLASSPATH. Vẫn ko được.

Code:
echo $JAVA_HOME
/usr/lib/jvm/java-6-sun
echo $CLASSPATH
/usr/lib/jvm/java-6-sun


Em dùng Distro Ubuntu 9.04 - Eclipse GANYMEDE SDK 3.4.2
[Up] [Print Copy]
[digg] [delicious] [google] [yahoo] [technorati] [reddit] [stumbleupon]
Go to: 
 Users currently in here 
1 Anonymous

Powered by JForum - Extended by HVAOnline
 hvaonline.net  |  hvaforum.net  |  hvazone.net  |  hvanews.net  |  vnhacker.org
1999 - 2013 © v2012|0504|218|