RE: RE: Liferay 7 Service Builder Error [NoClassDefFoundError]

Olaf Kock, modified 1 Year ago. New Member Posts: 6 Join Date: 1/2/24 Recent Posts

I am using Liferay Dev Studio to create the Liferay module project and select service-builder template. 

When it's created and run the gradle buldService it gives following error

Task :modules:new-portlet:new-portlet-service:buildService FAILED
Exception in thread "main" java.lang.NoClassDefFoundError: com/liferay/petra/string/StringBundler
    at com.liferay.portal.kernel.util.Validator.<clinit>(Validator.java:1205)
    at com.liferay.portal.tools.ArgumentsMap.get(ArgumentsMap.java:30)
    at com.liferay.portal.tools.ArgumentsMap.get(ArgumentsMap.java:24)
    at com.liferay.portal.tools.service.builder.ServiceBuilder.main(ServiceBuilder.java:172)
Caused by: java.lang.ClassNotFoundException: com.liferay.petra.string.StringBundler
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 4 more

 

My build.gradle file look like this

apply plugin: "com.liferay.portal.tools.service.builder"

dependencies {
    implementation project(":modules:new-portlet:new-portlet-api")
   
    implementation "com.liferay.portal:release.portal.api"
}


buildService {
    apiDir = "../xyz-portlet-api/src/main/java"
}

group = "com.sibisoft.northstar.xyz"

 

I have added below petra String but the issue remains same

    compileOnly group: 'com.liferay', name: 'com.liferay.petra.string'
 

7.4
thumbnail
Roselaine Marques, modified 1 Year ago. New Member Posts: 13 Join Date: 4/13/20 Recent Posts

Which DXP version are you using?

You can see in your $Liferay_Workspace/gradle.properties the value configured in the property ->  liferay.workspace.product

 

Olaf Kock, modified 1 Year ago. New Member Posts: 6 Join Date: 1/2/24 Recent Posts

Using portal-7.4-ga105

Olaf Kock, modified 1 Year ago. New Member Posts: 6 Join Date: 1/2/24 Recent Posts

Any leads?

Also, I have tried by changing the JDK, and using 7.4 GA105 to build.

thumbnail
Roselaine Marques, modified 1 Year ago. New Member Posts: 13 Join Date: 4/13/20 Recent Posts

And which version the com.liferay.gradle.plugins.workspace is using inside settings.gradle in your workspace? Have you updated it? 

Olaf Kock, modified 1 Year ago. New Member Posts: 6 Join Date: 1/2/24 Recent Posts

I did buildService by using gradle gw buildService. It's working now. 

Thanks for the assistance.