Page 1 of 1

Null Pointer Exception when adding category in admin

Posted: Wed Aug 07, 2013 12:11 pm
by cigano
to reproduce:
checkout the latest demo code 3.0.1-GA
startup the admin and login
click on "add category" in upper right corner

stack trace:

[ERROR] 13:49:08 AdminMappingExceptionResolver - Unhandled error processing ajax request
java.lang.NullPointerException
at java.util.Hashtable.hash(Hashtable.java:262)
at java.util.Hashtable.get(Hashtable.java:459)
at org.apache.tomcat.util.http.Parameters.getParameterValues(Parameters.java:116)
at org.apache.catalina.connector.Request.getParameterValues(Request.java:1194)
at org.apache.catalina.connector.RequestFacade.getParameterValues(RequestFacade.java:427)
at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:167)
at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:167)
at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:167)
at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:167)
at javax.servlet.ServletRequestWrapper.getParameterValues(ServletRequestWrapper.java:167)
at org.broadleafcommerce.openadmin.web.compatibility.JSCompatibilityRequestWrapper.getParameterValues(JSCompatibilityRequestWrapper.java:131)
at org.springframework.web.context.request.ServletWebRequest.getParameterValues(ServletWebRequest.java:117)
at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.resolveName(RequestParamMethodArgumentResolver.java:172)
at org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver.resolveArgument(AbstractNamedValueMethodArgumentResolver.java:85)
at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)
at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.broadleafcommerce.openadmin.web.compatibility.JSCompatibilityRequestFilter.doFilterInternal(JSCompatibilityRequestFilter.java:37)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.broadleafcommerce.openadmin.security.AdminSandBoxFilter.doFilterInternal(AdminSandBoxFilter.java:70)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.broadleafcommerce.common.web.util.PrecompressedArtifactFilter.doFilter(PrecompressedArtifactFilter.java:85)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
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.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
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.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
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.broadleafcommerce.common.security.handler.CsrfFilter.doFilter(CsrfFilter.java:82)
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.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.broadleafcommerce.openadmin.web.filter.BroadleafAdminRequestFilter.doFilterInternal(BroadleafAdminRequestFilter.java:59)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
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:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:403)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:301)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:162)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

Re: Null Pointer Exception when adding category in admin

Posted: Mon Sep 30, 2013 1:02 am
by Abhishek
Even I am facing the same issue.

Re: Null Pointer Exception when adding category in admin

Posted: Tue Oct 01, 2013 8:39 am
by phillipuniverse
Looks like someone opened an issue for it, thanks: https://github.com/BroadleafCommerce/Br ... issues/415

Re: Null Pointer Exception when adding category in admin

Posted: Tue Oct 01, 2013 4:05 pm
by presoftlimited
Below patch should fix it temporarily, as it is trying to get id but the table uses composite id.
Note: don't use in production.

Code: Select all

# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- HEAD
+++ Modified In Working Tree
@@ -311,7 +311,10 @@
         }
         Map<String, Object> idMetadata = getDynamicEntityDao().getIdMetadata(entityClass);
         String idProperty = (String) idMetadata.get("name");
-        String idVal = response.findProperty(idProperty).getValue();
+        Property idProp = response.findProperty(idProperty);
+        //if id is null means composite primary key is being used.
+        if(idProp != null){
+            String idVal = idProp.getValue();
 
         Map<String, List<String>> subPackageValidationErrors = new HashMap<String, List<String>>();
         for (Map.Entry<String,PersistencePackage> subPackage : persistencePackage.getSubPackages().entrySet()) {
@@ -343,7 +346,7 @@
             }
         }
         response.getValidationErrors().putAll(subPackageValidationErrors);
-
+        }
         if (response.isValidationFailure()) {
             throw new ValidationException(response, "The entity has failed validation");
         }

Re: Null Pointer Exception when adding category in admin

Posted: Tue Oct 08, 2013 8:31 pm
by liweinan0423
It is caused by the tomcat server you are using.
Download a latest version of tomcat and re-deploy it. It will work.

Re: Null Pointer Exception when adding category in admin

Posted: Fri Oct 11, 2013 2:42 pm
by zenman
Occurs in the default jetty also. In the admin "category" edit page "Advanced" and "Add" parent and child categories.

What class is the patch above for?

Using the default workspace for the demo, what is best way start editing the src code for the core code.

Re: Null Pointer Exception when adding category in admin

Posted: Tue Oct 15, 2013 9:38 am
by phillipuniverse
This has been resolved in the latest 3.0.3-SNAPSHOT, to be released with 3.0.3-GA. That will be released in the next couple of weeks. https://github.com/BroadleafCommerce/Br ... issues/415

Re: Null Pointer Exception when adding category in admin

Posted: Tue Oct 15, 2013 1:58 pm
by zenman
Is there a way to update the demo to include the src code for 3.0.3 SNAPSHOT.

I added some code and settings to the demo using the examples - successfully/

I imagine it is a maven setting to get the source.

I downloaded the POMs and source for 3.0.2-GA. And trying to integrate into Eclipse as a dynamic web application. So I can debu and understand some hidden broadleaf this like order casting. But I like the convenience of the demo to run.

How do the broadleaf people develop, is there an explanation on how to setup eclipse?

Re: Null Pointer Exception when adding category in admin

Posted: Wed Oct 16, 2013 5:26 pm
by zenman
Here is how to get the source code for 3.0.2-GA fror the demo

viewtopic.php?f=14&t=2217

Just do a git clone.

However you need to add "BroadleafCommerce" to the top pom.xml modules element.

inport the admin and core sub modules into your Elipse project, can add the module top for the source code as you get a name conflist, and it seems like everything buils, not to add a debugger??

Re: Null Pointer Exception when adding category in admin

Posted: Tue Jan 07, 2014 4:13 pm
by phillipuniverse
We have a section on this in the README: https://github.com/broadleafcommerce/br ... evelopment

For importing into Eclipse, go to File -> Import -> Existing Maven Projects and then point it to where you cloned the Broadleaf framework on your file system.

This is what my personal eclipse setup looks like with the framework and the heat clinic in different working sets:

Image

I imported the heat clinic with a 'com.mycompany.[artifactId]' name template (it's a prompt when you import existing maven projects) so that I wouldn't get name conflicts between 'core' and 'admin'.