Foren

BeanLocator is null for servlet context

Javier Cacheiro, geändert vor 9 Jahren.

BeanLocator is null for servlet context

New Member Beiträge: 8 Beitrittsdatum: 05.05.14 Neueste Beiträge
Hi,
I am getting a "BeanLocator is null" error. Reviewing existing threads I saw it is usually related with the service deployment. In my case I have increased the build.number of the service and redeployed but I still get the error.
If I deploy in the local version of Liferay everything works correctly, the problem only occurs when I deploy the war to the remote instance. The deployment seems fine according to the log file, but later on when I try to access the portlet I get this error (the SiteLocalServiceUtil is not found):

10:39:25,675 ERROR [http-bio-8080-exec-38][PortletBeanLocatorUtil:42] BeanLocator is null for servlet context accounting-portlet-v3-portlet
10:39:25,679 ERROR [http-bio-8080-exec-38][PortletRequestDispatcherImpl:115] org.apache.jasper.JasperException: An exception occurred processing JSP page /html/sitelisting/view.jsp at line 35__32: _33: _34: <liferay-ui:search-container emptyresultsmessage="There are no sites to display">_35:     <liferay-ui:search-container-results_36: results="<%= SiteLocalServiceUtil.getSites(searchContainer.getStart(), searchContainer.getEnd()) %>" _37: total="<%= SiteLocalServiceUtil.getSitesCount() %>" _38: />___Stacktrace: [Sanitized]
org.apache.jasper.JasperException: An exception occurred processing JSP page /html/sitelisting/view.jsp at line 35__32: _33: _34: <liferay-ui:search-container emptyresultsmessage="There are no sites to display">_35:     <liferay-ui:search-container-results_36: results="<%= SiteLocalServiceUtil.getSites(searchContainer.getStart(), searchContainer.getEnd()) %>" _37: total="<%= SiteLocalServiceUtil.getSitesCount() %>" _38: />___Stacktrace: [Sanitized]

Caused by: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context accounting-portlet-v3-portlet</liferay-ui:search-container></liferay-ui:search-container>


Additionally I don't know why the war is deployed under webapps/accounting-portlet-v3-portlet in the local instance but in webapps/accounting-portlet directory in the remote liferay instance.

Any help will be greatly appreciated.

Thanks
thumbnail
David H Nebinger, geändert vor 9 Jahren.

RE: BeanLocator is null for servlet context

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
It is based upon the war artifact name. I'm guessing that you changed the project name but didn't replicate the change where it needed (i.e. ClpSerializer.java). Sometimes you can resolve this by removing the built service sources/classes in the /docroot/WEB-INF/service folder (effectively a really clean build) and hope that they get recreated correctly.
Javier Cacheiro, geändert vor 9 Jahren.

RE: BeanLocator is null for servlet context

New Member Beiträge: 8 Beitrittsdatum: 05.05.14 Neueste Beiträge
David, thanks a lot for your answer. You are right, actually I created a new project where I merged two existing ones. Previous service project used the accounting-portlet name while the new one that merges it with another primefaces project uses accounting-portlet-V3-portlet name. Since there were issues with the merging I just started a empty project and added each project files.

I have tried removing sources and rebuilding the service but it has not worked. Just verified the contents of ClpSerializer.java and it is the same as before the rebuild. I reviewed all the references inside this class and they are all using the new project name.

There is one thing I really don't understand and it is why the war file is deployed under the old project name (webapps/accounting-portlet) in the remote liferay instance but under the new name locally (webapps/accounting-portlet-V3-portlet). Could this be the reason later it does not find the service jar?
Javier Cacheiro, geändert vor 9 Jahren.

RE: BeanLocator is null for servlet context

New Member Beiträge: 8 Beitrittsdatum: 05.05.14 Neueste Beiträge
In the local instance logs I see it is registered using the new name:

13:42:30,244 INFO  [ContainerBackgroundProcessor[StandardEngine[Catalina]]][HookHotDeployListener:687] Registering hook for accounting-portlet-v3-portlet


But in the remote instance:

08:37:16,777 INFO  [localhost-startStop-4][HookHotDeployListener:687] Registering hook for accounting-portlet
Javier Cacheiro, geändert vor 9 Jahren.

RE: BeanLocator is null for servlet context

New Member Beiträge: 8 Beitrittsdatum: 05.05.14 Neueste Beiträge
Looking at the whole deployment process I think the problem is in the fact that in the remote instance it deploys the portlets in the accounting-portlet servlet context but the portlet is actually accounting-portlet-v3-portlet:

08:37:09,523 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:91] Portlets for /opt/liferay-portal-6.2.0-ce-ga1/deploy/accounting-portlet-v3-portlet-6.2.0.1.war copied successfully. Deployment will start in a few seconds.
08:37:15,932 INFO  [localhost-startStop-4][HotDeployEvent:130] Plugin accounting-portlet requires marketplace-portlet
08:37:15,933 INFO  [localhost-startStop-4][HotDeployImpl:195] Deploying accounting-portlet from queue
08:37:15,933 INFO  [localhost-startStop-4][PluginPackageUtil:1016] Reading plugin package for accounting-portlet
08:37:16,777 INFO  [localhost-startStop-4][HookHotDeployListener:687] Registering hook for accounting-portlet
08:37:16,779 INFO  [localhost-startStop-4][HookHotDeployListener:814] Hook for accounting-portlet is available for use
08:37:16,783 INFO  [localhost-startStop-4][PortletHotDeployListener:343] Registering portlets for accounting-portlet
08:37:17,122 INFO  [localhost-startStop-4][PortletHotDeployListener:495] 4 portlets for accounting-portlet are available for use
...
08:37:18,367 ERROR [http-bio-8080-exec-23][PortletBeanLocatorUtil:42] BeanLocator is null for servlet context accounting-portlet-v3-portlet
Caused by: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context accounting-portlet-v3-portlet
Caused by: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context accounting-portlet-v3-portlet
com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context accounting-portlet-v3-portlet


This does not happen in the local developement environment:

12:50:21,871 INFO  [localhost-startStop-1][HotDeployImpl:195] Deploying accounting-portlet-v3-portlet from queue
12:50:21,871 INFO  [localhost-startStop-1][PluginPackageUtil:1016] Reading plugin package for accounting-portlet-v3-portlet
12:50:22,829 INFO  [localhost-startStop-1][HookHotDeployListener:687] Registering hook for accounting-portlet-v3-portlet
12:50:22,834 INFO  [localhost-startStop-1][HookHotDeployListener:814] Hook for accounting-portlet-v3-portlet is available for use
12:50:22,838 INFO  [localhost-startStop-1][PortletHotDeployListener:343] Registering portlets for accounting-portlet-v3-portlet
12:50:23,335 INFO  [localhost-startStop-1][PortletHotDeployListener:495] 4 portlets for accounting-portlet-v3-portlet are available for use


I have tried starting from a fresh install of the remote liferay instance but the result is the same. I don't know why it takes accounting-portlet as the name instead of accounting-portlet-v3-portlet.

Any suggestion about how to continue debugging the issue will be highly appreciated.

Any will be highly appreciated.
Javier Cacheiro, geändert vor 9 Jahren.

RE: BeanLocator is null for servlet context

New Member Beiträge: 8 Beitrittsdatum: 05.05.14 Neueste Beiträge
Finally I have been able to solve the problem renaming the project to accounting3-portlet, changing all references to the old name and rebuilding the service and the war.

It seems the accounting-portlet-v3-portlet project name was causing problems because it has "portlet" in the middle. Probably the name is split internally in the deployment process to generate the servlet context name.