Reputation: 589
we are starting our first Liferay 7 project and I already got stuck.
I would like to create a portlet which reads the Data from the DDMContent Table. Luckily there is the DDMContentLocalServiceUtil.
I am struggeling on how to actually use it.
I added it to the build.gradile file like this:
compileOnly group: "com.liferay", name: "com.liferay.dynamic.data.mapping.api", version: "3.1.0"
I added it to the bnd.bnd file like this :
Import-Package: com.liferay.dynamic.data.mapping.api;version=3.1.0
And then I included in my portlet class like this:
@Reference
public void setContentLocalServiceUtil(DDMContentLocalServiceUtil contentLocalServiceUtil) {
this.contentLocalServiceUtil = contentLocalServiceUtil;
}
The portlet compiles and starts to deploy but I never get to the point where I can actually use it because it is never fully deployed. There is no Exception and there is no hint on what I did wrong.
Is my version number correct ? Do I need to add it to the bnd.bnd file ? Who can help me out ?
Best regards,
Daniel
Upvotes: 1
Views: 627
Reputation: 3062
1) You should use
Import-Package: *
and let BND resolve that for you based on the jar file you are compiling against (the one you have in Gradle's dependencies)
2) Do not import the <Name>LocalServiceUtil
classes. Those are not OSGi services. Use <Name>LocalService
instead. Those are the interfaces that define the contracts. In your case it should be:
@Reference
public void setContentLocalService(DDMContentLocalService contentLocalService) {
3) If your bundle still does not start properly, connect to gogo shell (telnet localhost 11311
) and check it's status. Use diag
command or simply try to manually start it with start <bundleId>
and the framework will tell you if something is wrong with it.
Upvotes: 4