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

JRMPInvokerHA fails with a NPE when no JRMPInvoker is setup on the server

    XMLWordPrintable

Details

    • Low
    • Workaround Exists
    • Hide

      Create a JRMPInvoker if you are using JRMPInvokerHA.

      Show
      Create a JRMPInvoker if you are using JRMPInvokerHA.

    Description

      When JRMPInvokerHA is used but instead of the JRMPInvoker another Invoker like the Pooled is used then the JRMPInvokerHA will fail with a NPE on the invoke() method of the JRMPInvokerHA accessing the importTPC() method of the JRMPInvoker:

      Caused by: java.lang.NullPointerException
      at org.jboss.invocation.jrmp.server.JRMPInvoker.importTPC(JRMPInvoker.java:595)
      at org.jboss.invocation.jrmp.server.JRMPInvokerHA.invoke(JRMPInvokerHA.java:151)

      The problem was dormant until now because the variable called 'tcpImporter' is static and so any instance of JRMPInvoker will set it. Unfortunately the variable is not set by the JRMPInvokerHA by itself because the method startService() is overwriten and does not call the super method.

      I fixed that issue this way:

      1) Extract the setting of the tcpImporter in the JRMPInvoker in its own, protected method:

      protected void createTPCInvoker()

      { // FIXME marcf: This should not be here // and the transaction propagation context importer tpcImporter = TransactionPropagationContextUtil.getTPCImporter(); }

      2). Call this method from within the startService() method of the JRMPInvoker (a) and the JRMPInvokerHA (b):

      a)
      protected void startService() throws Exception
      {
      loadCustomSocketFactories();

      if (log.isDebugEnabled())

      { log.debug("RMI Port='" + (rmiPort == ANONYMOUS_PORT ? "Anonymous" : Integer.toString(rmiPort)) + "'"); log.debug("Client SocketFactory='" + (clientSocketFactory == null ? "Default" : clientSocketFactory.toString()) + "'"); log.debug("Server SocketFactory='" + (serverSocketFactory == null ? "Default" : serverSocketFactory.toString()) + "'"); log.debug("Server SocketAddr='" + (serverAddress == null ? "Default" : serverAddress) + "'"); log.debug("SecurityDomain='" + (sslDomain == null ? "Default" : sslDomain) + "'"); }

      InitialContext ctx = new InitialContext();

      createTPCInvoker();

      // Set the transaction manager and transaction propagation
      // context factory of the GenericProxy class

      Invoker delegateInvoker = createDelegateInvoker();

      // Make the remote invoker proxy available for use by the proxy factory
      Registry.bind(support.getServiceName(), delegateInvoker);

      // Export CI
      exportCI();

      log.debug("Bound JRMP invoker for JMX node");

      ctx.close();
      }

      b)

      protected void startService() throws Exception
      {
      loadCustomSocketFactories();

      if (log.isDebugEnabled())

      { log.debug("RMI Port='" + (rmiPort == ANONYMOUS_PORT ? "Anonymous" : Integer.toString(rmiPort)+"'")); log.debug("Client SocketFactory='" + (clientSocketFactory == null ? "Default" : clientSocketFactory.toString()+"'")); log.debug("Server SocketFactory='" + (serverSocketFactory == null ? "Default" : serverSocketFactory.toString()+"'")); log.debug("Server SocketAddr='" + (serverAddress == null ? "Default" : serverAddress+"'")); log.debug("SecurityDomain='" + (sslDomain == null ? "None" : sslDomain+"'")); }

      createTPCInvoker();

      exportCI();
      Registry.bind(support.getServiceName(), this);
      }

      I also don't think that the tcpInvoker should be static and I tested it without being static and it worked for me but that is another story.

      -Andy

      Attachments

        Activity

          People

            bstansbe@redhat.com Brian Stansberry
            schaefera_jira Andreas Schaefer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: