容器glassfishprojectA中: CommandCalculate.class
package clientapp;
public interface CommandCalculate {
public void test();
} CommandCalculateRemote.class
package clientapp;
import javax.ejb.Remote;
@Remote
public interface CommandCalculateRemote extends CommandCalculate{
} CommandCalculateBean.class
package clientapp;
import javax.ejb.Stateless;
@Stateless
public class CommandCalculateBean implements CommandCalculateLocal,CommandCalculateRemote{
public void test(){
System.out.println("xxx");
}
} CommandCalculate.class和CommandCalculateRemote.class打成了jar导入了projectB projectB中: try {
Properties props = System.getProperties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
props.put(Context.URL_PKG_PREFIXES, "com.sun.enterprise.naming");
props.put(Context.STATE_FACTORIES,"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.put(Context.PROVIDER_URL, "iiop://22.117.79.139:3700");
InitialContext ctx = new InitialContext(props);
System.out.println(CommandCalculateRemote.class.getName());
CommandCalculate cc = (CommandCalculate) ctx.lookup(CommandCalculateRemote.class.getName());
cc.test();
} catch (Exception e) {
e.printStackTrace();
}
本人用的glassfish,问题来了,本机(同一个容器中)测试通过,确实可以调到打印出"xxx",但projectB部署到另一台机器后就报出如下错误:
javax.naming.NameNotFoundException: com.jas.clientapp.CommandCalculateRemote not found
不知何解,赐教~~
package clientapp;
public interface CommandCalculate {
public void test();
} CommandCalculateRemote.class
package clientapp;
import javax.ejb.Remote;
@Remote
public interface CommandCalculateRemote extends CommandCalculate{
} CommandCalculateBean.class
package clientapp;
import javax.ejb.Stateless;
@Stateless
public class CommandCalculateBean implements CommandCalculateLocal,CommandCalculateRemote{
public void test(){
System.out.println("xxx");
}
} CommandCalculate.class和CommandCalculateRemote.class打成了jar导入了projectB projectB中: try {
Properties props = System.getProperties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
props.put(Context.URL_PKG_PREFIXES, "com.sun.enterprise.naming");
props.put(Context.STATE_FACTORIES,"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
props.put(Context.PROVIDER_URL, "iiop://22.117.79.139:3700");
InitialContext ctx = new InitialContext(props);
System.out.println(CommandCalculateRemote.class.getName());
CommandCalculate cc = (CommandCalculate) ctx.lookup(CommandCalculateRemote.class.getName());
cc.test();
} catch (Exception e) {
e.printStackTrace();
}
本人用的glassfish,问题来了,本机(同一个容器中)测试通过,确实可以调到打印出"xxx",但projectB部署到另一台机器后就报出如下错误:
javax.naming.NameNotFoundException: com.jas.clientapp.CommandCalculateRemote not found
不知何解,赐教~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货