我有在通信通道另一端創建的EJB3服務的指針(JNDI)。換句話說,它是在我們的客戶應用程序服務器上創建的。 現在我需要爲基於ADF的接口來調用EJB3。 我對界面沒有任何問題,但我正在努力如何調用EJB3。 我應該做的,我支持bean就像它是由客戶提出:帶有EJB3客戶端的Oracle ADF
public class SessionEJBClient {
public static void main(String[] args) {
try {
final Context context = getInitialContext();
SessionEJB sessionEJB = (SessionEJB)context.lookup("MyApp-SessionEJB#org.test.SessionEJB");
} catch (CommunicationException ex) {
System.out.println(ex.getClass().getName());
System.out.println(ex.getRootCause().getLocalizedMessage());
System.out.println("\n*** A CommunicationException was raised. This typically\n*** occurs when the target WebLogic server is not running.\n");
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static Context getInitialContext() throws NamingException {
Hashtable env = new Hashtable();
// WebLogic Server 10.x connection details
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://serverhost:serverport");
return new InitialContext(env);
}
}
還是有做的任何其他方式?換句話說,什麼是正確的引用方式和調用遠程EJB3?
10X
這一切都好,但我需要一個例子如何調用遠程EJB3或換句話說如何調用遠程EJB3。我需要例子。 – zmeda 2012-02-02 07:12:41
這是你的意思嗎?http://stackoverflow.com/questions/293835/how-to-call-remote-ejb-from-standalone-client,或者這個?http://www.codeproject.com/Articles/ 25741/EJB-3-0-Remote-Session-Bean-Lookup - 這與ADF無關_它是標準的JEE – Joe 2012-02-02 15:45:07