掲示板

BeanLocator has not been set for servlet context

thumbnail
11年前 に Florencia Gadea によって更新されました。

BeanLocator has not been set for servlet context

Regular Member 投稿: 146 参加年月日: 12/03/27 最新の投稿
Hi Everyone,

I'm getting the famous exception "BeanLocator has not been set for servlet context". I'm using LR 6.1.1 CE GA2, I created the project through the Liferay IDE and I'm using the service builder. I'm using Eclipse to deploy. My project has two portlets. I get this exception when I try to create an Entity through the class EntityLocalServiceUtil.createEntity(long).

This is a project that I first created for LR 6.1 CE GA1, and now I'm migrating to LR 6.1.1 CE GA2. The moment I migrated the from 6.1 to 6.1.1, everything worked fine. But after I rebuilt the service, I started to get this error and I coudn't get rid of it.

I've applied all the possible solutions I've seen in the forums and outside the forums, without success.

What I tried was:

1) Run many times the service builder, deleting the classes, service.jar, META-INF folder and service.proerties file too. I get a success message everytime:

[Console output redirected to file:/home/flor/workspaceLiferay/.metadata/.plugins/com.liferay.ide.eclipse.sdk/sdk.log]
Buildfile: /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/portlets/liferayGoogleAnalytics/build.xml
build-service:
     [echo] Loading jar:file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
     [echo] Dec 27, 2012 12:38:08 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Global shared lib directory /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/lib/
     [echo] Dec 27, 2012 12:38:08 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Global lib directory /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/ext/
     [echo] Dec 27, 2012 12:38:08 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Portal lib directory /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/
     [echo] Loading jar:file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
     [echo] Loading jar:file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties
     [echo] Dec 27, 2012 12:38:09 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
     [echo] INFO: Properties for portal loaded from [jar:file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties, jar:file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties]
     [echo] Building Configuration
    [mkdir] Created dir: /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/portlets/liferayGoogleAnalytics/docroot/WEB-INF/service-classes
compile-java:
     [copy] Copied 7 empty directories to 7 empty directories under /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/portlets/liferayGoogleAnalytics/docroot/WEB-INF/service-classes
    [javac] Compiling 14 source files to /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/portlets/liferayGoogleAnalytics/docroot/WEB-INF/service-classes
      [zip] Building zip: /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/portlets/liferayGoogleAnalytics/docroot/WEB-INF/lib/liferayGoogleAnalytics-service.jar
   [delete] Deleting directory /home/flor/workspaceLiferay/liferay-plugins-sdk-6.1.1/portlets/liferayGoogleAnalytics/docroot/WEB-INF/service-classes
BUILD SUCCESSFUL
Total time: 12 seconds


2) Added PortletContextLoaderListener in web.xml.

3) I've restarted the server many times, deleting the work and temp folders under tomcat.

4) My common.loader is:
common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/ext,${catalina.home}/lib/ext/*.jar


5) This portlet is not being used as a service from other portlets.

6) I have the proper liferay-plugin-package.xml and liferay-plugin-package.properties files.

7) I added portal.properties file with dumb data (because I don't actually need it).

8) The portlet deploys successfully:

13:29:26,585 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][AutoDeployDir:177] Processing liferayGoogleAnalytics-6.1.1.1.war
13:29:26,590 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:77] Copying portlets for /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/deploy/liferayGoogleAnalytics-6.1.1.1.war
13:29:26,595 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:763] Deploying liferayGoogleAnalytics-6.1.1.1.war
  Expanding: /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/deploy/liferayGoogleAnalytics-6.1.1.1.war into /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/20121227132926600
  Copying 1 file to /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/20121227132926600/WEB-INF/classes
  Copying 1 file to /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/20121227132926600/WEB-INF/classes
  Copying 1 file to /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/20121227132926600/WEB-INF/jsp
13:29:28,106 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][BaseDeployer:2083] Modifying Servlet 2.4 /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/20121227132926600/WEB-INF/web.xml
  Copying 1028 files to /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/liferayGoogleAnalytics-portlet
  Copying 1 file to /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/liferayGoogleAnalytics-portlet
  Deleting directory /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/20121227132926600
13:29:30,010 INFO  [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][PortletAutoDeployListener:87] Portlets for /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/deploy/liferayGoogleAnalytics-6.1.1.1.war copied successfully. Deployment will start in a few seconds.
Dec 27, 2012 1:29:38 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/liferayGoogleAnalytics-portlet
13:29:38,491 INFO  [pool-2-thread-2][HotDeployImpl:178] Deploying liferayGoogleAnalytics-portlet from queue
13:29:38,492 INFO  [pool-2-thread-2][PluginPackageUtil:1033] Reading plugin package for liferayGoogleAnalytics-portlet
Loading file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/2-liferayGoogleAnalytics-portlet/WEB-INF/classes/portlet.properties
Loading file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/2-liferayGoogleAnalytics-portlet/WEB-INF/classes/service.properties
13:29:40,832 INFO  [pool-2-thread-2][ServiceComponentLocalServiceImpl:280] Upgrading GoogleAnalytics database to build number 88
Loading file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/2-liferayGoogleAnalytics-portlet/WEB-INF/classes/portlet.properties
Dec 27, 2012 1:29:44 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Loading file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/2-liferayGoogleAnalytics-portlet/WEB-INF/classes/service.properties
Loading file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/2-liferayGoogleAnalytics-portlet/WEB-INF/classes/service.properties
13:29:44,446 INFO  [DispatcherPortlet:102] Initializing portlet 'googleanalytics'
13:29:44,472 INFO  [DispatcherPortlet:263] FrameworkPortlet 'googleanalytics': initialization started
13:29:44,503 INFO  [XmlPortletApplicationContext:500] Refreshing PortletApplicationContext for namespace 'googleanalytics-portlet': startup date [Thu Dec 27 13:29:44 GMT 2012]; root of context hierarchy
13:29:44,561 INFO  [XmlBeanDefinitionReader:315] Loading XML bean definitions from PortletContext resource [/WEB-INF/googleanalytics-portlet.xml]
13:29:44,933 INFO  [DefaultListableBeanFactory:581] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1eb91c6: defining beans [googleAnalyticsController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
13:29:45,039 INFO  [DispatcherPortlet:282] FrameworkPortlet 'googleanalytics': initialization completed in 567 ms
13:29:45,040 INFO  [DispatcherPortlet:123] Portlet 'googleanalytics' configured successfully
13:29:45,042 INFO  [DispatcherPortlet:102] Initializing portlet 'gaconfiguration'
13:29:45,042 INFO  [DispatcherPortlet:263] FrameworkPortlet 'gaconfiguration': initialization started
13:29:45,043 INFO  [XmlPortletApplicationContext:500] Refreshing PortletApplicationContext for namespace 'gaconfiguration-portlet': startup date [Thu Dec 27 13:29:45 GMT 2012]; root of context hierarchy
13:29:45,045 INFO  [XmlBeanDefinitionReader:315] Loading XML bean definitions from PortletContext resource [/WEB-INF/gaconfiguration-portlet.xml]
13:29:45,079 INFO  [DefaultListableBeanFactory:581] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1462246: defining beans [configurationController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
13:29:45,085 INFO  [DispatcherPortlet:282] FrameworkPortlet 'gaconfiguration': initialization completed in 42 ms
13:29:45,086 INFO  [DispatcherPortlet:123] Portlet 'gaconfiguration' configured successfully
Loading file:/opt/liferay/resourceEditor611/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/temp/2-liferayGoogleAnalytics-portlet/WEB-INF/classes/portlet.properties
Dec 27, 2012 1:29:45 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
13:29:45,102 INFO  [ContextLoader:272] Root WebApplicationContext: initialization started
13:29:45,108 INFO  [XmlWebApplicationContext:500] Refreshing Root WebApplicationContext: startup date [Thu Dec 27 13:29:45 GMT 2012]; root of context hierarchy
13:29:45,114 INFO  [XmlBeanDefinitionReader:315] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
13:29:45,170 INFO  [DefaultListableBeanFactory:581] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@eef34f: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,utilsExpert,configurationExpert,googleAnalyticsDataExpert,googleTokenExpert,viewResolver,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
13:29:45,218 INFO  [ContextLoader:301] Root WebApplicationContext: initialization completed in 116 ms


I have no idea what else to try. Anyone has a suggestion?

TIA,

Flor.
11年前 に Gogi SH によって更新されました。

RE: BeanLocator has not been set for servlet context

New Member 投稿: 3 参加年月日: 12/11/03 最新の投稿
Has anybody else faced this problem and solved it?
thumbnail
11年前 に Florencia Gadea によって更新されました。

RE: BeanLocator has not been set for servlet context

Regular Member 投稿: 146 参加年月日: 12/03/27 最新の投稿
The solution was creating the portlet again, and copy-pasting all the classes, configuration files, jsp, etc.

I couldn't get rid of that exception.

Cheers,

Flor.