[jboss-jira] [JBoss JIRA] Commented: (JBAS-4116) JRMPInvokerHA fails with a NPE when no JRMPInvoker is setup on the server

Andreas Schaefer (JIRA) jira-events at lists.jboss.org
Fri Feb 23 13:42:39 EST 2007


    [ http://jira.jboss.com/jira/browse/JBAS-4116?page=comments#action_12354119 ] 
            
Andreas Schaefer commented on JBAS-4116:
----------------------------------------

Even though this does not make much sense by default there is a good chance that even when PooledInvokerHA is used within the cluster that an application is deployed on it that would need JRMPInvokerHA because it is specified in jboss.xml this way.

Right now if someone is using JRMPInvokerHA without JRMPInvoker set up you will see the NPE and that is a bug, isn't it. The fix is simple and that should be reason enough to fix it, shouldn't it be.

> JRMPInvokerHA fails with a NPE when no JRMPInvoker is setup on the server
> -------------------------------------------------------------------------
>
>                 Key: JBAS-4116
>                 URL: http://jira.jboss.com/jira/browse/JBAS-4116
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Clustering
>    Affects Versions: JBossAS-4.0.5.CR1, JBossAS-4.0.5.GA, JBossAS-4.0.4.GA
>         Environment: SuSE Linux 10.2 XEN Instance, AMD64 Dual Core 5000+, 1GB Memory
>            Reporter: Andreas Schaefer
>         Assigned To: Brian Stansberry
>            Priority: Minor
>
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list