0
votes

I implemented a Liferay 7.2 portletmvc4spring module, I followed this tutorial https://github.com/liferay/portletmvc4spring/blob/master/README.md 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...

The problem is the following :

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

java.lang.ClassCastException: com.liferay.portletmvc4spring.DispatcherPortlet cannot be cast to javax.portlet.Portlet

The full trace is the following :

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.
Warning: WEB-INF/classes/log4j.properties modified in the future.
Warning: WEB-INF/lib/Pportlet-api-3.0.0.jar modified in the future.
Warning: WEB-INF/lib/api-model-3.6.4.jar modified in the future.
Warning: WEB-INF/lib/cdi-api-1.2.jar modified in the future.
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.
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]

This is my Portlet.xml file :

<?xml version="1.0"?>

<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">
    <portlet>
        <portlet-name>springDisptachar</portlet-name>
        <portlet-class>com.liferay.portletmvc4spring.DispatcherPortlet</portlet-class>
        <init-param>
            <name>contextConfigLocation</name>
            <value>/WEB-INF/spring-context/portlet/portlet1-context.xml</value>
        </init-param>
        <expiration-cache>0</expiration-cache>
        <supports>
            <mime-type>text/html</mime-type>
            <portlet-mode>view</portlet-mode>
            <portlet-mode>edit</portlet-mode>
            <portlet-mode>help</portlet-mode>
        </supports>
        <resource-bundle>content.language</resource-bundle>
        <portlet-preferences>
            <preference>
                <name>datePattern</name>
                <value>MM/dd/yyyy</value>
            </preference>
            <preference>
                <name>recipientEmailAddress</name>
                <value>[email protected]</value>
            </preference>
        </portlet-preferences>
        <security-role-ref>
            <role-name>administrator</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>guest</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>power-user</role-name>
        </security-role-ref>
        <security-role-ref>
            <role-name>user</role-name>
        </security-role-ref>
    </portlet>


    <filter>
        <filter-name>SpringSecurityPortletFilter</filter-name>
        <filter-class>com.liferay.portletmvc4spring.security.SpringSecurityPortletFilter</filter-class>
        <lifecycle>ACTION_PHASE</lifecycle>
        <lifecycle>RENDER_PHASE</lifecycle>
        <lifecycle>RESOURCE_PHASE</lifecycle>
    </filter>
    <filter-mapping>
        <filter-name>SpringSecurityPortletFilter</filter-name>
        <portlet-name>baseLr7Portlet</portlet-name>
    </filter-mapping>
</portlet-app>

Any advice is appreciated. Thanks a lot ... Regards

2

2 Answers

1
votes

In order to address problems like this, I find it helpful to start with a minimal portlet project that deploys and runs correctly. For example, I recommend that you start by generating a PortletMVC4Spring JSP project from the archetype:

mvn archetype:generate \
    -DarchetypeGroupId=com.liferay.portletmvc4spring.archetype \
    -DarchetypeArtifactId=com.liferay.portletmvc4spring.archetype.form.jsp.portlet \
    -DarchetypeVersion=5.2.0 \
    -DgroupId=com.mycompany \
    -DartifactId=com.mycompany.my.form.jsp.portlet

Then, gradually add dependencies and/or features one-at-a-time, re-deploying after each change, until the problem occurs.

One thing I noticed is that your portlet WAR contains some dependencies in WEB-INF/lib that probably shouldn't be there. For example:

  • WEB-INF/lib/cdi-api-1.2.jar
  • WEB-INF/lib/javax.el-api-3.0.0.jar
  • WEB-INF/lib/javax.interceptor-api-1.2.jar

The CDI API jar is especially concerning, since CDI and Spring are almost always mutually exclusive.

0
votes

This error happens in different situations. One possible case is that you have multiple *.jar file implementing Interface Portlet.java. When I faced this problem, I removed all deployed plugins from my application server (webapps of Tomcat in my system) and revised liferay-plugin-package.properties so I left only those jars in portal.dependency.jars that were necessary and removed the others. Then I deployed the plugin again and the problem was resolved.