Skip to Content
0
Former Member
Jul 25, 2019 at 05:36 PM

Get Server error when accessing an address, but no stack trace

67 Views

I have a hybris website with a single mapping. Each time I try to access a particular url:

alt text

Is there any way to debug such an error?

This is the controller of the page:

 @Controller
 @RequestMapping(value = "/cart")
 public class CartPageController extends AbstractPageController
 {
     private static final String CART_CMS_PAGE = "cartPage";
     private static final Integer DEFAULT_COOKIE_EXPIRY_AGE = 5184000;
     private static final String DEFAULT_CART_IDENTIFIER_COOKIE_NAME = "cart.identifier.cookie.name";
     private static final Logger LOG = Logger.getLogger(CartPageController.class);
 
 
     @Resource(name = "cartFacade")
     private CartFacade cartFacade;
 
     @Resource(name = "userService")
     private UserService userService;
 
     @Resource(name = "baseStoreService")
     private BaseStoreService baseStoreService;
 
     @Resource(name = "catalogVersionService")
     private CatalogVersionService catalogVersionService;
 
     @RequestMapping(method = RequestMethod.GET)
     public String showCart(HttpServletRequest request, HttpServletResponse response, final Model model)
             throws CMSItemNotFoundException
     {
 
         CartData cartData = cartFacade.getSessionCartWithEntryOrdering(true);
 
         final String cartCookieIdentifier = getCartCookieIdentifier();
 
         if (!cartFacade.hasEntries())
         {
             final String cartId = getCookieValue(request, cartCookieIdentifier);
 
             final Optional<CartData> cartDataOptional = cartFacade.getCartsForCurrentUser().stream()
                     .filter(c -> c.getCode().equals(cartId)).findFirst();
 
             if (cartDataOptional.isPresent())
             {
                 cartData = cartDataOptional.get();
             }
         }
 
         setCookieValue(response, cartCookieIdentifier, cartData.getCode());
         model.addAttribute("cart", cartData);
 
         setupPageModel(model);
 
         String model1 = getViewForPage(model);
 
         return model1;
 
     }
 
     protected void setupPageModel(Model model) throws CMSItemNotFoundException
     {
         storeCmsPageInModel(model, getContentPageForLabelOrId(CART_CMS_PAGE));
         setUpMetaDataForContentPage(model, getContentPageForLabelOrId(CART_CMS_PAGE));
     }
 
     protected String getCookieValue(final HttpServletRequest request, final String cookieName)
     {
         return Arrays.stream(request.getCookies())
                 .filter(c -> c.getName().equals(cookieName))
                 .findFirst()
                 .map(Cookie::getValue)
                 .orElse(null);
     }
 
     protected void setCookieValue(final HttpServletResponse response, final String cookieName, final String cookieValue)
     {
         final Cookie cookie = new Cookie(cookieName, cookieValue);
         cookie.setMaxAge(DEFAULT_COOKIE_EXPIRY_AGE);
 
         response.addCookie(cookie);
     }
 
     protected String getCartCookieIdentifier()
     {
         final String baseStoreId = getCurrentBaseStoreId();
         final String catalogId = getCurrentProductCatalogId();
 
         if (StringUtils.isNotEmpty(baseStoreId) && StringUtils.isNotEmpty(catalogId))
         {
             return baseStoreId + "-" + catalogId;
         }
 
         return DEFAULT_CART_IDENTIFIER_COOKIE_NAME;
     }
 
     protected String getCurrentBaseStoreId()
     {
         final BaseStoreModel baseStore = baseStoreService.getCurrentBaseStore();
         return baseStore == null ? StringUtils.EMPTY : baseStore.getUid();
     }
 
     protected String getCurrentProductCatalogId()
     {
         for (final CatalogVersionModel catalogVersionModel : catalogVersionService.getSessionCatalogVersions())
         {
             if (!((catalogVersionModel.getCatalog() instanceof ContentCatalogModel) || (catalogVersionModel
                     .getCatalog() instanceof ClassificationSystemModel)))
             {
                 return catalogVersionModel.getCatalog().getId();
             }
         }
         return StringUtils.EMPTY;
     }
 }

The content of the jsp page is not really that important since it can be empty and this behaviour still happens. I do not know exactly what could be the root of this. Is there any effective way to debug such issues?