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
getting java.lang.NoClassDefFoundError: com/liferay/portal/kernel/service/B
when am calling the services of a serviceBuilder from a normal module portlet am getting the below exceptioncom.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/liferay/portal/kernel/service/BaseLocalService
please suggest me , in resolving the above exceptionThanks & Regards
please suggest me , in resolving the above exceptionThanks & Regards
You never should be accessing the service classes directly, only the interfaces from the API, and wired into your portlet using @Reference annotations.
Hi David H Nebinger, thanks for your reply
I tried as you said like below
@Override
public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException { try {
Emp ewmp= EmpLocalServiceUtil.fetchEmp(1);
System.out.println("details : "+ewmp.getEmpName());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
//VYPGProviderDetails details= VYPGProviderDetailsLocalServiceUtil.getVYPGProviderDetails(1);
VYPGProviderDetails details= vypgProviderDetailsService.getVYPGProviderDetails(1);
System.out.println("details =====>: "+details.getProviderName());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
super.doView(renderRequest, renderResponse);
}
@Reference(service = com.vy.payment.gateway.service.VYPGProviderDetailsLocalService.class)
protected com.vy.payment.gateway.service.VYPGProviderDetailsLocalService vypgProviderDetailsService; but am getting the below exceptionERROR [http-nio-8080-exec-6][status_jsp:950] com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/vy/payment/gateway/service/VYPGProviderDetailsLocalService
please give me some guidance David
I tried as you said like below
@Override
public void doView(RenderRequest renderRequest, RenderResponse renderResponse)
throws IOException, PortletException { try {
Emp ewmp= EmpLocalServiceUtil.fetchEmp(1);
System.out.println("details : "+ewmp.getEmpName());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
//VYPGProviderDetails details= VYPGProviderDetailsLocalServiceUtil.getVYPGProviderDetails(1);
VYPGProviderDetails details= vypgProviderDetailsService.getVYPGProviderDetails(1);
System.out.println("details =====>: "+details.getProviderName());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
super.doView(renderRequest, renderResponse);
}
@Reference(service = com.vy.payment.gateway.service.VYPGProviderDetailsLocalService.class)
protected com.vy.payment.gateway.service.VYPGProviderDetailsLocalService vypgProviderDetailsService; but am getting the below exceptionERROR [http-nio-8080-exec-6][status_jsp:950] com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/vy/payment/gateway/service/VYPGProviderDetailsLocalService
please give me some guidance David
Is the package exported in the bnd.bnd file for the module?
yes devid , thanks for your reply
package exported in the bnd.bnd file for the modulethis is my bnd.bnd file of service moduleBundle-Name: VyPaymentGateway-api
Bundle-SymbolicName: VyPaymentGateway.api
Bundle-Version: 1.0.0
Export-Package:\
com.vy.payment.gateway.exception,\
com.vy.payment.gateway.model,\
com.vy.payment.gateway.service,\
com.vy.payment.gateway.service.persistence,\
com.stripe.*,\
com.google.*;-split-package:=merge-last;-noimport:=true
-check: EXPORTS
-includeresource: META-INF/service.xml=../VyPaymentGateway-service/service.xml
Import-Package: *; version="0";resolution:=optional
package exported in the bnd.bnd file for the modulethis is my bnd.bnd file of service moduleBundle-Name: VyPaymentGateway-api
Bundle-SymbolicName: VyPaymentGateway.api
Bundle-Version: 1.0.0
Export-Package:\
com.vy.payment.gateway.exception,\
com.vy.payment.gateway.model,\
com.vy.payment.gateway.service,\
com.vy.payment.gateway.service.persistence,\
com.stripe.*,\
com.google.*;-split-package:=merge-last;-noimport:=true
-check: EXPORTS
-includeresource: META-INF/service.xml=../VyPaymentGateway-service/service.xml
Import-Package: *; version="0";resolution:=optional
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™