Message Boards

BundleException: Import-Package: com.liferay.portal.kernel.model

Piotr Krzesniak, modified 3 Years ago.

BundleException: Import-Package: com.liferay.portal.kernel.model

New Member Posts: 23 Join Date: 7/24/20 Recent Posts
Hello, every time when i want to refer to classes from this package com.liferay.portal.kernel  i have a bundleException.  For example this line
UserLocalServiceUtil.getRoleUsers(1); 

gives me an  error. That's the top of the stacktrace 
020-08-18 09:41:05.966 ERROR [Framework Event Dispatcher: Equinox Container: 3f248e9f-2393-48b8-b7ac-dfbb6d34c87f][Framework:93] FrameworkEvent ERROR 
org.osgi.framework.BundleException: Could not resolve module: registration [1147]_  Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[4.1.0,5.0.0)"_ [Sanitized]
    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1682)
I tried out to add in build.gradle version 8.1.0 to this depedency   
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel" 
but it doesn't work. Any suggestions ? Using liferay 7.3. Thank you in advance
thumbnail
Krzysztof Gołębiowski, modified 3 Years ago.

RE: BundleException: Import-Package: com.liferay.portal.kernel.model

Liferay Master Posts: 549 Join Date: 6/25/11 Recent Posts
Hi Piotr,

I've just tested the code in the plugin I'm currently working on and everything seems to be working well. I see you're not using explicit version numbers so I guess you use BOMs to resolve the dependencies, which makes me think that there is something wrong with your workspace configuration. This is the version indicator for Liferay 7.3 GA4 in my main gradle.properties to compile the sample:

liferay.workspace.target.platform.version=7.3.3
Piotr Krzesniak, modified 3 Years ago.

RE: BundleException: Import-Package: com.liferay.portal.kernel.model

New Member Posts: 23 Join Date: 7/24/20 Recent Posts
Thank you for fast response, i am gonna try this out emoticon