title: Liferay 7.2- Spring MVC Porltlet: java.lang.ClassCastException: class com.liferay.portletmvc4spring.ViewRendererServlet Problem when deployment
body: <p>I implemented a Liferay 7.2 portletmvc4spring module, I followed this tutorial <a href="https://github.com/liferay/portletmvc4spring/blob/master/README.md" rel="nofollow noreferrer">https://github.com/liferay/portletmvc4spring/blob/master/README.md</a> but I have a problem when deploying this portlet to Lr7.2 instance ( i searched in google but I didn't found a concrete solution ) maybe some one had the same issue in the past and could help maybe...</p>
  
  <p>The problem is the following : </p>
  
  <blockquote>
    <p>2020-01-06 20:36:43.468 ERROR
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][WebXMLDefinitionLoader:1130]
    baseLr7Portlet_1.0.0 [1148] una java.lang.ClassCastException: class
    com.liferay.portletmvc4spring.ViewRendererServlet</p>
    
    <p>java.lang.ClassCastException: com.liferay.portletmvc4spring.DispatcherPortlet cannot be cast to javax.portlet.Portlet</p>
  </blockquote>
  
  <p>The full trace is the following : </p>
  
  <blockquote>
    <p>2020-01-06 20:36:13.337 INFO 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][BaseAutoDeployListener:43]
    Copying portlets for /usr/share/peLr7Portlet.war 2020-01-06
    20:36:13.378 INFO 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][BaseDeployer:877]
    Deploying baseLr7Portlet.war   Warning: META-INF/MANIFEST.MF modified
    in the future.   Warning:
    META-INF/maven/com.company.portail/baseLr7Portlet/pom.properties
    modified in the future.   Warning:
    META-INF/maven/com.company.portail/baseLr7Portlet/pom.xml modified in
    the future.   Warning: WEB-INF/classes/ValidationMessages.properties
    modified in the future.   Warning:
    WEB-INF/classes/com/company/portail/demo/applicant/ApplicantPortlet.class
    modified in the future.   Warning:
    WEB-INF/classes/com/company/portail/demo/configuration/ContactConfiguration.class
    modified in the future.   Warning:
    WEB-INF/classes/com/company/portail/demo/configuration/ContactLanguage.class
    modified in the future.   Warning:
    WEB-INF/classes/com/company/portail/demo/controller/DemandeContactController.class
    modified in the future.   Warning:
    WEB-INF/classes/content/language.properties modified in the future.<br>
    Warning: WEB-INF/classes/log4j.properties modified in the future.<br>
    Warning: WEB-INF/lib/Pportlet-api-3.0.0.jar modified in the future.<br>
    Warning: WEB-INF/lib/api-model-3.6.4.jar modified in the future.<br>
    Warning: WEB-INF/lib/cdi-api-1.2.jar modified in the future.<br>
    Warning: WEB-INF/lib/com.liferay.portletmvc4spring.framework-5.2.0.jar
    modified in the future.   Warning:
    WEB-INF/lib/com.liferay.portletmvc4spring.security-5.2.0.jar modified
    in the future.   Warning: WEB-INF/lib/javax.el-api-3.0.0.jar modified
    in the future.   Warning: WEB-INF/lib/javax.interceptor-api-1.2.jar
    modified in the future.   Warning:
    WEB-INF/lib/portail-common-3.6.4.jar modified in the future.<br>
    Warning: WEB-INF/lib/portlet-servlet-adapter-3.1.0.jar modified in the
    future.   Warning: WEB-INF/liferay-plugin-package.properties modified
    in the future.   Warning:
    WEB-INF/spring-context/portlet-application-context.xml modified in the
    future.   Warning: WEB-INF/spring-context/portlet/portlet1-context.xml
    modified in the future.   Warning: WEB-INF/classes/com modified in the
    future.   Warning: WEB-INF/classes/com/company modified in the
    future.   Warning:
    WEB-INF/classes/com/company/portail/demo/configuration modified in
    the future.   Warning: WEB-INF/spring-context modified in the future. 
    Warning: images modified in the future. 2020-01-06 20:36:14.440 INFO 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][BaseAutoDeployListener:50]
    Portlets for /usr/share/portail/llet.war copied successfully
    2020-01-06 20:36:43.468 ERROR
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][WebXMLDefinitionLoader:1130]
    baseLr7Portlet_1.0.0 [1148] una java.lang.ClassCastException: class
    com.liferay.portletmvc4spring.ViewRendererServlet
            at java.lang.Class.asSubclass(Class.java:3404)
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader._getServletInstance(WebXMLDefinitionLoader.java:1124
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader._setServlet(WebXMLDefinitionLoader.java:1164)
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader.endElement(WebXMLDefinitionLoader.java:353)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
            at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
            at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
            at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
            at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
            at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader.loadWebXMLDefinition(WebXMLDefinitionLoader.java:520
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader.loadWebXML(WebXMLDefinitionLoader.java:456)
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationImpl.(ServletContextHelperRegistrationImpl.java:
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationServiceFactory.getService(ServletContextHelperRegistra
            at com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationServiceFactory.getService(ServletContextHelperRegistra
            at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210)
            at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111)
            at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45)
            at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:524)
            at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:464)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:624)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initContext(WabBundleProcessor.java:456)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:136)
            at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:179)
            at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:101)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:114)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory.addingBundle(WabFactory.java:67)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory.addingBundle(WabFactory.java:49)
            at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475)
            at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
            at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
            at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
            at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
            at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
            at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
            at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
            at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
            at org.eclipse.osgi.container.Module.doStart(Module.java:578)
            at org.eclipse.osgi.container.Module.start(Module.java:449)
            at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1264)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1237)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
    2020-01-06 20:43:26.926 ERROR
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][PortletLocalServiceImpl:2567]
    Filter mapping with filter name SpringSecurityPortletFilter references
    unknown portlet name baseLr7Portlet 2020-01-06 20:43:26.946 WARN 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][PortletLocalServiceImpl:876]
    Portlet with the name springDisptachar_WAR_baseLr7Portlet is described
    in portlet.xml but does not have a matching entry in
    liferay-portlet.xml 2020-01-06 20:43:26.946 WARN 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][PortletLocalServiceImpl:888]
    Portlet with the name baseLr7Portlet_WAR_baseLr7Portlet is described
    in liferay-portlet.xml but does not have a matching entry in
    portlet.xml 2020-01-06 20:43:26.954 ERROR
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][PortletLocalServiceImpl:930]
    java.lang.ClassCastException:
    com.liferay.portletmvc4spring.DispatcherPortlet cannot be cast to
    javax.portlet.Portlet java.lang.ClassCastException:
    com.liferay.portletmvc4spring.DispatcherPortlet cannot be cast to
    javax.portlet.Portlet
            at com.liferay.portlet.PortletBagFactory._getPortletInstance(PortletBagFactory.java:295)
            at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:106)
            at com.liferay.portal.service.impl.PortletLocalServiceImpl.initWAR(PortletLocalServiceImpl.java:918)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at com.liferay.portal.spring.aop.AopMethodInvocationImpl.proceed(AopMethodInvocationImpl.java:50)
            at com.liferay.portal.spring.aop.AopInvocationHandler.invoke(AopInvocationHandler.java:49)
            at com.sun.proxy.$Proxy138.initWAR(Unknown Source)
            at com.liferay.portal.kernel.service.PortletLocalServiceUtil.initWAR(PortletLocalServiceUtil.java:457)
            at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:228)
            at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:96)
            at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:232)
            at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:97)
            at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
            at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:189)
            at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:179)
            at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
            at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:75)
            at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:57)
            at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
            at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:141)
            at com.liferay.portal.kernel.servlet.SecurePluginContextListener.contextInitialized(SecurePluginContextListener.java:152)
            at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter._initializeContext(ServletContextListenerExceptionAdapter.java:119)
            at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter.contextInitialized(ServletContextListenerExceptionAdapter.java:99)
            at sun.reflect.GeneratedMethodAccessor186.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at org.eclipse.equinox.http.servlet.internal.registration.ListenerRegistration$EventListenerInvocationHandler.invoke(ListenerRegistration.java:143)
            at com.sun.proxy.$Proxy932.contextInitialized(Unknown Source)
            at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddListenerRegistration(ContextController.java:350)
            at org.eclipse.equinox.http.servlet.internal.context.ContextController.addListenerRegistration(ContextController.java:303)
            at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:67)
            at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:1)
            at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
            at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
            at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
            at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
            at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:903)
            at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
            at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:891)
            at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804)
            at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
            at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:469)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:487)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1004)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initListeners(WabBundleProcessor.java:623)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:216)
            at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:179)
            at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:101)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:114)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory.addingBundle(WabFactory.java:67)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory.addingBundle(WabFactory.java:49)
            at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475)
            at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
            at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
            at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
            at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
            at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
            at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
            at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
            at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
            at org.eclipse.osgi.container.Module.doStart(Module.java:578)
            at org.eclipse.osgi.container.Module.start(Module.java:449)
            at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1264)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1237)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
    2020-01-06 20:43:27.023 INFO 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][PortletHotDeployListener:310]
    0 portlets for baseLr7Portlet are available for use 2020-01-06
    20:43:27.512 ERROR
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][WabBundleProcessor:229]
    Catastrophic initialization failure! Shutting down baseLr7Portlet WAB
    due to: null java.lang.reflect.UndeclaredThrowableException
            at com.sun.proxy.$Proxy935.registerServlets(Unknown Source)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:222)
            at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:179)
            at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:101)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:114)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory.addingBundle(WabFactory.java:67)
            at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory.addingBundle(WabFactory.java:49)
            at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475)
            at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:1)
            at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
            at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
            at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450)
            at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
            at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
            at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:230)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:137)
            at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:129)
            at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:191)
            at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
            at org.eclipse.osgi.container.Module.doStart(Module.java:578)
            at org.eclipse.osgi.container.Module.start(Module.java:449)
            at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1264)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1237)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
            at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
    Caused by: java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ModifiableServletContextAdapter.invoke(ModifiableServletContextAdapter.java:447)
            ... 28 more Caused by: java.lang.NullPointerException
            at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ModifiableServletContextAdapter.addServlet(ModifiableServletContextAdapter.java:233)
            at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ModifiableServletContextAdapter.registerServlets(ModifiableServletContextAdapter.java:582)
            ... 33 more 2020-01-06 20:43:27.549 INFO  [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][PortletHotDeployListener:408]
    0 portlets for baseLr7Portlet were unregistered 2020-01-06
    20:43:27.788 INFO 
    [fileinstall-/usr/share/portail/liferay-portal-7.2.0-ga1/osgi/war][BundleStartStopLogger:39]
    STARTED baseLr7Portlet_1.0.0 [1148]</p>
  </blockquote>
  
  <p>This is my Portlet.xml file : </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  
  &lt;portlet-app xmlns="http://xmlns.jcp.org/xml/ns/portlet"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/portlet http://xmlns.jcp.org/xml/ns/portlet/portlet-app_3_0.xsd"
      version="3.0"&gt;
      &lt;portlet&gt;
          &lt;portlet-name&gt;springDisptachar&lt;/portlet-name&gt;
          &lt;portlet-class&gt;com.liferay.portletmvc4spring.DispatcherPortlet&lt;/portlet-class&gt;
          &lt;init-param&gt;
              &lt;name&gt;contextConfigLocation&lt;/name&gt;
              &lt;value&gt;/WEB-INF/spring-context/portlet/portlet1-context.xml&lt;/value&gt;
          &lt;/init-param&gt;
          &lt;expiration-cache&gt;0&lt;/expiration-cache&gt;
          &lt;supports&gt;
              &lt;mime-type&gt;text/html&lt;/mime-type&gt;
              &lt;portlet-mode&gt;view&lt;/portlet-mode&gt;
              &lt;portlet-mode&gt;edit&lt;/portlet-mode&gt;
              &lt;portlet-mode&gt;help&lt;/portlet-mode&gt;
          &lt;/supports&gt;
          &lt;resource-bundle&gt;content.language&lt;/resource-bundle&gt;
          &lt;portlet-preferences&gt;
              &lt;preference&gt;
                  &lt;name&gt;datePattern&lt;/name&gt;
                  &lt;value&gt;MM/dd/yyyy&lt;/value&gt;
              &lt;/preference&gt;
              &lt;preference&gt;
                  &lt;name&gt;recipientEmailAddress&lt;/name&gt;
                  &lt;value&gt;email@test.fr&lt;/value&gt;
              &lt;/preference&gt;
          &lt;/portlet-preferences&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;administrator&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;guest&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;power-user&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
          &lt;security-role-ref&gt;
              &lt;role-name&gt;user&lt;/role-name&gt;
          &lt;/security-role-ref&gt;
      &lt;/portlet&gt;
  
  
      &lt;filter&gt;
          &lt;filter-name&gt;SpringSecurityPortletFilter&lt;/filter-name&gt;
          &lt;filter-class&gt;com.liferay.portletmvc4spring.security.SpringSecurityPortletFilter&lt;/filter-class&gt;
          &lt;lifecycle&gt;ACTION_PHASE&lt;/lifecycle&gt;
          &lt;lifecycle&gt;RENDER_PHASE&lt;/lifecycle&gt;
          &lt;lifecycle&gt;RESOURCE_PHASE&lt;/lifecycle&gt;
      &lt;/filter&gt;
      &lt;filter-mapping&gt;
          &lt;filter-name&gt;SpringSecurityPortletFilter&lt;/filter-name&gt;
          &lt;portlet-name&gt;baseLr7Portlet&lt;/portlet-name&gt;
      &lt;/filter-mapping&gt;
  &lt;/portlet-app&gt;
  </code></pre>
  
  <p>Any advice is appreciated. Thanks a lot ...
  Regards</p>