Message Boards
Liferay 7 EXT module - extending LDAPUserImporterImpl
Jan Fleissig, modified 3 Years ago.
Liferay 7 EXT module - extending LDAPUserImporterImpl
New Member Posts: 2 Join Date: 1/16/13 Recent Posts
Hi,
I need modify code inside LDAPUserImporterImpl, which is in this OSGi module:
I put the original file from sources, put my changes and put dependencies in build.gradle.
Problem is, that I put new imports in LDAPUserImporterImpl:
Build is OK, deployment fails:
Caused by: java.lang.ClassNotFoundException: com.liferay.expando.kernel.exception.NoSuchTableException cannot be found by com.liferay.portal.security.ldap.impl_3.0.10.ext
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:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 70 more
build.gradle:
MANIFEST.MF of built JAR:
But how to put it? I tried to provide bnd file, but it does not work.
Thanks for any help.
I need modify code inside LDAPUserImporterImpl, which is in this OSGi module:
com.liferay.portal.security.ldap.impl:3.0.10
So I created ext module by this guide: https://help.liferay.com/hc/en-us/articles/360019074311-Modules-Ext-Template (gradle)I put the original file from sources, put my changes and put dependencies in build.gradle.
Problem is, that I put new imports in LDAPUserImporterImpl:
import com.liferay.expando.kernel.exception.NoSuchTableException;
Build is OK, deployment fails:
Caused by: java.lang.ClassNotFoundException: com.liferay.expando.kernel.exception.NoSuchTableException cannot be found by com.liferay.portal.security.ldap.impl_3.0.10.ext
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:151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 70 more
build.gradle:
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "3.13.8"
} repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "com.liferay.osgi.ext.plugin"
dependencies {
originalModule group: "com.liferay", name: "com.liferay.portal.security.ldap.impl", version: "3.0.10"
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "9.0.2"
compileOnly group: "commons-lang", name: "commons-lang", version: "2.6"
compileOnly group: "javax.portlet", name: "portlet-api", version: "3.0.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "org.osgi", name: "osgi.core", version: "6.0.0"
compileOnly group: "com.liferay", name: "com.liferay.petra.string", version: "4.0.2"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.exportimport.api", version: "5.0.4"
compileOnly group: "com.liferay", name: "com.liferay.portal.security.ldap.api", version: "3.0.10"}repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
MANIFEST.MF of built JAR:
[code]
Manifest-Version: 1.0
Liferay-Releng-Portal-Required: true
Bundle-SymbolicName: com.liferay.portal.security.ldap.impl
Liferay-Releng-Marketplace: true
Liferay-Releng-Suite: foundation
Liferay-Releng-Support-Url: http://www.liferay.com
Bnd-LastModified: 1596847082013
Import-Package: com.liferay.admin.kernel.util;version="[2.0,3)",com.li
feray.expando.kernel.model;version="[3.3,4)",com.liferay.expando.kern
el.service;version="[1.5,2)",com.liferay.expando.kernel.util;version=
"[2.0,3)",com.liferay.petra.lang;version="[1.2,2)",com.liferay.petra.
string;version="[1.4,2)",com.liferay.portal.configuration.metatype.bn
d.util;version="[2.0,3)",com.liferay.portal.configuration.persistence
.listener;version="[1.1,2)",com.liferay.portal.instance.lifecycle;ver
sion="[2.0,3)",com.liferay.portal.kernel.bean;version="[8.0,9)",com.l
iferay.portal.kernel.cache;version="[9.1,10)",com.liferay.portal.kern
el.exception;version="[9.2,10)",com.liferay.portal.kernel.language;ve
rsion="[8.2,9)",com.liferay.portal.kernel.lock;version="[7.3,8)",com.
liferay.portal.kernel.log;version="[7.0,8)",com.liferay.portal.kernel
.messaging;version="[9.1,10)",com.liferay.portal.kernel.model;version
="[5.4,6)",com.liferay.portal.kernel.scheduler;version="[9.1,10)",com
.liferay.portal.kernel.security.auth;version="[2.4,3)",com.liferay.po
rtal.kernel.security.exportimport;version="[1.0,2)",com.liferay.porta
l.kernel.security.ldap;version="[1.0,2)",com.liferay.portal.kernel.se
curity.pwd;version="[2.0,3)",com.liferay.portal.kernel.service;versio
n="[4.6,5)",com.liferay.portal.kernel.service.persistence;version="[6
.0,7)",com.liferay.portal.kernel.transaction;version="[8.0,9)",com.li
feray.portal.kernel.util;version="[10.6,11)",com.liferay.portal.secur
ity.exportimport;version="[1.0,2)",com.liferay.portal.security.ldap;v
ersion="[2.0,2.1)",com.liferay.portal.security.ldap.authenticator.con
figuration;version="[1.0,2)",com.liferay.portal.security.ldap.configu
ration;version="[2.0,3)",com.liferay.portal.security.ldap.constants;v
ersion="[2.0,3)",com.liferay.portal.security.ldap.dummy;version="[1.0
,2)",com.liferay.portal.security.ldap.exportimport;version="[1.1,1.2)
",com.liferay.portal.security.ldap.exportimport.configuration;version
="[1.0,2)",com.liferay.portal.security.ldap.util;version="[1.2,2)",co
m.liferay.portal.security.ldap.validator;version="[1.1,2)",com.lifera
y.portal.verify,javax.naming,javax.naming.directory,javax.naming.ldap
,javax.swing,javax.swing.event,javax.swing.tree,org.apache.commons.la
ng.time;version="[2.6,3)",org.osgi.framework;version="[1.8,2)",org.os
gi.service.cm;version="[1.5,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.admin.kernel.util.Omniadmin)";effective:=active,
osgi.service;filter:="(objectClass=com.liferay.expando.kernel.service
.ExpandoValueLocalService)";effective:=active,osgi.service;filter:="(
objectClass=com.liferay.portal.kernel.cache.SingleVMPool)";effective:
=active,osgi.service;filter:="(objectClass=com.liferay.portal.kernel.
lock.LockManager)";effective:=active,osgi.service;filter:="(objectCla
ss=com.liferay.portal.kernel.messaging.Destination)";effective:=activ
e,osgi.service;filter:="(objectClass=com.liferay.portal.kernel.messag
ing.DestinationFactory)";effective:=active,osgi.service;filter:="(obj
ectClass=com.liferay.portal.kernel.scheduler.SchedulerEngineHelper)";
effective:=active,osgi.service;filter:="(objectClass=com.liferay.port
al.kernel.scheduler.TriggerFactory)";effective:=active,osgi.service;f
ilter:="(objectClass=com.liferay.portal.kernel.security.ldap.Attribut
esTransformer)";effective:=active,osgi.service;filter:="(objectClass=
com.liferay.portal.kernel.security.ldap.LDAPSettings)";effective:=act
ive,osgi.service;filter:="(objectClass=com.liferay.portal.kernel.secu
rity.pwd.PasswordEncryptor)";effective:=active,osgi.service;filter:="
(objectClass=com.liferay.portal.kernel.service.CompanyLocalService)";
effective:=active,osgi.service;filter:="(objectClass=com.liferay.port
al.kernel.service.GroupLocalService)";effective:=active,osgi.service;
filter:="(objectClass=com.liferay.portal.kernel.service.ImageLocalSer
vice)";effective:=active,osgi.service;filter:="(objectClass=com.lifer
ay.portal.kernel.service.ListTypeService)";effective:=active,osgi.ser
vice;filter:="(objectClass=com.liferay.portal.kernel.service.Membersh
ipRequestLocalService)";effective:=active,osgi.service;filter:="(obje
ctClass=com.liferay.portal.kernel.service.RoleLocalService)";effectiv
e:=active,osgi.service;filter:="(objectClass=com.liferay.portal.kerne
l.service.UserGroupLocalService)";effective:=active,osgi.service;filt
er:="(objectClass=com.liferay.portal.kernel.service.UserLocalService)
";effective:=active,osgi.service;filter:="(objectClass=com.liferay.po
rtal.kernel.service.persistence.ContactPersistence)";effective:=activ
e,osgi.service;filter:="(objectClass=com.liferay.portal.kernel.servic
e.persistence.UserPersistence)";effective:=active,osgi.service;filter
:="(objectClass=com.liferay.portal.kernel.util.PrefsProps)";effective
:=active,osgi.service;filter:="(objectClass=com.liferay.portal.kernel
.util.Props)";effective:=active,osgi.service;filter:="(objectClass=co
m.liferay.portal.security.exportimport.UserExporter)";effective:=acti
ve,osgi.service;filter:="(objectClass=com.liferay.portal.security.exp
ortimport.UserImporter)";effective:=active,osgi.service;filter:="(obj
ectClass=com.liferay.portal.security.ldap.SafePortalLDAP)";effective:
=active,osgi.service;filter:="(objectClass=com.liferay.portal.securit
y.ldap.configuration.ConfigurationProvider)";effective:=active,osgi.s
ervice;filter:="(objectClass=com.liferay.portal.security.ldap.configu
ration.ConfigurationProvider)";effective:=active;resolution:=optional
;cardinality:=multiple,osgi.service;filter:="(objectClass=com.liferay
.portal.security.ldap.exportimport.LDAPToPortalConverter)";effective:
=active,osgi.service;filter:="(objectClass=com.liferay.portal.securit
y.ldap.exportimport.LDAPUserImporter)";effective:=active,osgi.service
;filter:="(objectClass=com.liferay.portal.security.ldap.exportimport.
PortalToLDAPConverter)";effective:=active,osgi.service;filter:="(obje
ctClass=com.liferay.portal.security.ldap.validator.LDAPFilterValidato
r)";effective:=active,osgi.service;filter:="(objectClass=org.osgi.ser
vice.cm.ConfigurationAdmin)";effective:=active,osgi.ee;filter:="(&(os
gi.ee=JavaSE)(version=1.8))"
Liferay-Releng-Suite-Title: Liferay Foundation
Service-Component: OSGI-INF/com.liferay.portal.security.ldap.internal.
DefaultAttributesTransformer.xml,OSGI-INF/com.liferay.portal.security
.ldap.internal.DefaultLDAPSettings.xml,OSGI-INF/com.liferay.portal.se
curity.ldap.internal.DefaultPortalLDAP.xml,OSGI-INF/com.liferay.porta
l.security.ldap.internal.SafePortalLDAPImpl.xml,OSGI-INF/com.liferay.
portal.security.ldap.internal.authenticator.LDAPAuth.xml,OSGI-INF/com
.liferay.portal.security.ldap.internal.authenticator.configuration.LD
APAuthConfigurationProviderImpl.xml,OSGI-INF/com.liferay.portal.secur
ity.ldap.internal.configuration.LDAPConfigurationListener.xml,OSGI-IN
F/com.liferay.portal.security.ldap.internal.configuration.LDAPServerC
onfigurationProviderImpl.xml,OSGI-INF/com.liferay.portal.security.lda
p.internal.configuration.SystemLDAPConfigurationProviderImpl.xml,OSGI
-INF/com.liferay.portal.security.ldap.internal.configuration.persiste
nce.listener.UserImportMessageListener.xml,OSGI-INF/com.liferay.porta
l.security.ldap.internal.exportimport.DefaultLDAPToPortalConverter.xm
l,OSGI-INF/com.liferay.portal.security.ldap.internal.exportimport.Def
aultPortalToLDAPConverter.xml,OSGI-INF/com.liferay.portal.security.ld
ap.internal.exportimport.LDAPUserExporterImpl.xml,OSGI-INF/com.lifera
y.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl.xml
,OSGI-INF/com.liferay.portal.security.ldap.internal.exportimport.conf
iguration.LDAPExportConfigurationProviderImpl.xml,OSGI-INF/com.lifera
y.portal.security.ldap.internal.exportimport.configuration.LDAPImport
ConfigurationProviderImpl.xml,OSGI-INF/com.liferay.portal.security.ld
ap.internal.instance.lifecycle.LDAPPortalInstanceLifecycleListener.xm
l,OSGI-INF/com.liferay.portal.security.ldap.internal.messaging.config
.MessagingConfigurator.xml,OSGI-INF/com.liferay.portal.security.ldap.
internal.model.listener.ContactModelListener.xml,OSGI-INF/com.liferay
.portal.security.ldap.internal.model.listener.UserGroupModelListener.
xml,OSGI-INF/com.liferay.portal.security.ldap.internal.model.listener
.UserModelListener.xml,OSGI-INF/com.liferay.portal.security.ldap.inte
rnal.validator.LDAPFilterValidatorImpl.xml,OSGI-INF/com.liferay.porta
l.security.ldap.internal.verify.LDAPPropertiesVerifyProcess.xml
Liferay-Releng-Restart-Required: true
Provide-Capability: osgi.service;objectClass:List<string>="com.liferay
.portal.configuration.persistence.listener.ConfigurationModelListener
,com.liferay.portal.security.ldap.internal.configuration.persistence.
listener.UserImportMessageListener";uses:="com.liferay.portal.configu
ration.persistence.listener,com.liferay.portal.security.ldap.internal
.configuration.persistence.listener",osgi.service;objectClass:List<st ring>="com.liferay.portal.instance.lifecycle.PortalInstanceLifecycleL
istener";uses:="com.liferay.portal.instance.lifecycle",osgi.service;o
bjectClass:List<string>="com.liferay.portal.kernel.model.ModelListene
r";uses:="com.liferay.portal.kernel.model",osgi.service;objectClass:L
ist<string>="com.liferay.portal.kernel.security.auth.Authenticator";u
ses:="com.liferay.portal.kernel.security.auth",osgi.service;objectCla
ss:List<string>="com.liferay.portal.kernel.security.ldap.AttributesTr
ansformer";uses:="com.liferay.portal.kernel.security.ldap",osgi.servi
ce;objectClass:List<string>="com.liferay.portal.kernel.security.ldap.
LDAPSettings";uses:="com.liferay.portal.kernel.security.ldap",osgi.se
rvice;objectClass:List<string>="com.liferay.portal.security.exportimp
ort.UserExporter";uses:="com.liferay.portal.security.exportimport",os
gi.service;objectClass:List<string>="com.liferay.portal.security.expo
rtimport.UserImporter,com.liferay.portal.security.ldap.exportimport.L
DAPUserImporter";uses:="com.liferay.portal.security.exportimport,com.
liferay.portal.security.ldap.exportimport",osgi.service;objectClass:L
ist<string>="com.liferay.portal.security.ldap.PortalLDAP";uses:="com.
liferay.portal.security.ldap",osgi.service;objectClass:List<string>="
com.liferay.portal.security.ldap.SafePortalLDAP";uses:="com.liferay.p
ortal.security.ldap",osgi.service;objectClass:List<string>="com.lifer
ay.portal.security.ldap.configuration.ConfigurationProvider";uses:="c
om.liferay.portal.security.ldap.configuration",osgi.service;objectCla
ss:List<string>="com.liferay.portal.security.ldap.exportimport.LDAPTo
PortalConverter";uses:="com.liferay.portal.security.ldap.exportimport
",osgi.service;objectClass:List<string>="com.liferay.portal.security.
ldap.exportimport.PortalToLDAPConverter";uses:="com.liferay.portal.se
curity.ldap.exportimport",osgi.service;objectClass:List<string>="com.
liferay.portal.security.ldap.validator.LDAPFilterValidator";uses:="co
m.liferay.portal.security.ldap.validator",osgi.service;objectClass:Li
st<string>="com.liferay.portal.verify.VerifyProcess";uses:="com.lifer
ay.portal.verify",osgi.service;objectClass:List<string>="org.osgi.ser
vice.cm.ConfigurationListener";uses:="org.osgi.service.cm"
Liferay-Releng-Category: Utility
Bundle-Name: Liferay Portal Security LDAP Implementation
Javac-Debug: on
Liferay-Releng-Public: false
Liferay-Releng-App-Title: Liferay Portal Security
Bundle-ManifestVersion: 2
Liferay-Releng-Supported: true
Bundle-Vendor: Liferay, Inc.
Liferay-Releng-Deprecated: false
Javac-Deprecation: off
Javac-Encoding: UTF-8
Tool: Bnd-4.3.0.201909301554
Liferay-Releng-Labs: false
Bundle-Version: 3.0.10.ext
Liferay-Releng-Fix-Delivery-Method: core
Private-Package: antlr,antlr.ASdebug,antlr.actions.cpp,antlr.actions.c
sharp,antlr.actions.java,antlr.actions.python,antlr.build,antlr.colle
ctions,antlr.collections.impl,antlr.debug,antlr.debug.misc,antlr.prep
rocessor,com.liferay.portal.security.ldap.internal,com.liferay.portal
.security.ldap.internal.authenticator,com.liferay.portal.security.lda
p.internal.authenticator.configuration,com.liferay.portal.security.ld
ap.internal.configuration,com.liferay.portal.security.ldap.internal.c
onfiguration.persistence.listener,com.liferay.portal.security.ldap.in
ternal.constants,com.liferay.portal.security.ldap.internal.exportimpo
rt,com.liferay.portal.security.ldap.internal.exportimport.configurati
on,com.liferay.portal.security.ldap.internal.instance.lifecycle,com.l
iferay.portal.security.ldap.internal.messaging.config,com.liferay.por
tal.security.ldap.internal.model.listener,com.liferay.portal.security
.ldap.internal.validator,com.liferay.portal.security.ldap.internal.va
lidator.parser,com.liferay.portal.security.ldap.internal.verify,org.a
ntlr,org.antlr.analysis,org.antlr.codegen,org.antlr.codegen.templates
,org.antlr.codegen.templates.C,org.antlr.codegen.templates.CSharp,org
.antlr.codegen.templates.Java,org.antlr.codegen.templates.ObjC,org.an
tlr.codegen.templates.Python,org.antlr.codegen.templates.Ruby,org.ant
lr.codegen.templates.cpp,org.antlr.misc,org.antlr.runtime,org.antlr.r
untime.debug,org.antlr.runtime.misc,org.antlr.runtime.tree,org.antlr.
stringtemplate,org.antlr.stringtemplate.language,org.antlr.stringtemp
late.misc,org.antlr.stringtemplate.test,org.antlr.tool,org.antlr.tool
.templates,org.antlr.tool.templates.dot,org.antlr.tool.templates.mess
ages.formats,org.antlr.tool.templates.messages.languages
Liferay-Releng-Bundle: true
Liferay-Releng-Suite-Description: Apps and Features: System Settings,
Web Content Editors, Web Content Template Languages, Theme Tools, Mob
ile Device Rules, Facebook Authentication, LDAP Authentication, NTLM
Authentication, OpenID Authentication, OpenSSO Authentication, Remote
Authentication (AuthVerifiers), SSO-based Authentication, Token-base
d Authentication, Portal Scripting, Elasticsearch Support, Solr Suppo
rt, Documents and Media Store Implementations, and more.<br><br>T
he Foundation suite provides applications and features that extend th
e functionality provided by Liferay's core. Much of the functionality
that belonged to Liferay's core prior to Liferay 7 has been extracte
d into the modules of the Foundation suite. The authentication module
s provide a variety of mechanisms for allowing users and remote appli
cations to authenticate to Liferay. The LDAP Authentication module al
lows administrators to establish connections to one or more LDAP dire
ctories from which users can be imported or exported. The SSO modules
allow users to authenticate to Liferay using a variety of single-sig
n on solutions. The Token-based Authentication module allows users or
remote applications to authenticate to Liferay without a password. T
he Scripting modules allow scripts to be written to invoke Liferay's
API in several languages including Groovy, BeanShell, Python, Ruby, a
nd JavaScript.<br><br>This suite is available in the Liferay bund
le.
Created-By: 1.8.0_121 (Oracle Corporation)
</string></string></string></string></string></string></string></string></string></string></string></string></string></string></st></string>
I suppose that problem is, that package "com.liferay.expando.kernel.exception" IS NOT in "Import-Package" of MANIFEST.MF.But how to put it? I tried to provide bnd file, but it does not work.
Thanks for any help.
Olaf Kock, modified 3 Years ago.
RE: Liferay 7 EXT module - extending LDAPUserImporterImpl
Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent PostsJan Fleissig:
I need modify code inside LDAPUserImporterImpl, which is in this OSGi module:So I created ext module by this guide: https://help.liferay.com/hc/en-us/articles/360019074311-Modules-Ext-Template (gradle)com.liferay.portal.security.ldap.impl:3.0.10
I put the original file from sources, put my changes and put dependencies in build.gradle.
Problem is, that I put new imports in LDAPUserImporterImpl:import com.liferay.expando.kernel.exception.NoSuchTableException;
You ask about version 7.0, which is quite old now, but let me start by stepping a couple of steps back:
"I need to modify code inside ...Impl" is a solution that you came up with, not a problem. If you state the underlying problem, we might be able to come up with a better solution that involves a standard extension point, so that you don't need to create a hard-to-maintain ext module. And even if we end up with the decision that your solution is actually the best way to solve this problem, now everyone is aware of such an extension need, and a standard extension point can be built for future versions.
Until then, this smells like an x-y-problem - just to let you know
Jan Fleissig:
I suppose that problem is, that package "com.liferay.expando.kernel.exception" IS NOT in "Import-Package" of MANIFEST.MF.
But how to put it? I tried to provide bnd file, but it does not work.
AFAIK Expando code is in Kernel, so I'd expect it to be imported and available. However, I've not validated the version numbers you use, and if they match your installation. You might want to validate if there is a mismatch between the compiletime and runtime versions that trigger this.
On the other hand I wonder why bnd didn't pick up this reference in the manifest. Are you actually referencing that exception somewhere in your code, explicitly? (other than in the import)