老大救命啊!!!

我的第一个EJB到现在还没弄好 :( 求老大帮忙啊
ejb部署应该没问题(jboss没有错误提示)
客户端是这样:
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.ejb.*;
import javax.rmi.PortableRemoteObject;
import QueryInterface.*;
import QueryBean.*;
import java.util.*;
public class Test
{
public static void main(String[] args)
{
try
{
Properties env=new Properties();
env.setProperty("Context.INITIAL_CONTEXT_FACTORY","org.jnp.interfaces.NamingContextFactory");
env.setProperty("Context.PROVIDER_URL","localhost:1099");
env.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
InitialContext ic=null;
ic = new InitialContext(env);

QueryInterface.TestQueryHome home = (QueryInterface.TestQueryHome)
PortableRemoteObject.narrow(ref, QueryInterface.TestQueryHome.class);

QueryBean qb = home.create();
System.out.println(qb.query("","jdbc:odbc:ServletDB","",""));

}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
执行的时候提示:
javax.naming.CommunicationException:Cant't find SerialContextProperder
好象是JNDI环境有错误。
老大帮我看看吧

你的JNDI.properties文件里是不是这样写的?然后环境变量里指定了吗?


java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

不是环境变量的问题,是classpath中少了一些jar包。
现在可以了, :(
谢谢上面的兄弟!