Foren

Liferay module development error

thumbnail
Pratik Sayare, geändert vor 6 Jahren.

Liferay module development error

New Member Beiträge: 20 Beitrittsdatum: 10.08.17 Neueste Beiträge
Hi,

I followed instructions as per post https://web.liferay.com/web/user.26526/blog/-/blogs/extending-liferay-osgi-modules to customize module.

I modified com.liferay.portal.security.sso.opensso.internal.OpenSSOImpl.java

Below is my bnd.bnd

Bundle-Name: Liferay Portal Security SSO OpenSSO
Bundle-SymbolicName: com.liferay.portal.security.sso.opensso
Bundle-Version: 3.0.10
Export-Package:\
com.liferay.portal.security.sso.opensso.configuration,\
com.liferay.portal.security.sso.opensso.constants
Liferay-Releng-Module-Group-Description:
Liferay-Releng-Module-Group-Title: Security Frameworks

Include-Resource: @com.liferay.portal.security.sso.opensso-3.0.9.jar

Below is my build.gradle

buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "2.0.10"
}

repositories {
mavenLocal()

maven {
url "https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public"
}
}
}

apply plugin: "com.liferay.plugin"

dependencies {
compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.configuration.metatype", version: "2.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.exportimport.api", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.21.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.49.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"

compile group: "com.liferay", name: "com.liferay.portal.security.sso.opensso", version: "3.0.9"
}

jar.archiveName = 'com.liferay.portal.security.sso.opensso.jar'

repositories {
mavenLocal()

maven {
url "https://cdn.lfrs.sl/repository.liferay.com/nexus/content/groups/public"
}
}

I can successfully build the jar then placed in override folder. When liferay starts it shows Disabled Liferay CE Foundation:/com.liferay.portal.security.sso.opensso-3.0.7.jar means new jar is getting applied.

Then it gives below errors

09:51:43,066 ERROR [Framework Event Dispatcher: Equinox Container: b0aa82f4-20c9-0017-11a6-b8198979ee61][com_liferay_portal_settings_authentication_opensso_web:97] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: com.liferay.portal.settings.authentication.opensso.web [367]_ Unresolved requirement: Import-Package: com.liferay.portal.security.sso.opensso.configuration; version="[2.0.0,3.0.0)"_ -> Export-Package: com.liferay.portal.security.sso.opensso.configuration; bundle-symbolic-name="com.liferay.portal.security.sso.opensso"; bundle-version="3.0.10"; version="2.0.1"; uses:="aQute.bnd.annotation.metatype,com.liferay.portal.configuration.metatype.annotations"_ com.liferay.portal.security.sso.opensso [522]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.util; version="[7.35.0,8.0.0)"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)

09:51:45,832 ERROR [Framework Event Dispatcher: Equinox Container: b0aa82f4-20c9-0017-11a6-b8198979ee61][com_liferay_portal_security_sso_opensso:97] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: com.liferay.portal.security.sso.opensso [522]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.util; version="[7.35.0,8.0.0)"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.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)
09:51:45,835 ERROR [localhost-startStop-1][ModuleFrameworkImpl:1513] Unable to start bundle com.liferay.portal.security.sso.opensso
org.osgi.framework.BundleException: Could not resolve module: com.liferay.portal.security.sso.opensso [522]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.util; version="[7.35.0,8.0.0)"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)

I can login to liferay but OpenSSO module is not loaded as it failed. Let me know if i am missing any dependency or configuration. Thanks

/Pratik
thumbnail
David H Nebinger, geändert vor 6 Jahren.

RE: Liferay module development error

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
Pratik Sayare:
dependencies {
compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.configuration.metatype", version: "2.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.exportimport.api", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.21.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.49.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"

compile group: "com.liferay", name: "com.liferay.portal.security.sso.opensso", version: "3.0.9"
}


09:51:43,066 ERROR [Framework Event Dispatcher: Equinox Container: b0aa82f4-20c9-0017-11a6-b8198979ee61][com_liferay_portal_settings_authentication_opensso_web:97] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: com.liferay.portal.settings.authentication.opensso.web [367]_ Unresolved requirement: Import-Package: com.liferay.portal.security.sso.opensso.configuration; version="[2.0.0,3.0.0)"_ -> Export-Package: com.liferay.portal.security.sso.opensso.configuration; bundle-symbolic-name="com.liferay.portal.security.sso.opensso"; bundle-version="3.0.10"; version="2.0.1"; uses:="aQute.bnd.annotation.metatype,com.liferay.portal.configuration.metatype.annotations"_ com.liferay.portal.security.sso.opensso [522]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.util; version="[7.35.0,8.0.0)"_ [Sanitized]


When you pick a version for a dependency, that version comes with a known set of version dependencies. Something that you have picked uses com.liferay.portal.kernel.util version 7.35.0 or greater and likely the environment that you are deploying to has not yet been updated to have that version available.

You should not be picking the latest and greatest version of the modules because you have no idea what actual versions may be deployed.
thumbnail
Pratik Sayare, geändert vor 6 Jahren.

RE: Liferay module development error

New Member Beiträge: 20 Beitrittsdatum: 10.08.17 Neueste Beiträge
ok, thanks. Where can I check the existing version? Under apps -> App Manager I can see for Opensso 3.0.7 but not for com.liferay.portal.impl and com.liferay.portal.kernel. I checked jar and its com.liferay.portal.impl - 2.21.0 and com.liferay.portal.kernel -2.46.1

Is this correct? that I should use.

/Pratik
thumbnail
Pratik Sayare, geändert vor 6 Jahren.

RE: Liferay module development error

New Member Beiträge: 20 Beitrittsdatum: 10.08.17 Neueste Beiträge
Hi,

Thanks for the pointers. After some trial and error below works

dependencies {
compileOnly group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.configuration.metatype", version: "2.0.0"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.exportimport.api", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"

compile group: "com.liferay", name: "com.liferay.portal.security.sso.opensso", version: "3.0.9"
}

/Pratik
thumbnail
Pratik Sayare, geändert vor 6 Jahren.

RE: Liferay module development error

New Member Beiträge: 20 Beitrittsdatum: 10.08.17 Neueste Beiträge
Hi,

After override, I found that the module is not displayed under APPS > APP MANAGER > LIFERAY CE FOUNDATION > SECURITY FRAMEWORKS.

Without override, I can see the module listed as "Liferay Portal Security SSO OpenSSO"

Is it normal?

/Pratik