RE: Problem using a ResourceBundleLoader

thumbnail
Charalampos Chrysikopoulos, modified 6 Years ago. Junior Member Posts: 79 Join Date: 12/9/11 Recent Posts
Hello,I created a MVC portlet, and in the module I created a CustomAggregateResourceBundleLoader that implements the ResourceBundleLoader (described in https://github.com/liferay/liferay-blade-samples/tree/7.0/liferay-workspace/overrides/resource-bundle-override). When I deploy the portlet an exception is thrown 
org.osgi.framework.BundleException: Could not resolve module: somepackage.app [1384]_  Unresolved requirement: Import-Package: com.liferay.portal.kernel.util; version="[9.5.0,9.6.0)"_ [Sanitized]
    at org.eclipse.osgi.container.Module.start(Module.java:444)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1263)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1236)
    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)

    
I am using liferay 7.2 DXP with fp2.
The build.gradle is like following 

dependencies {
   compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "4.13.0"
   compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib"
   compileOnly group: "javax.portlet", name: "portlet-api"
   compileOnly group: "javax.servlet", name: "javax.servlet-api"
   compileOnly group: "jstl", name: "jstl"
   compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations"
   compileOnly group: "com.liferay", name: "com.liferay.petra.string"
}
In gogo shell in the headers of my module I get:
 Import-Package = com.liferay.petra.string;version="[1.4,2)",com.liferay.portal.kernel.language;version="[7.5,8)",com.liferay.portal.kernel.portlet.bridges.mvc;version="[2.0,3)",com.liferay.portal.kernel.util;version="[9.5,9.6)",javax.portlet,javax.servlet;version="[3.0,4)",javax.servlet.http;version="[3.0,4)"


Can anybody help me here?
Thanks in advance
thumbnail
Charalampos Chrysikopoulos, modified 5 Years ago. Junior Member Posts: 79 Join Date: 12/9/11 Recent Posts
thumbnail
Charalampos Chrysikopoulos, modified 5 Years ago. Junior Member Posts: 79 Join Date: 12/9/11 Recent Posts
I manage to fix the problem: Looking at the source code of the portal in the 

/portal-kernel/src/com/liferay/portal/kernel/util/packageinfo


I can see the version of the package.In the 
/liferay-portal-7.2.10-ga1/tomcat-9.0.17/lib/ext
 

folder I found the portal-kernel.jar and its version was 

Bundle-Version: 4.35.3


So, I had the wrong version in the kernel module. Changing the property

liferay.workspace.target.platform.version


from 7.2.0 to 7.2.1 and setting the dependency of the kernel to

compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel"

solved the problem.