11 Replies Latest reply: Oct 3, 2012 1:36 PM by karthik chopperla RSS

    nullpointerexception in loadshippingGroupObjects processor

    965190
      Hi

      We are using ATG 9.0

      I am getting nullpointer exceptions in loadShippingGroupObjects processor in refresh order pipeline
      Most probably it is showing shipping group repositoryItem as null and trying to access any property from it due to which it is getting null pointer exception

      This error is coming whenever we are trying to access commerce items or anything from the order

      It is being called in the ensureContainers method of orderImpl

      We have not customised this pipeline . Its all OOTB(out of the box)

      In ACC order is showing the shipping groups
      shipping group Type is HardGoodShippingGroup
      All Configurations are as in OOTb

      Guys, Please help
        • 1. Re: nullpointerexception in loadshippingGroupObjects processor
          RMishra
          This logic is generally we use to resolve this problem:
          if(shippinggroup!=null){.........}
          else{if(isLoggingDebug()){  logDebug("your message to debug");}}

          for all classes that we are creating should be debuged to resolved this issue. you can enable loggingdebug true from dyn/admin, it may help.
          -RMishra

          Edited by: RMishra on Sep 29, 2012 12:59 PM
          • 2. Re: nullpointerexception in loadshippingGroupObjects processor
            Samdani Gulam
            Can you post your code how are you accessing the commerceItem from the order ? And as mentioned by Mishra try enabling loggingDebug on the components and paste here the logs which are throwing NPE.
            • 3. Re: nullpointerexception in loadshippingGroupObjects processor
              karthik chopperla
              Is it related to only that particular order in that particular appserver's user session?? or any time???
              • 4. Re: nullpointerexception in loadshippingGroupObjects processor
                965190
                Its OOTB class and Componnet which is giving null pointer exception::
                loadShippingGroupObjects.properties
                ProcLoadShippingGroupObjects.java

                I have not overriden any of these

                there is only one log debug in the class provided by ATG

                After enabling the logdebug, that is not coming in the logs

                This exception is coming always.

                I am trying to access the commerceItems of order by order.getCommerceItems method

                Most probably, The repositoryItem of the shipping group is coming as null
                But, I don't know why
                • 5. Re: nullpointerexception in loadshippingGroupObjects processor
                  Nitin Khare
                  Can you post exception stack-trace to identify what might be happening?
                  • 6. Re: nullpointerexception in loadshippingGroupObjects processor
                    965190
                    Adding the log

                    CAUGHT AT:
                    CONTAINER:atg.service.pipeline.RunProcessException: An exception was thrown from the context of the link named [loadShippingGroupObjects].; SOURCE:java.lang.RuntimeException: Unexpected Error: repositoryItem is null in ShippingGroup null
                         at atg.service.pipeline.PipelineChain.runProcess(PipelineChain.java:371)
                         at atg.service.pipeline.PipelineChainContext.runProcess(PipelineChainContext.java:185)
                         at atg.service.pipeline.PipelineManager.runProcess(PipelineManager.java:453)
                         at atg.commerce.order.OrderImpl.ensureContainers(OrderImpl.java:1261)
                         at atg.commerce.order.OrderImpl.getCommerceItems(OrderImpl.java:691)
                    • 7. Re: nullpointerexception in loadshippingGroupObjects processor
                      965190
                      Adding the log

                      CAUGHT AT:
                      CONTAINER:atg.service.pipeline.RunProcessException: An exception was thrown from the context of the link named [loadShippingGroupObjects].; SOURCE:java.lang.RuntimeException: Unexpected Error: repositoryItem is null in ShippingGroup null
                           at atg.service.pipeline.PipelineChain.runProcess(PipelineChain.java:371)
                           at atg.service.pipeline.PipelineChainContext.runProcess(PipelineChainContext.java:185)
                           at atg.service.pipeline.PipelineManager.runProcess(PipelineManager.java:453)
                           at atg.commerce.order.OrderImpl.ensureContainers(OrderImpl.java:1261)
                           at atg.commerce.order.OrderImpl.getCommerceItems(OrderImpl.java:691)
                      • 8. Re: nullpointerexception in loadshippingGroupObjects processor
                        Nitin Khare
                        Actually ATG lazy loads the Order. First the main order item is loaded when you access it and everything else like commerce items, shipping groups and payment groups, is not loaded until the first time a piece of code access one of these details. This is what is done through OrderImpl.ensureContainers() method. So in your case looks like when it is trying to load shipping groups it seems to be failing. You can confirm on this by executing a test code like:

                        RepositoryItem orderItem = getOrderItem(); //your order item
                        List shippingGroups = (List)orderItem.getPropertyValue("shippingGroups");
                        // now iterate through shipping groups to confirm if any SG is null

                        Also, check if you are using any property extensions within shippingGroup item in OrderRepository? If this is the case then you will have to reconfigure certain properties in OrderTools and some other places as well.
                        • 9. Re: nullpointerexception in loadshippingGroupObjects processor
                          965190
                          I got the line in which i am getting nullPoniter exception

                          In ProcLoadShippingGroupObjects.java
                          String shippingAddressClassName = orderTools.getShippingGroupShippingAddressClassNameMap().getProperty(shippingClassType);

                          Caused by: java.lang.NullPointerException
                               at java.util.Hashtable.get(Hashtable.java:336)
                               at java.util.Properties.getProperty(Properties.java:774)
                               at atg.commerce.order.processor.ProcLoadShippingGroupObjects.runProcess(ProcLoadShippingGroupObjects.java:184)
                               at atg.service.pipeline.PipelineLink.runProcess(PipelineLink.java:233)
                               at atg.service.pipeline.PipelineChain.runProcess(PipelineChain.java:343)


                          I have checked in dyn/admin, it is showing as
                          hardgoodShippingGroup=atg.commerce.order.RepositoryContactInfo

                          I am using hardgoodShippingGroup only
                          • 10. Re: nullpointerexception in loadshippingGroupObjects processor
                            Nitin Khare
                            Have you checked if you are using any custom fields in shipping group? See if you are encountering the situation mentioned here

                            How to add new attributes to HardgoodShippingGroup
                            • 11. Re: nullpointerexception in loadshippingGroupObjects processor
                              karthik chopperla
                              Hashtable is throwing null pointer exception, which means that key is null and looks like the property shippingGroupClassType property in HardgoodShippingGroup is null.

                              Check what value other shippinggroups have in ACC or in db table directly. Update the value to that type and bounce the server.

                              -karthik