JBoss的默认工厂是什么?

04-06-06 aill
我部署了一个简单的ejb,
用客户端调用的时候
import javax.naming.InitialContext;
import javax.naming.Context;
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("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url","localhost:1099");

InitialContext jndiContext = new InitialContext(env);

Object ref = jndiContext.lookup("QueryBean");
System.out.println("Got reference");

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

QueryBean qb = home.create();

}

catch(Exception e)
{
System.out.println(e.toString());
}
}
}
执行的时候提示错误:
javax.naming.NoinitialContextException:Cannot instantiate class:org.jnp.interfaces.NamingContextFactory[Root exception is java.lang.ClassNotFoundException:org.jnp.interfaces.NamingContextFactory]
是我的初始化工厂地址错误吗?
麻烦老大了!

aill
2004-06-06 17:12
我如果换成

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");
的话程序又提示系统安全异常:
java.io.FileNotFoundException:c:\j2sdk1.4\config\security.propertyis(系统找不到指定的路径)
at java.io.File...................

我的c:\j2sdk1.4下确实没有config这个目录,
难道应用程序也有安全限制吗?
怎么解决呢?找一个security.properties放到指定目录下?

猜你喜欢