Getting error while Giving Request to MyCompany in Broadleaf Commerce

无人久伴 提交于 2019-12-25 16:50:14

问题


We are using BroadLeafCommerce Framework 3.1.0 for our application, After doing all the changes,

If we'll give a request to Admin , All are good. But, If we give request to mycompany, we are getting the following stacktrace. Help me on this.

Thanks
--SKC

java.lang.NullPointerException
        at org.broadleafcommerce.common.web.BroadleafRequestCustomerResolverImpl.setCustomer(BroadleafRequestCustomerResolverImpl.java:62)
        at org.broadleafcommerce.profile.web.core.CustomerState.setCustomer(CustomerState.java:52)
        at org.broadleafcommerce.profile.web.core.security.CustomerStateRequestProcessor.process(CustomerStateRequestProcessor.java:134)
        at org.broadleafcommerce.profile.web.core.security.CustomerStateFilter.doFilter(CustomerStateFilter.java:55)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
        at org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:180)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at com.gs.ecom.core.filter.SecureRequestResponseFilter.doFilter(SecureRequestResponseFilter.java:43)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.webcastellum.WebCastellumFilter.internalDoFilter(WebCastellumFilter.java:2623)
        at org.webcastellum.WebCastellumFilter.doFilter(WebCastellumFilter.java:1717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:722

回答1:


Double check your web.xml and applicationContext.xml against a new 3.1 demo install to see if you can spot any differences.

It appears that the bean "blRequestCustomerResolver" is not being resolved. You could add a debug break point in BroadleafRequestCustomerResolverImpl to verify.

Typically, this is scanned in the applicationContext-servlet.xml. Compare the latest demo site version of this file with the one your application is using. In particular, you should see this line ...

<context:component-scan base-package="org.broadleafcommerce.common.web"/>

which is responsible for scanning the component in question.

Brian, Disclaimer : I work at Broadleaf Commerce




回答2:


Seems that a filter isn't called. org.broadleafcommerce.common.web.BroadleafRequestFilter or org.broadleafcommerce.openadmin.web.filter.BroadleafAdminRequestFilter

You need to have blRequestFilter called for each request.

Your /src/main/webapp/WEB-INF/applicationContext-filter.xml shout contain something similar to this.

<bean id="blPreSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <sec:filter-chain-map request-matcher="ant">        
        <sec:filter-chain pattern="/**" filters="
           openEntityManagerInViewFilter,
           blRequestFilter"/>
    </sec:filter-chain-map>
</bean>
<bean id="blRestPreSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <sec:filter-chain-map request-matcher="ant">        
        <sec:filter-chain pattern="/api/**" filters="
           blStatelessSessionFilter,
           openEntityManagerInViewFilter,
           blRequestFilter"/>
    </sec:filter-chain-map>
</bean>

similar for /src/main/webapp/WEB-INF/applicationContext-admin-filter.xml

<bean id="blPreSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
    <sec:filter-chain-map request-matcher="ant">
        <sec:filter-chain pattern="/**" filters="
           openEntityManagerInViewFilter,
           blAdminRequestFilter"/>
    </sec:filter-chain-map>
</bean>



回答3:


It was a configuration issue . I have followed http://www.broadleafcommerce.com/docs/core/current/migration-notes/3.0-to-3.1-migration and Resolved the issue.



来源:https://stackoverflow.com/questions/27143208/getting-error-while-giving-request-to-mycompany-in-broadleaf-commerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!