当前位置: 代码迷 >> J2EE >> javax.naming.NoInitialContextException: Need to specify class name in
  详细解决方案

javax.naming.NoInitialContextException: Need to specify class name in

热度:249   发布时间:2016-04-22 03:12:18.0
ejb入门提问!在先等!
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(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.test.util.HelloWorldTest.main(HelloWorldTest.java:20)
Java code
Properties props = new Properties();        props.setProperty("java.naming.factory.initial ", "org.jnp.interfaces.NamingContextFactory");        props.setProperty("java.naming.provider.url ", "localhost:1099");        InitialContext ctx;        try {            ctx = new InitialContext(props);            HelloWorld helloWorld = (HelloWorld)ctx.lookup("HelloImpl/remote");            System.out.println(helloWorld.sayHello("小曹"));        } catch (NamingException e) {            e.printStackTrace();        }



一个接口,一个实现类!client的炸包都拷了。
求救!!!!

------解决方案--------------------
你配的是不有问题,代码我没看出来有问题
------解决方案--------------------
%JBOSS_HOME%/server/default/deploy/jboss-web.deployer/META-INF/jboss-service.xml 
中的<attribute name=”UseJBossWebLoader”>false</attribute> (58行把)该为true 重启JBOSS
  相关解决方案