OFBiz
  1. OFBiz
  2. OFBIZ-3903

Service error in one portlet causes a rendering failure in another portlet.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Release 09.04
    • Fix Version/s: None
    • Labels:
      None

      Description

      I have a portlet that calls a service. If that service has an error, it causes a different portlet to throw a stack trace on the screen.
      I will attach steps to reproduce.

        Activity

        Hide
        James McGill added a comment -

        For testing this, I have a service that always returns an error.

        <service name="exampleErrorService" engine="simple"
        location="component://example/script/org/ofbiz/example/example/ExampleServices.xml" invoke="exampleErrorService">
        <attribute name="result" type="String" mode="OUT" optional="false"/>
        </service>
        ...
        <simple-method method-name="exampleErrorService">
        <set field="result" value="ERROR"/>
        <add-error>
        <fail-message message="Example Error"/>
        </add-error>
        <check-errors/>
        </simple-method>
        ..

        I made two portlets

        <PortletCategory portletCategoryId="ERROR_EXAMPLE" description="Test case to reproduce error"/>
        <PortalPortlet portalPortletId="ERROR_EXAMPLE_1" portletName="Error Example 1" description="Portlet that runs a service"
        screenName="PortletErrorExample1" screenLocation="component://example/widget/example/PortletScreens.xml"/>
        <PortalPortlet portalPortletId="ERROR_EXAMPLE_2" portletName="Error Example 2" description="Portlet that fails from previous examp"
        screenName="PortletErrorExample2" screenLocation="component://example/widget/example/PortletScreens.xml"/>
        <PortletPortletCategory portalPortletId="ERROR_EXAMPLE_1" portletCategoryId="ERROR_EXAMPLE"/>
        <PortletPortletCategory portalPortletId="ERROR_EXAMPLE_2" portletCategoryId="ERROR_EXAMPLE"/>

        widget/example/PortletScreens.xml

        <screen name="PortletErrorExample1">
        <section>
        <actions>
        <script location="component://example/webapp/example/WEB-INF/actions/PortletErrorExample1.groovy"/>
        </actions>
        <widgets>
        <platform-specific>
        <html>
        <html-template location="component://example/webapp/example/portletErrorExample1.ftl"/>
        </html>
        </platform-specific>
        </widgets>
        </section>
        </screen>

        <screen name="PortletErrorExample2">
        <section>

        <widgets>
        <platform-specific>
        <html>
        <html-template location="component://example/webapp/example/portletErrorExample2.ftl"/>
        </html>
        </platform-specific>
        </widgets>
        </section>
        </screen>

        Then I made this action:

        webapp/example/WEB-INF/actions/PortletErrorExample1.groovy

        import org.ofbiz.base.util.Debug;
        Debug.logInfo("Portlet Error Example 1", "");
        dispatcher.runSync("exampleErrorService", [:]);

        Now if I add the Portlet #1 before Portlet #2 on my portal page, I get a stack trace (next comment).

        Show
        James McGill added a comment - For testing this, I have a service that always returns an error. <service name="exampleErrorService" engine="simple" location="component://example/script/org/ofbiz/example/example/ExampleServices.xml" invoke="exampleErrorService"> <attribute name="result" type="String" mode="OUT" optional="false"/> </service> ... <simple-method method-name="exampleErrorService"> <set field="result" value="ERROR"/> <add-error> <fail-message message="Example Error"/> </add-error> <check-errors/> </simple-method> .. I made two portlets <PortletCategory portletCategoryId="ERROR_EXAMPLE" description="Test case to reproduce error"/> <PortalPortlet portalPortletId="ERROR_EXAMPLE_1" portletName="Error Example 1" description="Portlet that runs a service" screenName="PortletErrorExample1" screenLocation="component://example/widget/example/PortletScreens.xml"/> <PortalPortlet portalPortletId="ERROR_EXAMPLE_2" portletName="Error Example 2" description="Portlet that fails from previous examp" screenName="PortletErrorExample2" screenLocation="component://example/widget/example/PortletScreens.xml"/> <PortletPortletCategory portalPortletId="ERROR_EXAMPLE_1" portletCategoryId="ERROR_EXAMPLE"/> <PortletPortletCategory portalPortletId="ERROR_EXAMPLE_2" portletCategoryId="ERROR_EXAMPLE"/> widget/example/PortletScreens.xml <screen name="PortletErrorExample1"> <section> <actions> <script location="component://example/webapp/example/WEB-INF/actions/PortletErrorExample1.groovy"/> </actions> <widgets> <platform-specific> <html> <html-template location="component://example/webapp/example/portletErrorExample1.ftl"/> </html> </platform-specific> </widgets> </section> </screen> <screen name="PortletErrorExample2"> <section> <widgets> <platform-specific> <html> <html-template location="component://example/webapp/example/portletErrorExample2.ftl"/> </html> </platform-specific> </widgets> </section> </screen> Then I made this action: webapp/example/WEB-INF/actions/PortletErrorExample1.groovy import org.ofbiz.base.util.Debug; Debug.logInfo("Portlet Error Example 1", ""); dispatcher.runSync("exampleErrorService", [:] ); Now if I add the Portlet #1 before Portlet #2 on my portal page, I get a stack trace (next comment).
        Hide
        James McGill added a comment -

        This is the error message. I realize I'm getting a different error from the one I expected to get, but it still illustrates the problem.

        Message: Error rendering screen component://example/widget/example/PortletScreens.xml#PortletErrorExample2: org.ofbiz.entity.transaction.GenericTransactionException: The current transaction is marked for rollback, not beginning a new transaction and aborting current operation; the rollbackOnly was caused by: Error in Service [exampleErrorService]: You must be logged in to complete the [] process. (The current transaction is marked for rollback, not beginning a new transaction and aborting current operation; the rollbackOnly was caused by: Error in Service [exampleErrorService]: You must be logged in to complete the [] process.)

        If I add [ userLogin : userLogin ] to the service call, I get the expected error message, but the same result on the portal page.

        org.ofbiz.entity.transaction.GenericTransactionException: The current transaction is marked for rollback, not beginning a new transaction a
        nd aborting current operation; the rollbackOnly was caused by: Error in simple-method [ [file:/home/jmcgill/ares-production-trunk/framework
        /example/script/org/ofbiz/example/example/ExampleServices.xml#exampleErrorService]]: ; [Example Error]

        Show
        James McGill added a comment - This is the error message. I realize I'm getting a different error from the one I expected to get, but it still illustrates the problem. Message: Error rendering screen component://example/widget/example/PortletScreens.xml#PortletErrorExample2 : org.ofbiz.entity.transaction.GenericTransactionException: The current transaction is marked for rollback, not beginning a new transaction and aborting current operation; the rollbackOnly was caused by: Error in Service [exampleErrorService] : You must be logged in to complete the [] process. (The current transaction is marked for rollback, not beginning a new transaction and aborting current operation; the rollbackOnly was caused by: Error in Service [exampleErrorService] : You must be logged in to complete the [] process.) If I add [ userLogin : userLogin ] to the service call, I get the expected error message, but the same result on the portal page. org.ofbiz.entity.transaction.GenericTransactionException: The current transaction is marked for rollback, not beginning a new transaction a nd aborting current operation; the rollbackOnly was caused by: Error in simple-method [ [file:/home/jmcgill/ares-production-trunk/framework /example/script/org/ofbiz/example/example/ExampleServices.xml#exampleErrorService]]: ; [Example Error]

          People

          • Assignee:
            Unassigned
            Reporter:
            James McGill
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development