Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8685

EJB remote call from one server to another doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.0.0.CR1
    • 6.0.0.CR1
    • EJB
    • None
    • Hide

      I was testing with an Application with two Layers.

      • Middleware Layer runs un first Server
      • Frontend Layer runs on second Server

      both container are jboss 6.0.0.CR1

      Frontend server communicate with middleware using Remote EJB. For that I added to it follow configuration to the fronend server:

      <mbean code="org.jboss.naming.ExternalContext"
      name="jboss.jndi:service=ExternalContext,jndiName=middlewareServices">
      <attribute name="JndiName">middlewareServices</attribute>
      <attribute name="Properties">
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
      java.naming.provider.url=jnp://myMiddleware:1099
      </attribute>
      <attribute name="InitialContext">javax.naming.InitialContext</attribute>
      <attribute name="RemoteAccess">true</attribute>
      </mbean>

      Further, I added a naming alias for my remote middleware bean to inject it in my frontend bean.

      <mbean code="org.jboss.naming.NamingAlias"
      name="DefaultDomain:service=NamingAlias,fromName=SessionService">
      <attribute name="FromName">services/SessionService</attribute>
      <attribute name="ToName">middlewareServices/SessionService</attribute>
      </mbean>

      My Frontend EJB looks like:

      @Stateless
      public class CreateSessionActionBean implement CreateSessionAction
      {

      @EJB(mappedName="service/SessionService"
      private SessionService sessionService;

      /**

      • create session action
        */
        public createSession() { sessionService.login(); }

        }

      Wenn I run my frontend, I get following exception:

      Caused by: java.lang.NullPointerException
      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185) [:1.0.11]
      at $Proxy321.createSesssion(Unknown Source) at CreateSessionActionBean.createSession(CreateSessionActionBean.java:20) [:]

      Show
      I was testing with an Application with two Layers. Middleware Layer runs un first Server Frontend Layer runs on second Server both container are jboss 6.0.0.CR1 Frontend server communicate with middleware using Remote EJB. For that I added to it follow configuration to the fronend server: <mbean code="org.jboss.naming.ExternalContext" name="jboss.jndi:service=ExternalContext,jndiName=middlewareServices"> <attribute name="JndiName">middlewareServices</attribute> <attribute name="Properties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=jnp://myMiddleware:1099 </attribute> <attribute name="InitialContext">javax.naming.InitialContext</attribute> <attribute name="RemoteAccess">true</attribute> </mbean> Further, I added a naming alias for my remote middleware bean to inject it in my frontend bean. <mbean code="org.jboss.naming.NamingAlias" name="DefaultDomain:service=NamingAlias,fromName=SessionService"> <attribute name="FromName">services/SessionService</attribute> <attribute name="ToName">middlewareServices/SessionService</attribute> </mbean> My Frontend EJB looks like: @Stateless public class CreateSessionActionBean implement CreateSessionAction { @EJB(mappedName="service/SessionService" private SessionService sessionService; /** create session action */ public createSession() { sessionService.login(); } } Wenn I run my frontend, I get following exception: Caused by: java.lang.NullPointerException at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185) [:1.0.11] at $Proxy321.createSesssion(Unknown Source) at CreateSessionActionBean.createSession(CreateSessionActionBean.java:20) [:]

      I am getting following exception if I try to call EJB from different jboss AS container:

      Caused by: java.lang.NullPointerException
      at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:185) [:1.0.11]
      at $Proxy321.createSesssion(Unknown Source) at CreateSessionActionBean.createSession(CreateSessionActionBean.java:20) [:]

      My example you can find in steps to reproduce.

      I also tried to test the same code with jboss 4.2.3.GA containners. It works without any problems there.

              rhn-engineering-cdewolf Carlo de Wolf
              eugen62 Eugen Fischer (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: