core icon indicating copy to clipboard operation
core copied to clipboard

NullPointer exception from the edit content screen when adding a new subaction to default workflow

Open gabbydotCMS opened this issue 14 years ago • 1 comments

We were trying to show Dean how the SOLR workflow needs to be configured in our S&P local environment.

After assigning a new sub-action to the default workflow schema (SOLR specific sub-action contained in the SOLR plugin), we got a NullPointer exception when trying to edit a contentlet.

[25/05/12 15:10:05:805 EDT] ERROR contentlet.contentlet005factions005fwrapperjsp]: Servlet.service() for servlet org.apache.jsp.html.portlet.ext.contentlet.contentlet005factions005fwrapperjsp threw exception java.lang.NullPointerException: null is not a valid identifier at net.sf.hibernate.impl.SessionImpl.load(SessionImpl.java:1929) at com.dotmarketing.db.HibernateUtil.load(HibernateUtil.java:236) at com.dotcms.content.elasticsearch.business.ESContentFactoryImpl.find(ESContentFactoryImpl.java:704) at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.find(ESContentletAPIImpl.java:183) at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.find(ContentletAPIInterceptor.java:591) at org.apache.jsp.html.portlet.ext.contentlet.contentlet005factions005fwrapperjsp.jspService(contentlet005factions005fwrapper_jsp.java:307) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.CMSFilter.doFilter(CMSFilter.java:126) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.AutoLoginFilter.doFilter(AutoLoginFilter.java:61) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.cms.urlmap.filters.URLMapFilter.doFilter(URLMapFilter.java:86) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at com.dotmarketing.filters.CharsetEncodingFilter.doFilter(CharsetEncodingFilter.java:140) 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:465) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:859) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1555) at java.lang.Thread.run(Thread.java:662)

Ozzy checked the exception out and figured out that there was something missing in the method refreshWorkFlowActionletMap() in this class: com.dotmarketing.portlets.workflows.business.WorkflowAPIImpl.java.

He added what is in line 590 - actionletClasses.add(actionlet.getClass()); - in the code below:

551 private void refreshWorkFlowActionletMap() { 552 actionletMap = null; 553 if (actionletMap == null) { 554 synchronized (this.getClass()) { 555 if (actionletMap == null) { 556 557 List actionletList = new ArrayList(); 558 559 // get the dotmarketing-config.properties actionlet classes 560 String customActionlets = Config.getStringProperty(WebKeys.WORKFLOWACTIONLETCLASSES); 561 562 StringTokenizer st = new StringTokenizer(customActionlets, ","); 563 while (st.hasMoreTokens()) { 564 String clazz = st.nextToken(); 565 try { 566 WorkFlowActionlet actionlet = (WorkFlowActionlet) Class.forName(clazz.trim()).newInstance(); 567 actionletList.add(actionlet); 568 } catch (Exception e) { 569 Logger.error(WorkflowAPIImpl.class, e.getMessage(), e); 570 } 571 } 572 573 // get the included (shipped with) actionlet classes 574 for (Class z : actionletClasses) { 575 try { 576 actionletList.add(z.newInstance()); 577 } catch (InstantiationException e) { 578 Logger.error(WorkflowAPIImpl.class, e.getMessage(), e); 579 } catch (IllegalAccessException e) { 580 Logger.error(WorkflowAPIImpl.class, e.getMessage(), e); 581 } 582 } 583 584 Collections.sort(actionletList, new ActionletComparator()); 585 actionletMap = new LinkedHashMap<String, WorkFlowActionlet>(); 586 for(WorkFlowActionlet actionlet : actionletList){ 587 588 try { 589 actionletMap.put(actionlet.getClass().getCanonicalName(),actionlet.getClass().newInstance()); 590 actionletClasses.add(actionlet.getClass()); 591 } catch (InstantiationException e) { 592 Logger.error(WorkflowAPIImpl.class,e.getMessage(),e); 593 } catch (IllegalAccessException e) { 594 Logger.error(WorkflowAPIImpl.class,e.getMessage(),e); 595 } 596 } 597 } 598 } 599 600 } 601 }

That fixed the issue and we were able to complete our configuration of the workflows for S&P and the integration with SOLR.

gabbydotCMS avatar Jun 08 '12 14:06 gabbydotCMS

new sub action working fine... re-edited sub-action too, no errors in log

DeanGonzalez avatar Jun 11 '12 15:06 DeanGonzalez