Bug 862291

Summary: WSRP: NullPointerException when using empty wsrp-producers-config.xml
Product: [JBoss] JBoss Enterprise Portal Platform 5 Reporter: Martin Weiler <mweiler>
Component: PortalAssignee: Thomas Heute <theute>
Status: CLOSED WONTFIX QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 5.2.2.GACC: epp-bugs
Target Milestone: ---   
Target Release: 5.2.3.GA   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 864992 (view as bug list) Environment:
Last Closed: 2014-09-26 07:45:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch none

Description Martin Weiler 2012-10-02 14:32:17 UTC
Description of problem:
Using a conf/gatein/wsrp-producers-config.xml without registration, like this:
 <producer-configuration/>

is resulting in the following exception in the producer, upon accessing the remote portlets on the consumer side:

 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.NullPointerException
        at org.gatein.registration.impl.RegistrationManagerImpl.addRegistrationTo(RegistrationManagerImpl.java:116)
        at org.gatein.registration.impl.RegistrationManagerImpl.getNonRegisteredRegistration(RegistrationManagerImpl.java:291)
        at org.gatein.wsrp.producer.handlers.RegistrationHandler.getRegistrationFrom(RegistrationHandler.java:351)
        at org.gatein.wsrp.producer.WSRPProducerImpl.getRegistrationOrFailIfInvalid(WSRPProducerImpl.java:497)
        at org.gatein.wsrp.producer.handlers.PortletManagementHandler.getPortletPropertyDescription(PortletManagementHandler.java:170)
        at org.gatein.wsrp.producer.WSRPProducerImpl.getPortletPropertyDescription(WSRPProducerImpl.java:302)
        at org.gatein.wsrp.endpoints.v2.PortletManagementEndpoint.getPortletPropertyDescription(PortletManagementEndpoint.java:110)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)

How reproducible:
Always

Steps to Reproduce:
1. Add server/PRODUCER/conf/gatein/wsrp-producers-config.xml with content:
   <producer-configuration/>
2. Add server/CONSUMER/conf/gatein/wsrp-consumers-config.xml, pointing to producer, eg:

  <deployment>
    <wsrp-producer id="test_wsrp_v2" expiration-cache="500" ws-timeout="50000">
      <endpoint-wsdl-url>http://localhost:8080/wsrp-producer/v2/MarkupService?wsdl</endpoint-wsdl-url>
      <registration-data>
        <consumer-name>EPP 5.2 Portlets Consumer</consumer-name>
      </registration-data>
    </wsrp-producer>
  </deployment>

3. Edited deploy/gatein.ear/web.war/WEB-INF/portlet.xml to mark a portlet as remotable on the producer side
4. Started both EPP instances
5. On the consumer instance, opened the WSRP admin GUI
6. Refreshed the test_wsrp_v2 consumer -> OK
7. Opened the Application Registry on the consumer
8. Added the remote portlet to a category
9. Added the remote portlet to a page

Actual results:
This resulted in the following errors on the two server instances:

CONSUMER:
--------
13:11:00,553 ERROR [CommonClient] Exception caught while (preparing for) performing the invocation: 
javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException
	at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelperJAXWS.java:85)
	at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11BindingJAXWS.java:107)
	at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:582)
	at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:396)
	at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:232)
	at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:171)
	at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:157)
	at $Proxy288.initCookie(Unknown Source)
	at org.gatein.wsrp.services.v2.V2MarkupService.initCookie(V2MarkupService.java:107)
...
13:11:00,791 ERROR [portal:UIPortletLifecycle] Portlet render threw an exception
org.exoplatform.services.portletcontainer.PortletContainerException: org.gatein.pc.api.InvokerUnavailableException: Couldn't init cookies!
	at org.exoplatform.portal.webui.application.UIPortletLifecycle.processRender(UIPortletLifecycle.java:336)
	at org.exoplatform.portal.webui.application.UIPortletLifecycle.processRender(UIPortletLifecycle.java:62)
	at org.exoplatform.webui.core.UIComponent.processRender(UIComponent.java:144)
	at org.exoplatform.webui.core.UIContainer.renderChildren(UIContainer.java:368)
	at org.exoplatform.webui.core.UIContainer.renderChildren(UIContainer.java:358)


PRODUCER:
--------
13:11:00,526 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.NullPointerException
	at org.gatein.registration.impl.RegistrationManagerImpl.addRegistrationTo(RegistrationManagerImpl.java:116)
	at org.gatein.registration.impl.RegistrationManagerImpl.getNonRegisteredRegistration(RegistrationManagerImpl.java:291)
	at org.gatein.wsrp.producer.handlers.RegistrationHandler.getRegistrationFrom(RegistrationHandler.java:351)
	at org.gatein.wsrp.producer.WSRPProducerImpl.getRegistrationOrFailIfInvalid(WSRPProducerImpl.java:497)
	at org.gatein.wsrp.producer.handlers.MarkupHandler.initCookie(MarkupHandler.java:205)
	at org.gatein.wsrp.producer.WSRPProducerImpl.initCookie(WSRPProducerImpl.java:220)
	at org.gatein.wsrp.endpoints.v2.MarkupEndpoint.initCookie(MarkupEndpoint.java:142)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)


Expected results:
Remote portlet displayed without errors.

Comment 1 bkramer 2012-10-05 11:01:31 UTC
Created attachment 622093 [details]
proposed patch