EJB3.0异常总结--- Need to specify class name in environment or system property,
2013-01-05 20:43
447 查看
异常:
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
原因:
1.没有写入jndi.properties.
2.Need to specify class name in environment or system property. 的
意思就是找不到你的EJB环境变量. 换句话说就是你的客户在使用lookup
的时候. context没有设置对.
3.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
使用的是代码InitialContext
ctx=new InitialContext(props);的方式,不存在jndi配置文件不对的问
题,最后想起之前一个教程里的一句命名空间的话,于是登录jboss控制
台,找到部署的ejb,前面一个java提醒鸟我,将代码里lookup中参数前
面加上java:,搞定。
public class EjbClient {
public static void main(String[] args) {
Properties props=new Properties();
props.setProperty
("java.naming.factroy.initial","org.jnp.interfaces.NamingContextFact
ory");
props.setProperty
("java.naming.provider.url","localhost:1099");//或者
jnp://localhost...也可
props.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");//此行必须有
try{
InitialContext ctx=new InitialContext(props);
HelloWorld helloworld=(HelloWorld)ctx.lookup
("java:HelloWorldBean/remote");//前面的java是关键
System.out.println(helloworld.sayHello("jack"));
}catch(NamingException e){
System.out.println("error:"+e.getMessage());
}
}
}
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
原因:
1.没有写入jndi.properties.
2.Need to specify class name in environment or system property. 的
意思就是找不到你的EJB环境变量. 换句话说就是你的客户在使用lookup
的时候. context没有设置对.
3.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
使用的是代码InitialContext
ctx=new InitialContext(props);的方式,不存在jndi配置文件不对的问
题,最后想起之前一个教程里的一句命名空间的话,于是登录jboss控制
台,找到部署的ejb,前面一个java提醒鸟我,将代码里lookup中参数前
面加上java:,搞定。
public class EjbClient {
public static void main(String[] args) {
Properties props=new Properties();
props.setProperty
("java.naming.factroy.initial","org.jnp.interfaces.NamingContextFact
ory");
props.setProperty
("java.naming.provider.url","localhost:1099");//或者
jnp://localhost...也可
props.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");//此行必须有
try{
InitialContext ctx=new InitialContext(props);
HelloWorld helloworld=(HelloWorld)ctx.lookup
("java:HelloWorldBean/remote");//前面的java是关键
System.out.println(helloworld.sayHello("jack"));
}catch(NamingException e){
System.out.println("error:"+e.getMessage());
}
}
}
相关文章推荐
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- Need to specify class name in environment or system property, or as an applet parameter, or in an ap
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- Need to specify class name in environment or system property, or as an applet parameter, or in an ap
- Need to specify class name in environment or system property, or as an applet parameter, or in a
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter,
- 在使用jetty配置jndi的时候报错“Need to specify class name in environment or system property, or as an applet pa
- Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: j
- WLS Exception: Need to specify class name in environment or system property Solution
- javax.naming.NoInitialContextException: Need to specify class name in environment or system property
- WLS Exception: Need to specify class name in environment or system property Solution
- Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.init
- javax.naming.NoInitialContextException: Need to specify class name in XXX解决
- The type or namespace name 'Windows' does not exist in the class or namespace 'System'
- Home not found. Define system property "openfireHome" or create and add the openfire_init.xml file to the classpath
- FSNamesystem: Not able to place enough replicas, still in need of 1
- add scroolbar to dialog is easy,add flag in dialgon property , then 4 func are need to change or add.