Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Java EE 综合讨论区
打印话题 寄给朋友 订阅主题 |
作者 | 调试EJB遇到一点问题,大家看看 |
dingwm
发贴: 7 积分: 0 |
于 2005-05-07 12:22
MYECLIPSE+JBOSS4 写了个EJB 测试时遇到问题 请各位大侠看看 客户端代码: /* * Created on 2005-5-6 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ package com.bjb.helloworld.test; import javax.naming.Context; import javax.naming.InitialContext; import com.bjb.helloworld.ejb.*; import com.bjb.helloworld.interfaces.*; import javax.rmi.PortableRemoteObject; import java.util.*; import org.jnp.interfaces.NamingContextFactory; /** * @author cclx * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class HelloTestClient { public static void main(String[] args) throws Exception { Context ctx=getInitialContext(); Object obj=ctx.lookup(HelloWorldHome.JNDI_NAME); HelloWorldHome helloworldhome=(HelloWorldHome)PortableRemoteObject.narrow (obj,HelloWorldHome.class); HelloWorld helloworld=helloworldhome.create(); System.out.println(helloworld.helloWorld()); } private static Context getInitialContext() throws Exception{ String url="t3://127.0.0.1:7001"; String user="cclx"; String password="cclx"; Properties properties=null; properties=new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.PROVIDER_URL,url); if(user!=null){ properties.put(Context.SECURITY_PRINCIPAL,user); properties.put(Context.SECURITY_CREDENTIALS, password==null? "" : password); } return new InitialContext(properties); } } 错误 javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243) at javax.naming.InitialContext.init(InitialContext.java:219) at javax.naming.InitialContext.<init>(InitialContext.java:195) at com.bjb.helloworld.test.HelloTestClient.getInitialContext(HelloTestClient.java:45) at com.bjb.helloworld.test.HelloTestClient.main(HelloTestClient.java:23) Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:199) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:219) at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649) ... 5 more Exception in thread "main" Hibernate的优点 |
话题树型展开 |
人气 | 标题 | 作者 | 字数 | 发贴时间 |
6877 | 调试EJB遇到一点问题,大家看看 | dingwm | 3096 | 2005-05-07 12:22 |
5225 | Re:调试EJB遇到一点问题,大家看看 | wangaman | 84 | 2005-05-09 13:43 |
5468 | Re:调试EJB遇到一点问题,大家看看 | dingwm | 19 | 2005-05-09 15:06 |
已读帖子 新的帖子 被删除的帖子 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |