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: 7.1 & CustomSQLUtil
Hello,
my module fails on deployment (Liferay 7.1-GA1). Stacktrace can be found at the bottom of this post.
I already tried this but it didn't help! It maybe didn't help because the exception is slightly different: javax.portlet.PortletException vs javax.servlet.jsp.JspException
The chat module initially tries to render JSP, maybe it has something to do with that?
2018-10-01 13:37:41.945 ERROR [http-nio-8080-exec-7][status_jsp:927]
javax.servlet.jsp.JspException:
com.liferay.portal.kernel.portlet.PortletContainerException:
javax.servlet.ServletException: java.lang.NoClassDefFoundError:
com/liferay/portal/dao/orm/custom/sql/CustomSQLUtil
2018-10-01
13:37:41.952 ERROR [liferay/monitoring-1][ParallelDestination:55]
Unable to process message {destinationName=liferay/monitoring,
response=null, responseDestinationName=null, responseId=null,
payload=[{displayName=Hello World,
portletId=com_liferay_hello_world_web_portlet_HelloWorldPortlet,
requestType=RENDER, {attributes=null, companyId=20099, groupId=20126,
description=null, duration=0,
name=com_liferay_hello_world_web_portlet_HelloWorldPortlet,
namespace=com.liferay.monitoring.Portlet, requestStatus=SUCCESS,
stopWatch=0:00:00.000, timeout=0, user=20139}}, {displayName=Chat,
portletId=com_liferay_chat_web_portlet_ChatPortlet,
requestType=RENDER, {attributes=null, companyId=20099, groupId=20126,
description=null, duration=0,
name=com_liferay_chat_web_portlet_ChatPortlet,
namespace=com.liferay.monitoring.Portlet, requestStatus=null,
stopWatch=0:00:00.053, timeout=0, user=20139}}, {displayName=Product
Menu,
portletId=com_liferay_product_navigation_product_menu_web_portlet_ProductMenuPortlet,
requestType=RENDER, {attributes=null, companyId=20099, groupId=20126,
description=null, duration=0,
name=com_liferay_product_navigation_product_menu_web_portlet_ProductMenuPortlet,
namespace=com.liferay.monitoring.Portlet, requestStatus=SUCCESS,
stopWatch=0:00:00.000, timeout=0, user=20139}}, {displayName=Search
Bar,
portletId=com_liferay_portal_search_web_search_bar_portlet_SearchBarPortlet_INSTANCE_templateSearch,
requestType=RENDER, {attributes=null, companyId=20099, groupId=20126,
description=null, duration=7,
name=com_liferay_portal_search_web_search_bar_portlet_SearchBarPortlet,
namespace=com.liferay.monitoring.Portlet, requestStatus=SUCCESS,
stopWatch=0:00:00.007, timeout=0, user=20139}}, {displayName=User
Personal Bar,
portletId=com_liferay_product_navigation_user_personal_bar_web_portlet_ProductNavigationUserPersonalBarPortlet,
requestType=RENDER, {attributes=null, companyId=20099, groupId=20126,
description=null, duration=0,
name=com_liferay_product_navigation_user_personal_bar_web_portlet_ProductNavigationUserPersonalBarPortlet,
namespace=com.liferay.monitoring.Portlet, requestStatus=SUCCESS,
stopWatch=0:00:00.000, timeout=0, user=20139}},
{displayName=Navigation,
portletId=com_liferay_site_navigation_menu_web_portlet_SiteNavigationMenuPortlet,
requestType=RENDER, {attributes=null, companyId=20099, groupId=20126,
description=null, duration=1,
name=com_liferay_site_navigation_menu_web_portlet_SiteNavigationMenuPortlet,
namespace=com.liferay.monitoring.Portlet, requestStatus=SUCCESS,
stopWatch=0:00:00.001, timeout=0, user=20139}}, {referer=null,
remoteAddr=127.0.0.1,
requestURL=http://localhost:8080/c/portal/status.jsp_display,
statusCode=400, userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132
Safari/537.36, {attributes=null, companyId=20099, groupId=20126,
description=Portal Request, duration=36, name=/c/portal/status,
namespace=com.liferay.monitoring.Portal, requestStatus=SUCCESS,
stopWatch=0:00:00.036, timeout=-1, user=20139}}, {referer=null,
remoteAddr=127.0.0.1, requestURL=, statusCode=400,
userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36,
{attributes=null, companyId=20099, groupId=20126, description=null,
duration=50, name=/c/portal/status,
namespace=com.liferay.monitoring.Portal, requestStatus=SUCCESS,
stopWatch=0:00:00.050, timeout=-1, user=20139}}, {referer=null,
remoteAddr=127.0.0.1, requestURL=, statusCode=400,
userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36,
{attributes=null, companyId=20099, groupId=20126, description=null,
duration=109, name=/c/portal/layout,
namespace=com.liferay.monitoring.Portal, requestStatus=SUCCESS,
stopWatch=0:00:00.109, timeout=-1, user=20139}}, {referer=null,
remoteAddr=127.0.0.1, requestURL=, statusCode=400,
userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36,
{attributes=null, companyId=20099, groupId=20126, description=null,
duration=112, name=/web/guest,
namespace=com.liferay.monitoring.Portal, requestStatus=SUCCESS,
stopWatch=0:00:00.112, timeout=-1, user=null}}],
values={defaultLocale=en_US, companyId=20099, groupId=0,
principalName=20139,
permissionChecker=com.liferay.portal.kernel.util.TransientValue@7fec8be9,
siteDefaultLocale=en_US, themeDisplayLocale=en_US}}
com.liferay.portal.kernel.messaging.MessageListenerException:
java.lang.NullPointerException
at
com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:32)
at
com.liferay.portal.kernel.messaging.InvokerMessageListener.receive(InvokerMessageListener.java:74)
at
com.liferay.portal.kernel.messaging.ParallelDestination$1.run(ParallelDestination.java:52)
at
com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:756)
at
com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:667)
at java.lang.Thread.run(Thread.java:748)
Caused by:
java.lang.NullPointerException
at
com.liferay.portal.monitoring.internal.statistics.portlet.PortletStatistics.processDataSample(PortletStatistics.java:112)
at
com.liferay.portal.monitoring.internal.statistics.portlet.CompanyStatistics.processDataSample(CompanyStatistics.java:209)
at
com.liferay.portal.monitoring.internal.statistics.portlet.ServerStatistics.processDataSample(ServerStatistics.java:117)
at
com.liferay.portal.monitoring.internal.statistics.portlet.ServerStatistics.processDataSample(ServerStatistics.java:35)
at
com.liferay.portal.monitoring.internal.messaging.MonitoringMessageListener.processDataSample(MonitoringMessageListener.java:93)
at
com.liferay.portal.monitoring.internal.messaging.MonitoringMessageListener.doReceive(MonitoringMessageListener.java:120)
at
com.liferay.portal.kernel.messaging.BaseMessageListener.receive(BaseMessageListener.java:26)
... 5 more
Michel Schmidt:java.lang.NoClassDefFoundError: com/liferay/portal/dao/orm/custom/sql/CustomSQLUtil
Inside of modules, according to LPS-77361, the
class CustomSQLUtil is no longer exported, and if I
search the code base in 7.1.x, the class itself is gone too. Instead,
you need to add a ServiceReference to a
CustomSQL service. You can see examples of this new
pattern in BlogsEntryFinderImpl
and in WikiFinderImpl.
Minhchau Dang:Michel Schmidt:java.lang.NoClassDefFoundError: com/liferay/portal/dao/orm/custom/sql/CustomSQLUtilInside of modules, according to LPS-77361, the class
CustomSQLUtilis no longer exported, and if I search the code base in 7.1.x, the class itself is gone too. Instead, you need to add aServiceReferenceto aCustomSQLservice. You can see examples of this new pattern in BlogsEntryFinderImpl and in WikiFinderImpl.
I read your post in the other thread, but I already tried it but it seems it wasn't enough since you also need to have the correct dependency (api instead monolithic module).
Thanks for helping, problem solved!
*Update*
Solved it, the problem was a dependency that has been modularized by liferay. The dependency wasn't modularized in Liferay CE 7.0, that's why my code wouldn't run on Liferay CE 7.1 out-of-the-box.
My gradle script was using the dependency :
provided group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.1'
But here and here you can see that the dependency has been split into api and impl.
After declaring the correct dependency:
provided group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql.api", version: "1.0.1"
everything worked again.