Exception 简单EJB客户端或Junit不与IBM websphere一起工作

Exception 简单EJB客户端或Junit不与IBM websphere一起工作,exception,ejb,websphere,jndi,Exception,Ejb,Websphere,Jndi,我的ejb部署在websphere中,我想从另一个Web服务器调用它,但远程查找代码不起作用。因此,我尝试了一个简单的客户端,看看它是否工作,我设置了上下文属性,但它仍然不工作。我错过什么了吗 我的节点位置是WMSPBLDJ00327Node03Cell\WMSPBLDJ00327Node03\server1 下面的jndi可以从部署在websphere中的web代码中完美地工作。。ejb/WgePasEar/WgePasEjb.jar/EmplFacade#com.company.crw.wg

我的ejb部署在websphere中,我想从另一个Web服务器调用它,但远程查找代码不起作用。因此,我尝试了一个简单的客户端,看看它是否工作,我设置了上下文属性,但它仍然不工作。我错过什么了吗

我的节点位置是WMSPBLDJ00327Node03Cell\WMSPBLDJ00327Node03\server1

下面的jndi可以从部署在websphere中的web代码中完美地工作。。ejb/WgePasEar/WgePasEjb.jar/EmplFacade#com.company.crw.wge.pas.ejb.cmn.emp.EmplFacadeHome 但不是来自客户。我尝试了以下代码中的不同选项。你能帮忙吗

EJB启动日志

[5/8/14 16:31:33:487 CDT]000000 4B AbstractEJBRu I WSVR0037I:启动EJB jar:WgePasEjb.jar [5/8/14 16:31:34:101 CDT]000000 4B EJBContainerI I CNTR0167I:服务器正在绑定WgePasEar应用程序的WgePasEjb.jar模块中EmplFacadeEnterprise bean的com.company.crw.wge.pas.ejb.cmn.empl.EmplFacadeHome接口。绑定位置是:ejb/WgePasEar/WgePasEjb.jar/EmplFacade#com.company.crw.wge.pas.ejb.cmn.empl.EmplFacadeHome [5/8/14 16:31:34:105 CDT]000000 4B EJBContainerI I CNTR0167I:服务器正在绑定WgePasEar应用程序的WgePasEjb.jar模块中EmplFacadeEnterprise bean的com.company.crw.wge.pas.ejb.cmn.empl.EmplFacadeHome接口。绑定位置是:com.company.crw.wge.pas.ejb.cmn.emp.EmplFacadeHome [5/8/14 16:31:34:106 CDT]000000 4B AbstractEJBU I CNTR0167I:服务器正在绑定WgePasEar应用程序的WgePasEjb.jar模块中EmplFacadeEnterprise bean的com.company.crw.wge.pas.ejb.cmn.empl.EmplFacadeHome接口。绑定位置是:java:global/WgePasEar/WgePasEjb/EmplFacade!com.company.crw.wge.pas.ejb.cmn.emp.EmplFacadeHome

所有这些都给了我例外的名字

javax.naming.NameNotFoundException:在上下文“java:global”中找不到名称WGEPASAR。 在com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1969)上 位于com.ibm.ws.naming.ipbase.NameSpace.retrieveBinding(NameSpace.java:1376) 位于com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1219) 位于com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1141) 位于com.ibm.ws.naming.urlbase.UrlContextImpl.lookupExt(UrlContextImpl.java:1436) 位于com.ibm.ws.naming.java.javaURLContextImpl.lookupExt(javaURLContextImpl.java:477) 位于com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:485) 位于com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:468) 位于com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:370) TestJunit.testContactBean(TestJunit.java:34) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)中 位于java.lang.reflect.Method.invoke(Method.java:613) 位于org.junit.runners.model.FrameworkMethod$1.runReflectVeCall(FrameworkMethod.java:44) 位于org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) 位于org.junit.runners.model.FrameworkMethod.invokeeexplosive(FrameworkMethod.java:41) 位于org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) 位于org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) 位于org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) 位于org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) 位于org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) 位于org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) 访问org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) 位于org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) 位于org.junit.runners.ParentRunner.run(ParentRunner.java:236) 位于org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) 位于org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 位于org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) 位于org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) 位于org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) 位于org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) javax.naming.NameNotFoundException:在上下文“java:global”中找不到名称WGEPASAR。 在com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1969)上 位于com.ibm.ws.naming.ipbase.NameSpace.retrieveBinding(NameSpace.java:1376) 位于com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1219) 位于com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1141) 位于com.ibm.ws.naming.urlbase.UrlContextImpl.lookupExt(UrlContextImpl.java:1436) 位于com.ibm.ws.naming.java.javaURLContextImpl.lookupExt(javaURLContextImpl.java:477) 位于com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:485) 位于com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:468) 位于com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:370) TestJunit.testContactBean(TestJunit.java:42) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)中 位于java.lang.reflect.Method.invoke(Method.java:613) 位于org.junit.runners.model.FrameworkMethod$1.runReflectVeCall(FrameworkMethod.java:44) 在org.junit.in
import java.util.Properties;import javax.ejb.embeddable.EJBContainer;import javax.naming.Context;import org.junit.Test; public class TestJunit {

@Test
public void testContactBean() {
    // Create the embeddable container
    Properties env1 = new Properties();
    env1.put(Context.INITIAL_CONTEXT_FACTORY,
            "com.ibm.websphere.naming.WsnInitialContextFactory");
    env1.put(Context.PROVIDER_URL, "iiop://localhost:9102");
    env1.put("com.ibm.CORBA.Debug", "true");
    env1.put("com.ibm.CORBA.CommTrace", "true");
    env1.put("com.ibm.CORBA.Debug.Output", "client.log");
    env1.put(
            "com.ibm.SSL.ConfigURL",
            "file:/C:/IBM/WebSphere/AppServer_1/profiles/AppSrv1/properties/ssl.client.props");
    env1.put("com.ibm.CORBA.loginUserid", "admin");
    env1.put("com.ibm.CORBA.loginPassword", "admin");
    env1.put("com.ibm.CORBA.loginSource", "properties");
    EJBContainer ec = EJBContainer.createEJBContainer(env1);

    try {
        Object ejbHome = null;
        try {
            ejbHome = ec
                    .getContext()
                    .lookup("java:global/WgePasEar/WgePasEjb.jar/EmplFacade#com.company.crw.wge.pas.ejb.cmn.scty.EmplFacadeHome");
            System.out.println("******************" + ejbHome);
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            ejbHome = ec
                    .getContext()
                    .lookup("java:global/WgePasEar/WgePasEjb/EmplFacade!com.company.crw.wge.pas.ejb.cmn.empl.EmplFacadeHome");
            System.out.println("******************" + ejbHome);
        } catch (Exception e) {
            e.printStackTrace();
        }

        Object contactBean = (Object) ec
                .getContext()
                .lookup("java:global/WgePasEar/WgePasEjb/EmplFacade!com.company.crw.wge.pas.ejb.cmn.empl.EmplFacadeHome");
        System.out.println("******************" + contactBean);
    } catch (Throwable t) {
        t.printStackTrace();
    } finally {
        ec.close();
    }
}}