Foros de discusión

Liferay 7 CE ga2 OSGI read portlet .properties file

thumbnail
Mohammad Azharuddin, modificado hace 7 años.

Liferay 7 CE ga2 OSGI read portlet .properties file

Expert Mensajes: 492 Fecha de incorporación: 17/09/12 Mensajes recientes
HI All
I am using Liferay 7 CE ga2
I am trying to read portlet.properties file in my custom OSGI module. I have added below dependency in my build.gradle file

build.gradle file
dependencies {
compile group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compile group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compile group: "javax.portlet", name: "portlet-api", version: "2.0"
compile group: "javax.servlet", name: "servlet-api", version: "2.5"
compile group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
compile group: "biz.aQute.bnd", name: "biz.aQute.bndlib", version: "3.1.0"
compile group: "com.liferay.portal", name: "com.liferay.util.java", version: "2.0.0"

}


and bnd.bnd file as shown


Bundle-SymbolicName: webform
Bundle-Version: 1.0.0
-metatype: *
-check: all


I am trying to read property using below code
String value = com.liferay.util.portlet.PortletProps.get("key");

It resolves during compile time but But during run time i am getting below error

org.osgi.framework.BundleException: Could not resolve module: webform [514]_ Unresolved requirement: Import-Package: com.liferay.util.portlet; version="[7.0.0,8.0.0)"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1498)
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)



Please help
thumbnail
David H Nebinger, modificado hace 7 años.

RE: Liferay 7 CE ga2 OSGI read portlet .properties file

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
You list the util-java.jar as a dependency but it is not available in the OSGi container.

You'll need to include it as a runtime dependency: https://web.liferay.com/web/user.26526/blog/-/blogs/osgi-module-dependencies





Come meet me at the LSNA!
thumbnail
Liferay Dev, modificado hace 6 años.

RE: Liferay 7 CE ga2 OSGI read portlet .properties file

Junior Member Mensajes: 81 Fecha de incorporación: 17/05/15 Mensajes recientes
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");
thumbnail
Liferay Dev, modificado hace 6 años.

RE: Liferay 7 CE ga2 OSGI read portlet .properties file

Junior Member Mensajes: 81 Fecha de incorporación: 17/05/15 Mensajes recientes
Use this piece of code to read portlet.properties
Configuration configuration = ConfigurationFactoryUtil.getConfiguration( get Portlet level class loader , "portlet");