求助:EJB3.0中碰到的问题

lchlrb
08-04-08 1 259

在Myeclipse中,我把stateless session bean 部署到jboss服务器上了,而JBOSS也成功启动了,但我在myelipse中运行run as - java Application时出现下面错误,请问banq大师怎么回事?

错误如下:
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at example.session.stateless.HelloClient.main(HelloClient.java:22)

wlmouse
2008-04-08 18:07

很明显,是没有找到Context。你是用一个单独程序访问服务器,相当于远程调用EJB。所以你必须告诉程序服务器地址、端口等一系列信息。
InitialContext是运行在同一个容器内的上下文。远程访问不能用这个。