一個Sessionless BEAN

夢嬌發表於2002-12-31
我用EJB2。0做了一個SESSIONLESS BEAN ,然後做了他的測試客戶斷


客戶斷如下:
package entpro;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import java.util.Properties;
import javax.rmi.*;

public class MyClient {

public MyClient() {
try{
Properties p=new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY ,"weblogic.jndi.WLInitialContextFactory") ;
p.put(Context.PROVIDER_URL ,"t3://localhost:7001");
Context con=new InitialContext(p);
Object ob=con.lookup("entpro.GoodsHome") ;
GoodsHome home=(GoodsHome)PortableRemoteObject.narrow(ob,GoodsHome.class) ;
Goods goods= home.create() ;
goods.buy("book",13) ;
goods.getRemain() ;


}
catch(Exception ex){
System.out.print(ex.getMessage()+"我的異常!!!") ;
}


}

public static void main(String[] args) {
MyClient myClient1 = new MyClient();
}
}

編譯透過,但執行時提示如下:(JB7)
D:\bea\jdk131_03\bin\javaw -classpath "C:\mypro\EntPro\classes;D:\bea\weblogic700\server\lib\weblogic_sp.jar;D:\bea\weblogic700\server\lib\weblogic.jar;D:\bea\jdk131_03\bin\MyModule.jar;D:\bea\jdk131_03\jre\lib\i18n.jar;D:\bea\jdk131_03\jre\lib\jaws.jar;D:\bea\jdk131_03\jre\lib\rt.jar;D:\bea\jdk131_03\jre\lib\sunrsasign.jar;D:\bea\jdk131_03\lib\dt.jar;D:\bea\jdk131_03\lib\htmlconverter.jar;D:\bea\jdk131_03\lib\tools.jar" entpro.MyClient
Unable to resolve 'entpro.GoodsHome' Resolved: '' Unresolved:'entpro'

該Bean 已被成功部署到Weblogic7上,其ejb-jar.xml的 home元素有HOME介面名\<home\>entpro.GoodsHome\</home\>


哪位大哥哥能幫忙解決一下嗎?

相關文章