Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: java.lang.ClassNotFoundException: com.liferay.util.ContentUtil
Sudhanshu Kumar Shukla, modified 7 Years ago.
Junior Member
Posts: 35
Join Date: 8/29/16
Recent Posts
Hi Develoeprs,
I Am Facing
java.lang.ClassNotFoundException: com.liferay.util.ContentUtil And PortletProps
Below is my build.gradle file
Here Is My bnd.bnd file
Can Anybody Point Me where i am going wrong and what to do for using the utilites api's of liferay in dxp
i know osgi provide all the dependencies at the run time but still i am getting this error.
I am going wrong or is there any other way to use those dependencies.
Thanks In Advanced.
I Am Facing
java.lang.ClassNotFoundException: com.liferay.util.ContentUtil And PortletProps
Below is my build.gradle file
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.java", version: "2.0.0"
compileOnly group: 'com.liferay', name: 'com.liferay.content.util', version: '1.0.1'
compileOnly group: 'com.liferay.portal', name: 'com.liferay.util.bridges', version: '2.0.1'
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compileOnly group: 'javax.mail', name: 'mail', version: '1.4.7'
compileOnly project(":modules:BI_Enquiry-services:BI_Enquiry-services-api")
compileOnly project(":modules:BI_Enquiry-services:BI_Enquiry-services-service")
}
Here Is My bnd.bnd file
Bundle-Name: BI_Enquiry-web
Bundle-SymbolicName: com.bumerguard.international
Bundle-Version: 1.0.0
Export-Package: com.bumerguard.international.constants
Import-Package: \
!com.liferay.util; version="[7.0.0,8.0.0)",\
!com.liferay.util.mail; version="[7.0.0,8.0.0)",\
*
Can Anybody Point Me where i am going wrong and what to do for using the utilites api's of liferay in dxp
i know osgi provide all the dependencies at the run time but still i am getting this error.
I am going wrong or is there any other way to use those dependencies.
Thanks In Advanced.
Kyle Joseph Stiemann, modified 7 Years ago.
Liferay Master
Posts: 760
Join Date: 1/14/13
Recent Posts
Can you try removing the Imports from the bnd.bnd file. Those should be taken care of by Gradle since we have them declared as dependencies. Let me know if this works.
Sudhanshu Kumar Shukla, modified 7 Years ago.
Junior Member
Posts: 35
Join Date: 8/29/16
Recent Posts
Eddie Chow:
Can you try removing the Imports from the bnd.bnd file. Those should be taken care of by Gradle since we have them declared as dependencies. Let me know if this works.
Thanks Now It's Working
And I have done One More Change In build.gradle file which I think I need to share
Chaged Code
compile group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.0.0"I have Changed CompileOnly to Compile.
Because from CompileOnly it will make the jar available for source code but at runtime, it is not including the classes.
Finally My Working bnd.bnd File is
Bundle-Name: BI_Enquiry-web
Bundle-SymbolicName: com.bumerguard.international
Bundle-Version: 1.0.0
Export-Package: com.bumerguard.international.constants;
Import-Package: \
!com.swabunga.spell.engine,\
!com.swabunga.spell.*,\
!net.fortuna.ical4j.model,\
!net.fortuna.ical4j.*,\
!org.apache.axis.tools.ant.wsdl,\
!org.apache.*,\
*
Bundle-ClassPath:\
.,\
lib/com.liferay.util.java-2.0.0.jar
-includeresource:\
lib/com.liferay.util.java-2.0.0.jar=com.liferay.util.java-2.0.0.jarAnd build.gradle file is
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: "com.liferay.portal", name: "com.liferay.util.java", version: "2.0.0"
compile group: "com.liferay.portal", name: "com.liferay.portal.impl", version: "2.0.0"
compile group: "javax.portlet", name: "portlet-api", version: "2.0"
compile group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compile group: "jstl", name: "jstl", version: "1.2"
compile group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compile group: 'javax.mail', name: 'mail', version: '1.4.7'
compileOnly project(":modules:BI_Enquiry-services:BI_Enquiry-services-api")
compileOnly project(":modules:BI_Enquiry-services:BI_Enquiry-services-service")
}
May This will help For Someone.
If I have done wrong anywhere please let me know.
Thanks
Hello,
in case someone had such problem in Liferay 7.2 (maybe also in 7.1 - didn't check that) - it seems that that has been changed and now to access ContentUtil class you have to add following dependency in build.gradle: compileOnly group: "com.liferay", name: "com.liferay.petra.content"
in case someone had such problem in Liferay 7.2 (maybe also in 7.1 - didn't check that) - it seems that that has been changed and now to access ContentUtil class you have to add following dependency in build.gradle: compileOnly group: "com.liferay", name: "com.liferay.petra.content"