Where to set breakpoint for this error?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Where to set breakpoint for this error?

Chuck22
Hi

The error message I got.
*******************************************
 org.ofbiz.base.util.GeneralException: Error rendering screen
[component://ecommerce/widget/CatalogScreens.xml#product]:
org.ofbiz.base.util.GeneralException: Error rendering screen
[component://ecommerce/widget/CommonScreens.xml#main-decorator]:
org.ofbiz.base.util.GeneralException: Error rendering screen
[component://ecommerce/widget/CatalogScreens.xml#productdetail]:
org.ofbiz.base.util.GeneralException: Error running BSH script at location
[component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh]:
org.ofbiz.base.util.GeneralException: Error running BSH script at
[component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh],
line [384]: Sourced file:
*component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
: Method Invocation dispatcher.runSync : at Line: 384 : *in file:
component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
: dispatcher .runSync ( "*getAssociatedProducts*" , UtilMisc .toMap (
"productId" , productId , "type" , "PRODUCT_OBSOLESCENCE" , "checkViewAllow"
, Boolean .TRUE , "prodCatalogId" , currentCatalogId ) )
....
********************************

It seems to me the error came from getAssociatedProducts method in
ProductWorker class. But when I set a breakpoint there, it is not called.


// get product associations (this is line 384)
    obsoleteProducts = dispatcher.runSync("getAssociatedProducts",
UtilMisc.toMap("productId", productId, "type", "PRODUCT_OBSOLESCENCE",
"checkViewAllow", Boolean.TRUE, "prodCatalogId", currentCatalogId));


The getAssociatedProducts method is not called in my debugging. I set
several breakpints in this method and they all failed to halt execution. My
debugging works fine in other code place.


public static void getAssociatedProducts(PageContext pageContext, String
productAttributeName, String assocPrefix) {
        GenericDelegator delegator = (GenericDelegator)
pageContext.getRequest().getAttribute("delegator");
        GenericValue product = (GenericValue) pageContext.getAttribute
(productAttributeName);

        if (product == null)
            return;

        try {
            List upgradeProducts = product.getRelatedByAndCache
("MainProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_UPGRADE"));

            List complementProducts = product.getRelatedByAndCache
("MainProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_COMPLEMENT"));

            List obsolescenceProducts = product.getRelatedByAndCache
("AssocProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_OBSOLESCENCE"));

            List obsoleteByProducts = product.getRelatedByAndCache
("MainProductAssoc",
                    UtilMisc.toMap("productAssocTypeId",
"PRODUCT_OBSOLESCENCE"));

            // since ProductAssoc records have a fromDate and thruDate, we
can filter by now so that only assocs in the date range are included
            upgradeProducts = EntityUtil.filterByDate(upgradeProducts,
true);
            complementProducts = EntityUtil.filterByDate(complementProducts,
true);
            obsolescenceProducts =
EntityUtil.filterByDate(obsolescenceProducts,
true);
            obsoleteByProducts =
EntityUtil.filterByDate(obsoleteByProducts, true);

            if (upgradeProducts != null && upgradeProducts.size() > 0)
                pageContext.setAttribute(assocPrefix + "upgrade",
upgradeProducts);
            if (complementProducts != null && complementProducts.size() > 0)
                pageContext.setAttribute(assocPrefix + "complement",
complementProducts);
            if (obsolescenceProducts != null && obsolescenceProducts.size ()
> 0)
                pageContext.setAttribute(assocPrefix + "obsolescence",
obsolescenceProducts);
            if (obsoleteByProducts != null && obsoleteByProducts.size() > 0)
                pageContext.setAttribute(assocPrefix + "obsoleteby",
obsoleteByProducts);
        } catch (GenericEntityException e) {
            Debug.logWarning(e, module);
        }
    }

I don't know where to go to find the cause of my error. Please advise.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Where to set breakpoint for this error?

cjhowe
runSync calls the service in
product/servicedef/services_view.xml, not the java
method ProductWorker.getAssociatedProducts

the service getAssociatedProducts requires an IN
parameter of productIdTo which you are missing when
you call it.

--- Chris Bai <[hidden email]> wrote:

> Hi
>
> The error message I got.
> *******************************************
>  org.ofbiz.base.util.GeneralException: Error
> rendering screen
>
[component://ecommerce/widget/CatalogScreens.xml#product]:
> org.ofbiz.base.util.GeneralException: Error
> rendering screen
>
[component://ecommerce/widget/CommonScreens.xml#main-decorator]:
> org.ofbiz.base.util.GeneralException: Error
> rendering screen
>
[component://ecommerce/widget/CatalogScreens.xml#productdetail]:
> org.ofbiz.base.util.GeneralException: Error running
> BSH script at location
>
[component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh]:
> org.ofbiz.base.util.GeneralException: Error running
> BSH script at
>
[component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh],
> line [384]: Sourced file:
>
*component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh
> : Method Invocation dispatcher.runSync : at Line:
> 384 : *in file:
>
component://order/webapp/ordermgr/WEB-INF/actions/entry/catalog/productdetail.bsh

> : dispatcher .runSync ( "*getAssociatedProducts*" ,
> UtilMisc .toMap (
> "productId" , productId , "type" ,
> "PRODUCT_OBSOLESCENCE" , "checkViewAllow"
> , Boolean .TRUE , "prodCatalogId" , currentCatalogId
> ) )
> ....
> ********************************
>
> It seems to me the error came from
> getAssociatedProducts method in
> ProductWorker class. But when I set a breakpoint
> there, it is not called.
>
>
> // get product associations (this is line 384)
>     obsoleteProducts =
> dispatcher.runSync("getAssociatedProducts",
> UtilMisc.toMap("productId", productId, "type",
> "PRODUCT_OBSOLESCENCE",
> "checkViewAllow", Boolean.TRUE, "prodCatalogId",
> currentCatalogId));
>
>
> The getAssociatedProducts method is not called in my
> debugging. I set
> several breakpints in this method and they all
> failed to halt execution. My
> debugging works fine in other code place.
>
>
> public static void getAssociatedProducts(PageContext
> pageContext, String
> productAttributeName, String assocPrefix) {
>         GenericDelegator delegator =
> (GenericDelegator)
> pageContext.getRequest().getAttribute("delegator");
>         GenericValue product = (GenericValue)
> pageContext.getAttribute
> (productAttributeName);
>
>         if (product == null)
>             return;
>
>         try {
>             List upgradeProducts =
> product.getRelatedByAndCache
> ("MainProductAssoc",
>                    
> UtilMisc.toMap("productAssocTypeId",
> "PRODUCT_UPGRADE"));
>
>             List complementProducts =
> product.getRelatedByAndCache
> ("MainProductAssoc",
>                    
> UtilMisc.toMap("productAssocTypeId",
> "PRODUCT_COMPLEMENT"));
>
>             List obsolescenceProducts =
> product.getRelatedByAndCache
> ("AssocProductAssoc",
>                    
> UtilMisc.toMap("productAssocTypeId",
> "PRODUCT_OBSOLESCENCE"));
>
>             List obsoleteByProducts =
> product.getRelatedByAndCache
> ("MainProductAssoc",
>                    
> UtilMisc.toMap("productAssocTypeId",
> "PRODUCT_OBSOLESCENCE"));
>
>             // since ProductAssoc records have a
> fromDate and thruDate, we
> can filter by now so that only assocs in the date
> range are included
>             upgradeProducts =
> EntityUtil.filterByDate(upgradeProducts,
> true);
>             complementProducts =
> EntityUtil.filterByDate(complementProducts,
> true);
>             obsolescenceProducts =
> EntityUtil.filterByDate(obsolescenceProducts,
> true);
>             obsoleteByProducts =
> EntityUtil.filterByDate(obsoleteByProducts, true);
>
>             if (upgradeProducts != null &&
> upgradeProducts.size() > 0)
>                 pageContext.setAttribute(assocPrefix
> + "upgrade",
> upgradeProducts);
>             if (complementProducts != null &&
> complementProducts.size() > 0)
>                 pageContext.setAttribute(assocPrefix
> + "complement",
> complementProducts);
>             if (obsolescenceProducts != null &&
> obsolescenceProducts.size ()
> > 0)
>                 pageContext.setAttribute(assocPrefix
> + "obsolescence",
> obsolescenceProducts);
>             if (obsoleteByProducts != null &&
> obsoleteByProducts.size() > 0)
>                 pageContext.setAttribute(assocPrefix
> + "obsoleteby",
> obsoleteByProducts);
>         } catch (GenericEntityException e) {
>             Debug.logWarning(e, module);
>         }
>     }
>
> I don't know where to go to find the cause of my
> error. Please advise.
> Thanks.
>