掲示板

Using Content Targeting APIs

thumbnail
9年前 に Michał Mela によって更新されました。

Using Content Targeting APIs

New Member 投稿: 2 参加年月日: 14/02/12 最新の投稿
Hi guys!

In the Audience Targeting package there are a couple of API jars, namely: targeting.api, targeting.anonymous.users.api and content.targeting.analytics.api. Now I would like to create my own portlets which would make use of them, let's say to show a list of segments defined for a particular site.

I am wondering if there is a way to use these APIs in an old-school, WAR-based portlet, or should I go with creating an OSGi portlet, like the one in com.liferay.content.targeting.web-portlet ? (code examples would be welcome but not at all necessary!)

Thanks in advance emoticon
thumbnail
9年前 に Julio Camarero によって更新されました。

RE: Using Content Targeting APIs (回答)

Liferay Legend 投稿: 1668 参加年月日: 08/07/15 最新の投稿
Hi Michal,

nothing should prevent you from using the service-builder jars in the old-school way. You would just need to copy the jar files in the lib folder of your plugin and then use it as you would do with any other plugin. There is a blog entry about it here.

cheers!
thumbnail
9年前 に Michał Mela によって更新されました。

RE: Using Content Targeting APIs

New Member 投稿: 2 参加年月日: 14/02/12 最新の投稿
Hi Julio,

Thanks for the quick reply emoticon!

Unfortunately, I did not manage to get this work as easily... Are you entirely sure that dropping the service jar in libs should be enough?

I see that these Utils (e.g. AnonymousUserLocalServiceUtil) in audience targeting plugins work just as in old school plugins, locating service Impls through PortletBeanLocatorUtil. This does not work for me when used from a custom, non-OSGi plugin by throwing:
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context com.liferay.content.targeting.anonymous.users.api

And indeed, the bean locators' map at com.liferay.portal.kernel.bean.PortletBeanLocatorUtil._beanLocators does not contain bean locator for such servlet context (whose name, in turn, comes from com.liferay.content.targeting.rule.score.points.service.ClpSerializer._servletContextName).

(as a side note: I do believe that OSGi is a great architectural feature for Liferay and, from what I've seen in sources, you guys made an *outstanding* job putting it all together! However, I got a bit confused by amount of configuration it requires for even a simplest maven-based plugin in 6.2, so I though maybe I could wait with this until 7.0 (which, apparently, will bring some simplifications in this matter)...)
thumbnail
9年前 に Julio Camarero によって更新されました。

RE: Using Content Targeting APIs (回答)

Liferay Legend 投稿: 1668 参加年月日: 08/07/15 最新の投稿
Hi Michal,

sorry for the late reply, but it took me some time to able to work on this.

I just build a sample portlet to test this and it worked for me. I have pushed my code to github so that you can see if there are any differences with yours.

You can see the latest commits in this branch (those which start with Sample API Client).

Please let us know if that works for you and what was your issue.

thanks!
9年前 に Dmitry Nikeshkin によって更新されました。

RE: Using Content Targeting APIs

New Member 投稿: 4 参加年月日: 12/11/12 最新の投稿
Did you really try to deploy your portlet to liferay bundle? Did it work?
thumbnail
9年前 に Julio Camarero によって更新されました。

RE: Using Content Targeting APIs

Liferay Legend 投稿: 1668 参加年月日: 08/07/15 最新の投稿
Yes, it works.
thumbnail
8年前 に Rahul Mantri によって更新されました。

RE: Using Content Targeting APIs

New Member 投稿: 10 参加年月日: 11/02/10 最新の投稿
Hi Julio,

I have been trying to access Content Targeting API from my custom portlet project which also holds service components.
I have followed exact same steps as you provided on your GITHUB project. But still I am facing "BeanLocator is null for servlet context content-targeting-api" issue and am unable to use COntent targeting APIs.

What I did is - I downloaded the Sample-client-portlet from GITHUB and tried calling Content targeting API from the portlet class.

here is the code in my portlet class-

public class SampleClientPortlet extends MVCPortlet {
public void render(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
System.out.println("*** getProductCampaignList() start");
try {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Campaign.class);
List<Campaign> activeCampaignList = CampaignLocalServiceUtil.dynamicQuery(dynamicQuery);
System.out.println("activeCampaignList --->>>>>>"+ activeCampaignList);
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}

please see herein - the entire stacktrace : -

12:19:26,335 ERROR [http-bio-8181-exec-66][PortletBeanLocatorUtil:42] BeanLocator is null for servlet context content-targeting-api
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context content-targeting-api
at com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(PortletBeanLocatorUtil.java:46)
at com.liferay.content.targeting.service.CampaignLocalServiceUtil.getService(CampaignLocalServiceUtil.java:622)
at com.liferay.content.targeting.service.CampaignLocalServiceUtil.dynamicQuery(CampaignLocalServiceUtil.java:111)
at com.liferay.content.targeting.sample.SampleClientPortlet.render(SampleClientPortlet.java:34)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:604)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:677)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:379)
at com.liferay.portlet.MonitoringPortlet.render(MonitoringPortlet.java:251)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1231)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:655)
at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:138)
at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)
at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)
at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer.render(PortletRenderer.java:72)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.doProcessTemplate(RuntimePageImpl.java:460)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.doDispatch(RuntimePageImpl.java:284)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.processTemplate(RuntimePageImpl.java:113)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.processTemplate(RuntimePageImpl.java:124)
at com.liferay.portal.layoutconfiguration.util.RuntimePageUtil.processTemplate(RuntimePageUtil.java:69)
at org.apache.jsp.html.portal.layout.view.portlet_jsp._jspService(portlet_jsp.java:554)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
at com.liferay.portal.action.LayoutAction.includeLayoutContent(LayoutAction.java:305)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:408)
at com.liferay.portal.action.LayoutAction.doExecute(LayoutAction.java:203)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:95)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:178)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:549)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:526)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.monitoring.MonitoringFilter.processFilter(MonitoringFilter.java:94)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:359)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.i18n.I18nFilter.processFilter(I18nFilter.java:243)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.monitoring.MonitoringFilter.processFilter(MonitoringFilter.java:94)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:267)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.sso.ntlm.NtlmPostFilter.processFilter(NtlmPostFilter.java:83)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.sharepoint.SharepointFilter.processFilter(SharepointFilter.java:88)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:226)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Can you please assist in this regard? The issue has become critical for the delivery emoticon
thumbnail
8年前 に Julio Camarero によって更新されました。

RE: Using Content Targeting APIs

Liferay Legend 投稿: 1668 参加年月日: 08/07/15 最新の投稿
Hi Rahul,

can you try to deploy the portlet from github and see if that one works for you? I wonder if there is something strange with your environment or if there is something wrong with the dynamic query method.

Can you also try to go to http://localhost:8080/api/jsonws and run some of the queries from Audience Targeting context to see if those work for you?

thanks!
thumbnail
8年前 に Rahul Mantri によって更新されました。

RE: Using Content Targeting APIs

New Member 投稿: 10 参加年月日: 11/02/10 最新の投稿
Surprisingly - I do not see any JSON WS for COntent Targetting API when I hit http://localhost:8080/api/jsonws

I tried deploying the portlet from GITHUB directly but till same error.
Also I removed DynamicQuery related code from the portlet and just put a simple code to fetch list of all campaigns -
campaigns = CampaignLocalServiceUtil.getCampaigns(
themeDisplay.getScopeGroupId());

But no success emoticon
thumbnail
8年前 に Julio Camarero によって更新されました。

RE: Using Content Targeting APIs

Liferay Legend 投稿: 1668 参加年月日: 08/07/15 最新の投稿
Hi Rahul,

the problems seems to be related with the deployment of audience targeting itself and not with the code you are using to access it.

Do you see the app "Audience Targeting" in the Site Administration?

Can you please restart your server and check if it shows up in the "/api/jsonws" UI? The code won't work until you can see Audience Targeting here.

thanks!
thumbnail
8年前 に Rahul Mantri によって更新されました。

RE: Using Content Targeting APIs

New Member 投稿: 10 参加年月日: 11/02/10 最新の投稿
Julio,

Indeed - when I clean installed audience targeting plugin in liferay instance - the error is gone and I am now able to access content targeting API inside the custom portlet.
However - I am still NOT able to see JSONWS for content targeting API when I access http://localhost:8080/api/jsonws - please suggest.
I checked it in 2-3 more instances and the behavior is still the same.


There is one more interesting fact to share on "BeanLocator is null for servlet context content-targeting-api" issue -

1. Create a Liferay plugin project and add a new portlet plugin to it.
2. create a service builder plugin in the same project
3. try to access the content targeting API from your custom portlet

You will get "BeanLocator is null for servlet context content-targeting-api" issue and content targeting APIs are not accessible anymore.
Note- Audience targeting is installed correctly in the liferay instance.

Any suggestions on how can we make these APIs accessible in a project which also includes custom service builder relates code as well?
thumbnail
3年前 に Eduardo P. García によって更新されました。

RE: Using Content Targeting APIs

Regular Member 投稿: 157 参加年月日: 12/03/16 最新の投稿
Hi Rahul,

What context paths can you see when expanding the Context Path selector in /api/jsonws after installing Audience Targeting?

As for the BeanLocator error, could you try as a test to add the following Audience Targeting deployment context mappings into your plugin's portlet.properties and redeploy?

com.liferay.content.targeting.analytics.api-deployment-context=analytics-api
com.liferay.content.targeting.anonymous.users.api-deployment-context=anonymous-users-api
com.liferay.content.targeting.api-deployment-context=content-targeting-api

Thanks!
7年前 に Markus Born によって更新されました。

RE: Using Content Targeting APIs

New Member 投稿: 10 参加年月日: 16/04/01 最新の投稿
Hi,

Sorry for restarting this thread but to me it seems that the problem is not yet solved?
I tried anything I could find here, but nothing worked for me.

Im trying to use the audience targeting API and the anonymous user API from within a portlet.
Deployment is working fine, but when I try to put the portlet on a page, it receive
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context com.liferay.content.targeting.api

My portlet is based on maven build, the pom contains the following dependencies:
<dependency>
<groupId>com.liferay.content-targeting</groupId>
<artifactId>com.liferay.content.targeting.api</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.liferay.content-targeting</groupId>
<artifactId>com.liferay.content.targeting.anonymous.users.api</artifactId>
<version>1.1.0</version>
</dependency>

Thanks in advance.
Markus