Axis2SCAReferenceBindingProvider throws exception if servlet host not present
-----------------------------------------------------------------------------

                 Key: TUSCANY-3540
                 URL: https://issues.apache.org/jira/browse/TUSCANY-3540
             Project: Tuscany
          Issue Type: Bug
          Components: Java SCA Misc Binding Extensions
            Reporter: Simon Nash
            Assignee: Simon Nash


When using the distributed SCA binding on a reference, the code in 
Axis2SCAReferenceBindingProvider throws an exception if no servlet host is 
present, even though a servlet host is not required or used in this scenario.  
Here's the stack trace:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(Unknown Source)
        at java.util.ArrayList.get(Unknown Source)
        at 
org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCAReferenceBindingProvider.<init>(Axis2SCAReferenceBindingProvider.java:76)
        at 
org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingProviderFactory.createReferenceBindingProvider(Axis2SCABindingProviderFactory.java:53)
        at 
org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingProviderFactory.createReferenceBindingProvider(Axis2SCABindingProviderFactory.java:40)
        at 
org.apache.tuscany.sca.provider.DefaultProviderFactoryExtensionPoint$LazyBindingProviderFactory.createReferenceBindingProvider(DefaultProviderFactoryExtensionPoint.java:241)
        at 
org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAReferenceBindingProvider.getDistributedProvider(RuntimeSCAReferenceBindingProvider.java:150)
        at 
org.apache.tuscany.sca.binding.sca.impl.RuntimeSCAReferenceBindingProvider.start(RuntimeSCAReferenceBindingProvider.java:235)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl$2.run(CompositeActivatorImpl.java:610)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:608)
        at 
org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl.start(CompositeActivatorImpl.java:560)
        at org.apache.tuscany.sca.node.impl.NodeImpl.start(NodeImpl.java:728)
        at 
scatours.IntroducingClientLauncher.main(IntroducingClientLauncher.java:31)

The problem is caused by the following line in the constructor for 
Axis2SCAReferenceBindingProvider:
        ServletHost servletHost = servletHosts.getServletHosts().get(0);
This sets a local variable servletHost which is not used anywhere, but throws 
an exception if a servlet host isn't present.  It appears that this line has 
been incorrectly copied from Axis2SCAServiceBindingProvider, which does need a 
servlet host.  To avoid this exception the user has to configure an unnecessary 
servlet host.  The fix for the problem is simply to remove the above line.


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

        

Reply via email to