在调试一个有状态会话Bean时,用了一个如下客户端测试程序(如下),但在执行到: //创建EJB对象(注:“112233445566”是ID,"123456"是密码)
UserAccount user=hm.create("112233445566","123456");
发生如下异常错误(注:EJB组件已经部署到容器上):
java.rmi.RemoteException: EJB Exception:; nested exception is:
java.lang.NullPointerException
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
.......
各位高手,若知道原因,请回复一下,非常感谢!
客户端测试程序相关代码如下(用EJB Client Test模板生成):
public static void main(String[] args)
{
UserAccountTestClient client = new UserAccountTestClient();
//返回Home接口
UserAccountHome hm=client.getHome();
try
{
//创建EJB对象
UserAccount user=hm.create("112233445566","123456");
//UserAccount user=hm.create(username,password);
System.out.println("Balance:"+user.Balance());
//调用EJB对象中的方法
user.Deposit(10000);
System.out.println("The user has deposit some money. Now the balance is:"
+user.Balance());
user.Withdraw(200);
System.out.println("The user has withdraw some money. Now the balance is:"
+user.Balance());
user.Transfer("123456123456",4000);
System.out.println("The user has transfer some money. Now the balance is:"
+user.Balance());
user.remove();
}
catch(Exception ex)
{
ex.printStackTrace();
}