java-ee – 如何为WebSphere 8.5编写EJB 3.1客户端?
在查找部署在WebSphere 8.5上的EJB 3.1时,我遇到了问题.
请建议我: >我需要在classpath中包含哪些库? 注意:我正在使用Eclipse IDE 解决方法
试试这个 :
>将com.ibm.ws.ejb.thinclient_8.5.0.jar和com.ibm.ws.orb_8.5.0.jar jars添加到客户端应用程序的类路径中. 客户代码示例: public class WebSphereClient { public static void main(String[] args) { Properties props = new Properties(); props.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory"); props.put(javax.naming.Context.PROVIDER_URL,"iiop://localhost:2818"); TestBeanRemote bean = null; Object obj; try { InitialContext ctx = new InitialContext(props); obj= ctx.lookup("customLookupString"); if (obj instanceof TestBeanRemote) { bean = (TestBeanRemote) obj; } System.out.println("Name : "+bean.getName()); } catch (NamingException e) { e.printStackTrace(); } } } 以上代码和流程对我有用. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |