0 Replies Latest reply on Dec 29, 2010 2:42 AM by ShuiXin Zhang

    How to invoke EJB from another EJB by IIOP protocol?

    ShuiXin Zhang Newbie

      Hi all,

      I have enabled the JTS by executing the ant command under %JBOSS_HOME%\docs\examples\transactions directory, and the jbossjts-properties.xml are copied successfully.


      Any missing on this step?


      I invoke another EJB from one EJB3, but throw the below exception.

      15:21:00,103 ERROR [STDERR] Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
      15:21:00,103 ERROR [STDERR]     at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)


      Invocation code snippet:

      Properties properties = new Properties();
                  String url = "corbaloc::localhost:3528/JBoss/Naming/root";
                  String fac = "com.sun.jndi.cosnaming.CNCtxFactory";

                  properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, fac);
                  properties.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming.client:org.jnp.interfaces");
                  properties.setProperty(Context.PROVIDER_URL, url);


                  InitialContext ctx = new InitialContext(properties);
                  Object o = ctx.lookup("HelloWorld");

                  HelloWorldHome hwHome = (HelloWorldHome) PortableRemoteObject.narrow(o, HelloWorldHome.class);
                  HelloWorld hw = hwHome.create();
                  String s = hw.sayHello("hello");