JNDI调用EJB3.0报错
public static void main(String[] args) throws Exception{
Properties env=new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,"iiop://catghost");
InitialContext ctx = new InitialContext(env);
FirstEjb ejb = (FirstEjb)ctx.lookup("FirstEjbBean/remote");
//String s = ejb.saySomething("张三");
//System.out.println(s);
}
报错:
--------------------编程问答-------------------- 环境是:IBM Rational Software Architect for WebSphere --------------------编程问答-------------------- runtime classpath有没有加入WAS runtime库? --------------------编程问答-------------------- 具体一些....刚学....
Exception in thread "P=648156:O=0:CT" java.lang.NoClassDefFoundError: com.ibm.ffdc.Manager
at com.ibm.ws.naming.util.RasUtil.logException(RasUtil.java:164)
at com.ibm.ws.naming.util.RasUtil.logException(RasUtil.java:72)
at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:362)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:421)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:123)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:798)
at com.ibm.ws.naming.util.WsnInitCtx.getEnvironment(WsnInitCtx.java:702)
at javax.naming.InitialContext.getEnvironment(Unknown Source)
at ejb.FirstEjbClient.main(FirstEjbClient.java:21)
Caused by: java.lang.ClassNotFoundException: com.ibm.ffdc.Manager
at java.net.URLClassLoader.findClass(URLClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:643)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:300)
at java.lang.ClassLoader.loadClass(ClassLoader.java:609)
... 9 more
那些jar文件 --------------------编程问答-------------------- http://www-01.ibm.com/support/docview.wss?rs=2042&context=SSRTLW&dc=DB560&dc=DB520&uid=swg21358301&loc=en_US&cs=UTF-8&lang=en&rss=ct2042rational
看一下这个网址,或许对你有用 --------------------编程问答-------------------- WAS 7.0的话,至少需要加
<classpathentry kind="lib" path="X:/IBM/WebSphere/AppServer7.0/runtimes/com.ibm.ws.orb_7.0.0.jar"/>
<classpathentry kind="lib" path="X:/IBM/WebSphere/AppServer7.0/runtimes/com.ibm.ws.ejb.thinclient_7.0.0.jar"/>
WAS 6.1的话,至少需要加
<classpathentry kind="lib" path="X:/IBM/WebSphere/AppServer/runtimes/com.ibm.ws.webservices.thinclient_6.1.0.jar"/>
<classpathentry kind="lib" path="X:/IBM/WebSphere/AppServer/runtimes/com.ibm.ws.admin.client_6.1.0.jar"/>
<classpathentry kind="lib" path="D:/IBM/WebSphere/AppServer/lib/rsahelpers.jar"/>
<classpathentry kind="lib" path="D:/IBM/WebSphere/AppServer/lib/rsadbutils.jar"/>
<classpathentry kind="lib" path="X:/IBM/WebSphere/AppServer/plugins/com.ibm.ws.runtime_6.1.0.jar"/>
<classpathentry kind="lib" path="X:/IBM/WebSphere/AppServer/plugins/com.ibm.ws.emf_2.1.0.jar"/>
--------------------编程问答-------------------- 我在测试ejb时碰到同样的问题,在WebSphere\AppServer\runtimes下导入com.ibm.ws.ejb.thinclient_7.0.0.jar包就OK了。 --------------------编程问答--------------------
补充:企业软件 , WebSphere