0

I've got two Liferay portlets.

The first one manages persistence, I've created some entities and run service builder. After that, I've created a couple of methods in MyEntityLocalServiceImpl and run service builder again to get all the related methods.

I generate the jar and the war of this portlet, install the war in my Liferay instance and copy the jar at tomcat's /lib/ext

From my second portlet, I call MyEntityServiceUtil.myMethod(myParams) and, at execution time, it throws:

10:51:59,458 ERROR [http-bio-8080-exec-8][PortletServlet:116] javax.portlet.PortletException: java.lang.NoClassDefFoundError: com/liferay/portal/service/BaseService
javax.portlet.PortletException: java.lang.NoClassDefFoundError: com/liferay/portal/service/BaseService
    at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:181)
    at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:249)
    at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:90)
    at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:212)
    at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:71)
    at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
    at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    ...

I can see portal-service.jar at tomcat's /lib/ext, containing BaseService.class

Any idea why is it not being found at execution time? Thanks!

Marta
  • 97
  • 1
  • 1
  • 11
  • 1
    please also state the *exact* Liferay version (down to the GA level). Any reason why you're copying your service.jar to the global classpath? – Olaf Kock Jul 20 '18 at 13:15
  • I'm running Liferay 6.2 GA6. I copy the service.jar to the global classpath because I need it to be available from several portlets, and not having it there makes me have "bean not found" exception at execution time... – Marta Jul 23 '18 at 06:41
  • I've changed configuration: the service.jar is not at /lib/ext anymore, only deployed as a portlet and referenced from the portlets that need to access persistence methods. I continue with the same exception... – Marta Jul 24 '18 at 07:17
  • So, no suggestions @OlafKock ? I thought everything in {tomcat}/lib/ext was available for sure from all classes... – Marta Jul 27 '18 at 07:37
  • Check https://stackoverflow.com/a/5756989 - hard to say otherwise with the information available – Olaf Kock Jul 27 '18 at 08:21
  • Thanks, such a complete thread, unfortunately didn't help my issue. The root cause is a "java.lang.ClassNotFoundException: com.liferay.portal.service.BaseService" but can't guess why. System property "common.loader" includes "${catalina.home}/lib/ext", where the jar is. "com.liferay.portal.service.BaseService.class.getProtectionDomain().getCodeSource().getLocation()" points to "${catalina.home}/lib/ext", so it might be found. Continue looking for... – Marta Jul 27 '18 at 12:19

0 Answers0