Message Boards
How to use own service dependency from portal jsp hook?
Dev Liferay, modified 4 Years ago.
How to use own service dependency from portal jsp hook?
New Member Posts: 6 Join Date: 6/24/19 Recent Posts
Hi Liferay community,
I have created a hook for ui-discussion (page discussion liferay portlet). I would like to use in page.jsp file my own LocalServiceUtil that is a bundle. The problem is during deployment because the hook does not see this dependencies (java.lang.NoClassDefFoundError: Could not initialize class exception). I built a jar from own api service and placed it into tomcat/lib/ext, I also add Include-Resource and Import-Package information into bnd file but it did not help. Any ideas how to use own serivces in portal hooks? Thank you for help in advance.
Kind regards,
K
I have created a hook for ui-discussion (page discussion liferay portlet). I would like to use in page.jsp file my own LocalServiceUtil that is a bundle. The problem is during deployment because the hook does not see this dependencies (java.lang.NoClassDefFoundError: Could not initialize class exception). I built a jar from own api service and placed it into tomcat/lib/ext, I also add Include-Resource and Import-Package information into bnd file but it did not help. Any ideas how to use own serivces in portal hooks? Thank you for help in advance.
Kind regards,
K
Dev Liferay, modified 4 Years ago.
RE: How to use own service dependency from portal jsp hook?
New Member Posts: 6 Join Date: 6/24/19 Recent Posts
When I am using UtilLocator I am receiving NoSuchBeanDefinitionException
David H Nebinger, modified 4 Years ago.
RE: How to use own service dependency from portal jsp hook?
Liferay Legend Posts: 14916 Join Date: 9/2/06 Recent Posts
Combine with a portlet filter to @Reference the service in and then add as a request attribute.
In the JSP you can then extract the service from the attributes and invoke it as necessary.
In the JSP you can then extract the service from the attributes and invoke it as necessary.