Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
LFR 7.1.3-GA4 ClassNotFound javax.portlet.PortletRequest on MVCCommand
Hi, I have a problem with classNotFound exceptions when try to create a OSGI module that overrides Liferay Login Commands.
First I expose how my code looks:My pom.xml looks like:
If I include portlet-api jar in bnd.bnd as a dependency...
First I expose how my code looks:My pom.xml looks like:
[code]<!--?xml version="1.0" encoding="UTF-8"?-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelversion>4.0.0</modelversion>
<groupid>com.my.company.core</groupid>
<artifactid>custom-login-action</artifactid>
<version>2.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<!-- Base -->
<dependency>
<groupid>com.liferay.portal</groupid>
<artifactid>com.liferay.portal.kernel</artifactid>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>org.osgi</groupid>
<artifactid>org.osgi.service.component.annotations</artifactid>
<version>1.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>org.osgi</groupid>
<artifactid>osgi.cmpn</artifactid>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>org.osgi</groupid>
<artifactid>osgi.core</artifactid>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>
<!-- Portlet and Servlet api-->
<dependency>
<groupid>javax.portlet</groupid>
<artifactid>portlet-api</artifactid>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>javax.servlet</groupid>
<artifactid>javax.servlet-api</artifactid>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<!-- Logging -->
<dependency>
<groupid>org.slf4j</groupid>
<artifactid>slf4j-api</artifactid>
<version>1.7.26</version>
</dependency>
</dependencies>
<build>
<finalname>com.my.company.core.liferay.login-action-${project.version}</finalname>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-jar-plugin</artifactid>
<version>2.6</version>
<configuration>
<archive>
<manifestfile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestfile>
</archive>
</configuration>
</plugin>
<plugin>
<groupid>org.apache.felix</groupid>
<artifactid>maven-bundle-plugin</artifactid>
<version>2.0.1</version>
<extensions>true</extensions>
<executions>
<execution>
<id>wrap-my-dependency</id>
<goals>
<goal>wrap</goal>
</goals>
<configuration>
<wrapimportpackage>;</wrapimportpackage>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupid>com.liferay</groupid>
<artifactid>com.liferay.portal.tools.bundle.support</artifactid>
<version>3.4.2</version>
<executions>
<execution>
<id>clean</id>
<goals>
<goal>clean</goal>
</goals>
<phase>clean</phase>
</execution>
<execution>
<id>deploy</id>
<goals>
<goal>deploy</goal>
</goals>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupid>biz.aQute.bnd</groupid>
<artifactid>bnd-maven-plugin</artifactid>
<version>3.5.0</version>
<executions>
<execution>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupid>biz.aQute.bnd</groupid>
<artifactid>biz.aQute.bndlib</artifactid>
<version>3.5.0</version>
</dependency>
<dependency>
<groupid>com.liferay</groupid>
<artifactid>com.liferay.ant.bnd</artifactid>
<version>2.0.50</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactid>maven-compiler-plugin</artifactid>
<version>2.5</version>
<configuration>
<source>1.8
<target>1.8</target>
<debug>true</debug>
</configuration>
</plugin>
</plugins>
</build>
</project>
My bnd.bnd looks like:[code]Bundle-Name: com.my.company.core.liferay.login-action
Bundle-SymbolicName: com.my.company.core.liferay.login-action
Bundle-Version: 1.0.0
Import-Package: *;resolution:=optional
And finally my CustomLoginAction looks like:[code]package com.my.company.core.liferay.actions;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.servlet.http.HttpServletRequest;
import com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionCommand;
import com.liferay.portal.kernel.util.PortalUtil;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author ramon
*/
@Component(
immediate = true,
property = {
"javax.portlet.name=com_liferay_login_web_portlet_FastLoginPortlet",
"javax.portlet.name=com_liferay_login_web_portlet_LoginPortlet",
"mvc.command.name=/login/login",
"service.ranking:Integer=100"
},
service = MVCActionCommand.class
)
public class CustomLoginAction extends BaseMVCActionCommand {
private static final Logger logger = LoggerFactory.getLogger(CustomLoginAction.class);
@Reference(
target = "(component.name=com.liferay.login.web.internal.portlet.action.LoginMVCActionCommand)")
protected MVCActionCommand mvcActionCommand;
@Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws Exception {
HttpServletRequest request = PortalUtil.getOriginalServletRequest(
PortalUtil.getHttpServletRequest(actionRequest));
mvcActionCommand.processAction(actionRequest, actionResponse);
}
}
If I deploy this generated jar on Liferay 7.1.3-ga4 on Tomcat I got this ClassNotException:2019-08-23 05:42:37.121 INFO [fileinstall-/Users/ramon/Documents/developement/servers/liferay713-ga4/liferay-portal-7.1.3-ga4-tomcat/osgi/modules][BundleStartStopLogger:39] STARTED com.my.company.core.liferay.login-action_1.0.0 [1061]
2019-08-23 05:42:37.131 ERROR [fileinstall-/Users/ramon/Documents/developement/servers/liferay713-ga4/liferay-portal-7.1.3-ga4-tomcat/osgi/modules][com_my_company_core_liferay_login-action:97] bundle com.my.company.core.liferay.login-action:1.0.0 (1061)BundleComponentActivator : Unexpected failure enabling component holder com.my.company.core.liferay.actions.CustomLoginAction
java.lang.NoClassDefFoundError: javax/portlet/PortletRequest
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructors(Class.java:1651)
at org.apache.felix.scr.impl.inject.ComponentConstructor.<init>(ComponentConstructor.java:94)
at org.apache.felix.scr.impl.inject.ComponentMethodsImpl.initComponentMethods(ComponentMethodsImpl.java:106)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.initDependencyManagers(AbstractComponentManager.java:1008)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.collectDependencies(AbstractComponentManager.java:1026)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:936)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:756)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432)
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665)
at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:381)
at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49)
at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:263)
at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196)
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169)
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
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.start(Module.java:467)
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.ClassNotFoundException: javax.portlet.PortletRequest cannot be found by com.my.company.core.liferay.login-action_1.0.0
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:508)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 38 more
</init>
The status on gogo shell with this deploy is SATISFIED....If I include portlet-api jar in bnd.bnd as a dependency...
[code]Bundle-Name: com.my.company.core.liferay.login-action
Bundle-SymbolicName: com.my.company.core.liferay.login-action
Bundle-Version: 1.0.0
-includeresource: \
META-INF/lib/portlet-api-3.0.1.jar=portlet-api-3.0.1.jar;lib:=true
-sources: false
Import-Package: *;resolution:=optional
I got:2019-08-23 05:46:22.494 WARN [Refresh Thread: Equinox Container: c7c7ca74-d7dd-4711-a295-e2d485217997][com_my_company_core_liferay_login-action:103] bundle com.my.company.core.liferay.login-action:1.0.0 (1061)[com.my.company.core.liferay.actions.CustomLoginAction(4048)] : activate cannot be found
java.lang.LinkageError: loader constraint violation: loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) previously initiated loading for a different type with name "javax/portlet/ActionRequest"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:276)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:634)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:555)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:514)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:501)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:392)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:470)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:419)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:411)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethod(Class.java:2128)
at org.apache.felix.scr.impl.inject.methods.BaseMethod.getMethod(BaseMethod.java:326)
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.doFindMethod(ActivateMethod.java:71)
at org.apache.felix.scr.impl.inject.methods.BaseMethod.findMethod(BaseMethod.java:173)
at org.apache.felix.scr.impl.inject.methods.BaseMethod.access$400(BaseMethod.java:41)
at org.apache.felix.scr.impl.inject.methods.BaseMethod$NotResolved.resolve(BaseMethod.java:602)
at org.apache.felix.scr.impl.inject.methods.BaseMethod$NotResolved.methodExists(BaseMethod.java:626)
at org.apache.felix.scr.impl.inject.methods.BaseMethod.methodExists(BaseMethod.java:528)
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:315)
at org.apache.felix.scr.impl.inject.methods.ActivateMethod.invoke(ActivateMethod.java:307)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:341)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:114)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:983)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:956)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:756)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enableInternal(AbstractComponentManager.java:666)
at org.apache.felix.scr.impl.manager.AbstractComponentManager.enable(AbstractComponentManager.java:432)
at org.apache.felix.scr.impl.manager.ConfigurableComponentHolder.enableComponents(ConfigurableComponentHolder.java:665)
at org.apache.felix.scr.impl.BundleComponentActivator.initialEnable(BundleComponentActivator.java:339)
at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:381)
at org.apache.felix.scr.impl.Activator.access$200(Activator.java:49)
at org.apache.felix.scr.impl.Activator$ScrExtension.start(Activator.java:263)
at org.apache.felix.scr.impl.AbstractExtender.createExtension(AbstractExtender.java:196)
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:169)
at org.apache.felix.scr.impl.AbstractExtender.modifiedBundle(AbstractExtender.java:49)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:488)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
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.start(Module.java:467)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:777)
at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:768)
at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:538)
at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:484)
at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:1028)
at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1409)
at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
2019-08-23 05:46:22.497 INFO [Refresh Thread: Equinox Container: c7c7ca74-d7dd-4711-a295-e2d485217997][BundleStartStopLogger:39] STARTED com.my.company.core.liferay.login-action_1.0.0 [1061]
But the status in gogo shell is ACTIVE... but when I try to do login it fails with other linkage exceptions 23-Aug-2019 05:51:13.461 SEVERE [http-nio-18080-exec-4] org.apache.catalina.core.ApplicationDispatcher.invoke Servlet.service() for servlet [Main Servlet] threw exception
java.lang.LinkageError: loader constraint violation: when resolving method "com.liferay.portal.kernel.util.PortalUtil.getHttpServletRequest(Ljavax/portlet/PortletRequest;)Ljavax/servlet/http/HttpServletRequest;" the class loader (instance of org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the current class, com/my/company/core/liferay/actions/CustomLoginAction, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, com/liferay/portal/kernel/util/PortalUtil, have different Class objects for the type javax/portlet/PortletRequest used in the signature
at com.my.company.core.liferay.actions.CustomLoginAction.doProcessAction(CustomLoginAction.java:41)
at com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand.processAction(BaseMVCActionCommand.java:61)
Some idea about what is the error in my proposal???Thanks in advance!!
Some idea about what is the error in my proposal?
The only thing I can think of is if the manifest is built incorrectly from your current plugin configuration, since the 7.1 Blade samples use a different set of plugins (reference). Notably, there isn't any mention of org.apache.felix:maven-bundle-plugin in the Blade sample.
Can you try removing the references to org.apache.felix:maven-bundle-plugin? If that doesn't work, can you provide the contents of the META-INF/MANIFEST.MF from your compiled .jar?
The only thing I can think of is if the manifest is built incorrectly from your current plugin configuration, since the 7.1 Blade samples use a different set of plugins (reference). Notably, there isn't any mention of org.apache.felix:maven-bundle-plugin in the Blade sample.
Can you try removing the references to org.apache.felix:maven-bundle-plugin? If that doesn't work, can you provide the contents of the META-INF/MANIFEST.MF from your compiled .jar?
Hi Michchau,First thanks for your reply...I remove the plugins references to org.apache.felix:maven-bundle-plugin, use exactly the same as the blade sample, as you as suggest.....But the exception is trowed...The MANIFEST of generated jar is:
Manifest-Version: 1.0
Bundle-SymbolicName: com.my.company.core.liferay.login-action
Archiver-Version: Plexus Archiver
Built-By: ramon
Bnd-LastModified: 1566628996031
Bundle-ManifestVersion: 2
Import-Package: com.liferay.portal.kernel.portlet.bridges.mvc;resoluti
on:=optional;version="[1.6,2)",com.liferay.portal.kernel.util;resolut
ion:=optional;version="[8.0,9)",javax.portlet;resolution:=optional;ve
rsion="[3.0,4)",javax.servlet.http;resolution:=optional;version="[3.0
,4)",org.slf4j;resolution:=optional;version="[1.7,2)"
Require-Capability: osgi.extender;filter:="(&(osgi.extender=osgi.compo
nent)(version>=1.3.0)(!(version>=2.0.0)))",osgi.service;filter:="(obj
ectClass=com.liferay.portal.kernel.portlet.bridges.mvc.MVCActionComma
nd)";effective:=active,osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.
8))"
Service-Component: OSGI-INF/com.my.company.core.liferay.actions.Custom
LoginAction.xml
Tool: Bnd-3.5.0.201709291849
Provide-Capability: osgi.service;objectClass:List<string>="com.liferay
.portal.kernel.portlet.bridges.mvc.MVCActionCommand"
Bundle-Name: com.my.company.core.liferay.login-action
Bundle-Version: 1.0.0
Private-Package: com.my.company.core.liferay.actions
Created-By: 1.8.0_212 (Oracle Corporation)
Build-Jdk: 1.8.0_212
</string>
I think it is correct...... but the deployment fails.....Thanks in advance...
javax.portlet;resolution:=optional;version="[3.0,4)"
Ah, that makes sense then. If you run the following command in GoGo shell, you should see that Liferay is actually claiming to provide version 2.0 of the package due to LPS-81636, so that portlets built when 7.1 was released continue to work on later versions of 7.1, even though we finished our Portlet 3.0 implementation:
In our Gradle tooling, we remove the version from javax.portlet's import in order to avoid this problem. I checked the Blade sample and noticed that it's importing version 2.0 of the API, so that it doesn't run into this problem, so it looks like our Maven tooling doesn't have the features mentioned in LPS-81636.
As a workaround, can you try adding the following to your bnd.bnd?
Ah, that makes sense then. If you run the following command in GoGo shell, you should see that Liferay is actually claiming to provide version 2.0 of the package due to LPS-81636, so that portlets built when 7.1 was released continue to work on later versions of 7.1, even though we finished our Portlet 3.0 implementation:
inspect cap osgi.wiring.package 0 | grep javax.portlet
In our Gradle tooling, we remove the version from javax.portlet's import in order to avoid this problem. I checked the Blade sample and noticed that it's importing version 2.0 of the API, so that it doesn't run into this problem, so it looks like our Maven tooling doesn't have the features mentioned in LPS-81636.
As a workaround, can you try adding the following to your bnd.bnd?
Import-Package: javax.portlet;version="[2,4)",*
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™