组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
BeanLocator has not been set for servlet context Richard Kosegi 2011年10月24日 上午12:20
RE: BeanLocator has not been set for servlet context Jan Gregor 2011年11月23日 上午7:37
RE: BeanLocator has not been set for servlet context Richard Kosegi 2011年11月23日 上午8:42
RE: BeanLocator has not been set for servlet context Jan Gregor 2011年11月29日 上午2:21
RE: BeanLocator has not been set for servlet context Richard Kosegi 2011年11月29日 上午2:53
RE: BeanLocator has not been set for servlet context Jan Gregor 2011年11月29日 上午3:21
RE: BeanLocator has not been set for servlet context Richard Kosegi 2011年11月29日 上午3:44
RE: BeanLocator has not been set for servlet context Brian Ko 2011年12月6日 上午8:58
RE: BeanLocator has not been set for servlet context Richard Kosegi 2011年12月6日 上午9:05
RE: BeanLocator has not been set for servlet context Brian Ko 2011年12月6日 上午11:18
RE: BeanLocator has not been set for servlet context Ashok Kumar G 2015年10月26日 上午3:47
RE: BeanLocator has not been set for servlet context Florian Limpöck 2016年1月19日 上午4:37
RE: BeanLocator has not been set for servlet context Chí Văn Ngô 2016年3月26日 下午12:06
RE: BeanLocator has not been set for servlet context Shahbaz Khan 2016年3月27日 上午6:44
RE: BeanLocator has not been set for servlet context Brian Ko 2011年12月9日 上午7:28
RE: BeanLocator has not been set for servlet context Naidu Jitta 2012年3月13日 下午3:05
RE: BeanLocator has not been set for servlet context Brian Ko 2012年3月13日 下午3:33
RE: BeanLocator has not been set for servlet context Eugene Bova 2012年3月27日 上午9:22
RE: BeanLocator has not been set for servlet context Richard Kosegi 2012年4月3日 上午7:24
RE: BeanLocator has not been set for servlet context David H Nebinger 2012年4月3日 上午7:59
RE: BeanLocator has not been set for servlet context Richard Kosegi 2012年4月3日 上午8:02
RE: BeanLocator has not been set for servlet context Ali Shahrami 2012年5月30日 下午2:34
RE: BeanLocator has not been set for servlet context Mahdi Lashkari 2012年6月11日 上午12:17
RE: BeanLocator has not been set for servlet context Mario Lueder 2012年6月25日 上午2:22
RE: BeanLocator has not been set for servlet context Aristide Cittadino 2014年6月20日 上午5:52
RE: BeanLocator has not been set for servlet context Jobin Mathew 2014年8月19日 下午11:48
RE: BeanLocator has not been set for servlet context Dan Overman 2015年10月7日 上午8:43
RE: BeanLocator has not been set for servlet context Felix Gonzalez de Santos 2015年10月8日 上午7:56
Richard Kosegi
BeanLocator has not been set for servlet context
2011年10月24日 上午12:20
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi All,

I have problem with deploying portlet to my production server.

During development everything goes fine.After deploy I receive following errors:
 1
 207:15:08,460 ERROR [PortletBeanLocatorUtil:38] BeanLocator is null for servlet context GSMPortlets-portlet
 307:15:08,462 ERROR [PortletServlet:97] javax.portlet.PortletException: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context GSMPortlets-portlet
 4javax.portlet.PortletException: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context GSMPortlets-portlet
 5        at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:164)
 6        at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:241)
 7        at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:76)
 8        at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:211)
 9        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
10        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
11        at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
12        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
13...


and
 1
 207:15:08,494 ERROR [render_portlet_jsp:154] com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context GSMPortlets-portlet
 3        at com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.locate(PortletBeanLocatorUtil.java:42)
 4        at net.ezzhole.liferay.portlets.gsm.service.MessageLocalServiceUtil.getService(MessageLocalServiceUtil.java:235)
 5        at net.ezzhole.liferay.portlets.gsm.service.MessageLocalServiceUtil.addMessage(MessageLocalServiceUtil.java:48)
 6        at net.ezzhole.liferay.portlets.gsm.SMSPortlet.sendMessage(SMSPortlet.java:61)
 7        at com.liferay.portal.kernel.portlet.LiferayPortlet.callActionMethod(LiferayPortlet.java:146)
 8        at com.liferay.util.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:241)
 9        at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:76)
10        at com.liferay.util.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:211)
11        at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
12        at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
13        at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:93)
14        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
15        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
16...


I think that this is related to liferay service layer.

What can be root cause?
Jan Gregor
RE: BeanLocator has not been set for servlet context
2011年11月23日 上午7:37
答复

Jan Gregor

等级: Regular Member

帖子: 224

加入日期: 2010年10月20日

最近的帖子

Hi there,

I am expecting you are using some service built by Service builder, is it correct ? Make sure this service was deployed correctly.

Regards,
Jan.
Richard Kosegi
RE: BeanLocator has not been set for servlet context
2011年11月23日 上午8:42
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi Jan,

thank you for reply.

Yes, you're right, I'm using service builder.

Sorry, but what you mean by "deployed correctly"?
I'm using Eclipse with liferay SDK 6.1, localy no problem, portlet deployed succesfully, I can perform CRUD operations.
But when I deploy to server, this errors occures.

Any hints please?
Jan Gregor
RE: BeanLocator has not been set for servlet context
2011年11月29日 上午2:21
答复

Jan Gregor

等级: Regular Member

帖子: 224

加入日期: 2010年10月20日

最近的帖子

Hi Richard,

Are you deploying the service separately, or is part of your portlet war file ? Do you get any errors by deployment ? Normally this error comes, when the service was not deployed, or there was some error during deployment. That's why i asked the question.

Regards,
Jan.
Richard Kosegi
RE: BeanLocator has not been set for servlet context
2011年11月29日 上午2:53
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi Jan,

Service is part of WAR file

I receive following error during deployment:

  1
  210:50:01,208 ERROR [PortletApplicationContext:82] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean class [com.liferay.portal.dao.shard.ShardAdvice] not found
  3Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/shard-data-source-spring.xml]
  4Bean 'com.liferay.portal.dao.shard.ShardAdvice'; nested exception is java.lang.ClassNotFoundException: com.liferay.portal.dao.shard.ShardAdvice
  5org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean class [com.liferay.portal.dao.shard.ShardAdvice] not found
  6Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/shard-data-source-spring.xml]
  7Bean 'com.liferay.portal.dao.shard.ShardAdvice'; nested exception is java.lang.ClassNotFoundException: com.liferay.portal.dao.shard.ShardAdvice
  8        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
  9        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
 10        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:291)
 11        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:491)
 12        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:396)
 13        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:365)
 14        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:258)
 15        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:153)
 16        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
 17        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
 18        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
 19        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
 20        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
 21        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
 22        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
 23        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
 24        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
 25        at com.liferay.portal.spring.context.PortletApplicationContext.loadBeanDefinitions(PortletApplicationContext.java:71)
 26        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
 27        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
 28        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
 29        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
 30        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
 31        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
 32        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
 33        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
 34        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
 35        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
 36        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
 37        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
 38        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
 39        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
 40        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
 41        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
 42        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
 43        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
 44        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
 45        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
 46        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
 47        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
 48        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
 49        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
 50        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
 51        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
 52        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
 53        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
 54        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
 55        at java.lang.Thread.run(Thread.java:619)
 56Caused by: java.lang.ClassNotFoundException: com.liferay.portal.dao.shard.ShardAdvice
 57        at java.lang.ClassLoader.findClass(ClassLoader.java:359)
 58        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 59        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 60        at com.liferay.portal.spring.util.FilterClassLoader.loadClass(FilterClassLoader.java:41)
 61        at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
 62        at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:63)
 63        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.createBeanDefinition(BeanDefinitionParserDelegate.java:616)
 64        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:472)
 65        ... 44 more
 6610:50:01,590 ERROR [ContextLoader:220] Context initialization failed
 67org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferaySessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'portletClassLoader' while setting bean property 'sessionFactoryClassLoader'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
 68        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
 69        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
 70        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
 71        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
 72        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
 73        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
 74        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
 75        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
 76        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
 77        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
 78        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
 79        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
 80        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
 81        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
 82        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
 83        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
 84        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
 85        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
 86        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
 87        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
 88        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
 89        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
 90        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
 91        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
 92        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
 93        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
 94        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
 95        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
 96        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
 97        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
 98        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
 99        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
100        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
101        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
102        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
103        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
104        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
105        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
106        at java.lang.Thread.run(Thread.java:619)
107Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
108        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
109        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
110        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
111        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
112        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
113        ... 38 more
11410:50:01,593 ERROR [PortalClassLoaderServletContextListener:96] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferaySessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'portletClassLoader' while setting bean property 'sessionFactoryClassLoader'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
115org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferaySessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'portletClassLoader' while setting bean property 'sessionFactoryClassLoader'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
116        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
117        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
118        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
119        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
120        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
121        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
122        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
123        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
124        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
125        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
126        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
127        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
128        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
129        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
130        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
131        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
132        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
133        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
134        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
135        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
136        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
137        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
138        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
139        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
140        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
141        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
142        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
143        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
144        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
145        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
146        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
147        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
148        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
149        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
150        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
151        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
152        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
153        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
154        at java.lang.Thread.run(Thread.java:619)
155Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
156        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
157        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
158        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
159        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
160        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
161        ... 38 more




Thank you
Jan Gregor
RE: BeanLocator has not been set for servlet context
2011年11月29日 上午3:21
答复

Jan Gregor

等级: Regular Member

帖子: 224

加入日期: 2010年10月20日

最近的帖子

Okay, so we are now moving to the cause of that problem. So our goal is now to discover this error. The original message "Bean not initialized" is caused by the fact, that the service is actually not deployed because of this error. Can you try to undeploy the service war, clean, build and re-deploy it again ? Do you get any error by building or cleaning the module ?

Jan.
Richard Kosegi
RE: BeanLocator has not been set for servlet context
2011年11月29日 上午3:44
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi Jan,

this is what I got when tried to remove portlet:

 1
 2INFO: Undeploying context [/download-portlet]
 311:38:35,799 INFO  [PluginPackageUtil:1101] Reading plugin package for download-portlet
 411:38:35,819 ERROR [HotDeployUtil:205] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error unregistering plugins for download-portlet
 5com.liferay.portal.kernel.deploy.hot.HotDeployException: Error unregistering plugins for download-portlet
 6        at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
 7        at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeUndeploy(PluginPackageHotDeployListener.java:65)
 8        at com.liferay.portal.kernel.deploy.hot.HotDeployUtil._fireUndeployEvent(HotDeployUtil.java:202)
 9        at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireUndeployEvent(HotDeployUtil.java:44)
10        at com.liferay.portal.kernel.servlet.PortletContextListener.doPortalDestroy(PortletContextListener.java:60)
11        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalDestroy(BasePortalLifecycle.java:30)
12        at com.liferay.portal.kernel.servlet.PortletContextListener.contextDestroyed(PortletContextListener.java:45)
13        at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4245)
14        at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4886)
15        at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:936)
16        at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1212)
17        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1382)
18        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
19        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
20        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
21        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
22        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
23        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
24        at java.lang.Thread.run(Thread.java:619)
25Caused by: com.liferay.portal.kernel.exception.SystemException: org.hibernate.cache.CacheException: java.lang.IllegalStateException: The com.liferay.socialnetworking.model.impl.MeetupsEntryImpl Cache is not alive.
26        at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.destroyServiceComponent(ServiceComponentLocalServiceImpl.java:65)
27        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
28        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
29        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
30        at java.lang.reflect.Method.invoke(Method.java:597)
31        at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:112)
32        at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:86)
33        at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
34        at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:59)
35        at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
36        at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:59)
37        at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:108)
38        at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:204)
39        at $Proxy86.destroyServiceComponent(Unknown Source)
40        at com.liferay.portal.service.ServiceComponentLocalServiceUtil.destroyServiceComponent(ServiceComponentLocalServiceUtil.java:262)
41        at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.destroyServiceComponent(PluginPackageHotDeployListener.java:74)
42        at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.doInvokeUndeploy(PluginPackageHotDeployListener.java:148)
43        at com.liferay.portal.deploy.hot.PluginPackageHotDeployListener.invokeUndeploy(PluginPackageHotDeployListener.java:62)
44        ... 17 more
45Caused by: org.hibernate.cache.CacheException: java.lang.IllegalStateException: The com.liferay.socialnetworking.model.impl.MeetupsEntryImpl Cache is not alive.
46        at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.clear(EhcacheTransactionalDataRegion.java:167)
47        at com.liferay.portal.dao.orm.hibernate.region.EntityRegionWrapper.invalidate(EntityRegionWrapper.java:52)
48        at com.liferay.portal.cache.CacheRegistryImpl.clear(CacheRegistryImpl.java:41)
49        at com.liferay.portal.kernel.cache.CacheRegistryUtil.clear(CacheRegistryUtil.java:23)
50        at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.clearCacheRegistry(ServiceComponentLocalServiceImpl.java:274)
51        at com.liferay.portal.service.impl.ServiceComponentLocalServiceImpl.destroyServiceComponent(ServiceComponentLocalServiceImpl.java:62)
52        ... 34 more
53Caused by: java.lang.IllegalStateException: The com.liferay.socialnetworking.model.impl.MeetupsEntryImpl Cache is not alive.
54        at net.sf.ehcache.Cache.checkStatus(Cache.java:2438)
55        at net.sf.ehcache.Cache.removeAll(Cache.java:2202)
56        at net.sf.ehcache.Cache.removeAll(Cache.java:2188)
57        at com.liferay.portal.cache.ehcache.ModifiableEhcacheWrapper.removeAll(ModifiableEhcacheWrapper.java:474)
58        at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.clear(EhcacheTransactionalDataRegion.java:165)
59        ... 39 more
6011:38:35,823 INFO  [PortletHotDeployListener:454] Unregistering portlets for download-portlet
6111:38:35,827 INFO  [PortletHotDeployListener:491] 2 portlets for download-portlet was unregistered



Then try to re-deploy:
  1
  211:42:56,510 INFO  [AutoDeployDir:167] Processing download-portlet.war
  311:42:56,514 INFO  [PortletAutoDeployListener:71] Copying portlets for /u06/liferay/product/liferay-portal-6.1.0/deploy/download-portlet.war
  4  Expanding: /u06/liferay/product/liferay-portal-6.1.0/deploy/download-portlet.war into /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516
  5  Copying 1 file to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516/WEB-INF
  6  Copying 1 file to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516/WEB-INF/classes
  7  Copying 1 file to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516/WEB-INF/classes
  8  Copying 1 file to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516/META-INF
  9  Copying 1 file to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516/WEB-INF/jsp
 10  Copying 155 files to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/webapps/download-portlet
 11  Copying 1 file to /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/webapps/download-portlet
 12  Deleting directory /u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/20111129114256516
 1311:42:57,366 INFO  [PortletAutoDeployListener:81] Portlets for /u06/liferay/product/liferay-portal-6.1.0/deploy/download-portlet.war copied successfully. Deployment will start in a few seconds.
 14Nov 29, 2011 11:43:06 AM org.apache.catalina.startup.HostConfig deployDirectory
 15INFO: Deploying web application directory download-portlet
 16Loading file:/u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/10-download-portlet/WEB-INF/classes/service.properties
 1711:43:06,711 ERROR [PortletApplicationContext:82] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean class [com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor] not found
 18Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/base-spring.xml]
 19Bean ''; nested exception is java.lang.ClassNotFoundException: com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor
 20org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean class [com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor] not found
 21Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/base-spring.xml]
 22Bean ''; nested exception is java.lang.ClassNotFoundException: com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor
 23        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
 24        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
 25        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:291)
 26        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:491)
 27        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:396)
 28        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:365)
 29        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:258)
 30        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:153)
 31        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
 32        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
 33        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
 34        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
 35        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
 36        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
 37        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
 38        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
 39        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
 40        at com.liferay.portal.spring.context.PortletApplicationContext.loadBeanDefinitions(PortletApplicationContext.java:71)
 41        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
 42        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
 43        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
 44        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
 45        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
 46        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
 47        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
 48        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
 49        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
 50        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
 51        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
 52        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
 53        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
 54        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
 55        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
 56        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
 57        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
 58        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
 59        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
 60        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
 61        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
 62        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
 63        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
 64        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
 65        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
 66        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
 67        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
 68        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
 69        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
 70        at java.lang.Thread.run(Thread.java:619)
 71Caused by: java.lang.ClassNotFoundException: com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor
 72        at java.lang.ClassLoader.findClass(ClassLoader.java:359)
 73        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
 74        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
 75        at com.liferay.portal.spring.util.FilterClassLoader.loadClass(FilterClassLoader.java:41)
 76        at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
 77        at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:63)
 78        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.createBeanDefinition(BeanDefinitionParserDelegate.java:616)
 79        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:472)
 80        ... 44 more
 8111:43:06,940 ERROR [PortletApplicationContext:82] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean class [com.liferay.portal.dao.shard.ShardAdvice] not found
 82Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/shard-data-source-spring.xml]
 83Bean 'com.liferay.portal.dao.shard.ShardAdvice'; nested exception is java.lang.ClassNotFoundException: com.liferay.portal.dao.shard.ShardAdvice
 84org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Bean class [com.liferay.portal.dao.shard.ShardAdvice] not found
 85Offending resource: ServletContext resource [/WEB-INF/classes/META-INF/shard-data-source-spring.xml]
 86Bean 'com.liferay.portal.dao.shard.ShardAdvice'; nested exception is java.lang.ClassNotFoundException: com.liferay.portal.dao.shard.ShardAdvice
 87        at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
 88        at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
 89        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:291)
 90        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:491)
 91        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:396)
 92        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:365)
 93        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:258)
 94        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:153)
 95        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
 96        at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
 97        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
 98        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
 99        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
100        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
101        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
102        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
103        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
104        at com.liferay.portal.spring.context.PortletApplicationContext.loadBeanDefinitions(PortletApplicationContext.java:71)
105        at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:93)
106        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
107        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
108        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
109        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
110        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
111        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
112        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
113        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
114        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
115        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
116        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
117        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
118        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
119        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
120        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
121        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
122        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
123        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
124        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
125        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
126        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
127        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
128        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
129        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
130        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
131        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
132        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
133        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
134        at java.lang.Thread.run(Thread.java:619)
135Caused by: java.lang.ClassNotFoundException: com.liferay.portal.dao.shard.ShardAdvice
136        at java.lang.ClassLoader.findClass(ClassLoader.java:359)
137        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
138        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
139        at com.liferay.portal.spring.util.FilterClassLoader.loadClass(FilterClassLoader.java:41)
140        at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
141        at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:63)
142        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.createBeanDefinition(BeanDefinitionParserDelegate.java:616)
143        at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:472)
144        ... 44 more
14511:43:07,367 ERROR [ContextLoader:220] Context initialization failed
146org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferaySessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'portletClassLoader' while setting bean property 'sessionFactoryClassLoader'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
147        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
148        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
149        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
150        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
151        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
152        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
153        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
154        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
155        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
156        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
157        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
158        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
159        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
160        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
161        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
162        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
163        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
164        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
165        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
166        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
167        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
168        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
169        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
170        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
171        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
172        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
173        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
174        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
175        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
176        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
177        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
178        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
179        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
180        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
181        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
182        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
183        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
184        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
185        at java.lang.Thread.run(Thread.java:619)
186Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
187        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
188        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
189        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
190        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
191        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
192        ... 38 more
19311:43:07,370 ERROR [PortalClassLoaderServletContextListener:96] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferaySessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'portletClassLoader' while setting bean property 'sessionFactoryClassLoader'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
194org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liferaySessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'portletClassLoader' while setting bean property 'sessionFactoryClassLoader'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
195        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
196        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
197        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
198        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
199        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
200        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
201        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
202        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
203        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
204        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
205        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
206        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
207        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
208        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
209        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
210        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
211        at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:88)
212        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.doPortalInit(PortalClassLoaderServletContextListener.java:93)
213        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
214        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:61)
215        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:53)
216        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:50)
217        at com.liferay.portal.kernel.servlet.PortalClassLoaderServletContextListener.contextInitialized(PortalClassLoaderServletContextListener.java:52)
218        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
219        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
220        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
221        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
222        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
223        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
224        at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
225        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
226        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1385)
227        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:306)
228        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
229        at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1389)
230        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1653)
231        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1662)
232        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1642)
233        at java.lang.Thread.run(Thread.java:619)
234Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'portletClassLoader' is defined
235        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
236        at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
237        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
238        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
239        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
240        ... 38 more
24111:43:07,373 INFO  [PluginPackageUtil:1101] Reading plugin package for download-portlet
242Loading file:/u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/10-download-portlet/WEB-INF/classes/service.properties
243Loading file:/u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/10-download-portlet/WEB-INF/classes/portlet.properties
24411:43:07,794 INFO  [PortletHotDeployListener:261] Registering portlets for download-portlet
245Loading file:/u06/liferay/product/liferay-portal-6.1.0/tomcat-6.0.33/temp/10-download-portlet/WEB-INF/classes/portlet.properties
24611:43:08,030 INFO  [PortletHotDeployListener:424] 2 portlets for download-portlet are available for use
Brian Ko
RE: BeanLocator has not been set for servlet context
2011年12月6日 上午8:58
答复

Brian Ko

等级: Junior Member

帖子: 70

加入日期: 2010年2月11日

最近的帖子

Hi Richard,

I have a same issue. Have you solved the problem? BTW, are you using default data source or external data source?

Brian Ko
Richard Kosegi
RE: BeanLocator has not been set for servlet context
2011年12月6日 上午9:05
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi Brian,

unfortunately I'm not able to fix it.

I think it can be caused by different versions of liferay, for development I use nightly build from September, but server is running older one.
Related to your next question, yes I'm using default datasource.

Thanks.

Richard.
Brian Ko
RE: BeanLocator has not been set for servlet context
2011年12月6日 上午11:18
答复

Brian Ko

等级: Junior Member

帖子: 70

加入日期: 2010年2月11日

最近的帖子

Hi Richard,

Thank you for the reply. I tried with the proven development studio and it still does not work. I think I missed something. I am going to build again from scratch.

Brian
Brian Ko
RE: BeanLocator has not been set for servlet context
2011年12月9日 上午7:28
答复

Brian Ko

等级: Junior Member

帖子: 70

加入日期: 2010年2月11日

最近的帖子

Hi Jan,

I just found that portlet I created works fine on tomcat, but it fails with "BeanLocator has not been set for servlet context" error on Jboss. I am on Liferay EE sp2. I could not find anything different between 2 systems.

Brian
Naidu Jitta
RE: BeanLocator has not been set for servlet context
2012年3月13日 下午3:05
答复

Naidu Jitta

等级: New Member

帖子: 6

加入日期: 2011年11月29日

最近的帖子

Hi there,

By now you might have found the solution. Just in case it would be helpful for others in the same situation

I had the same problem and I was able to get rid of it by adding the listener to the web.xml

<listener>
<listener-class>com.liferay.portal.kernel.spring.context.PortletContextLoaderListener</listener-class>
</listener>
Brian Ko
RE: BeanLocator has not been set for servlet context
2012年3月13日 下午3:33
答复

Brian Ko

等级: Junior Member

帖子: 70

加入日期: 2010年2月11日

最近的帖子

Hi Naidu,

Thank you. I tried that without success.
I believe sometimes it works and sometimes it does not. I am waiting for 6.1 EE to try again.

Brian
Eugene Bova
RE: BeanLocator has not been set for servlet context
2012年3月27日 上午9:22
答复

Eugene Bova

等级: New Member

帖子: 1

加入日期: 2012年3月27日

最近的帖子

Hi there,

I had same issue. Additionally I observed one other case: web application is works properly after first deploy. But after server restart, BeanLocatorException throws.

It can be reproduced when you incorrect initialize classloader. There are three way how to get instance of classloader. See this article http://liferay-blogging.blogspot.com/2011/03/dynamicquery-api-and-classloaders-in.html

However my application works when classloader is init in this way
1ClassLoader classLoader = (ClassLoader)PortletBeanLocatorUtil.locate(ClpSerializer.SERVLET_CONTEXT_NAME,"portletClassLoader");

And classLoader is not a static field - this is important.

In other cases BeanLocatorException can be throws after application server restart.
Richard Kosegi
RE: BeanLocator has not been set for servlet context
2012年4月3日 上午7:24
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi Eugene,

this sound like valuable info, thank you.
However, I expect this problem is caused by using nightly build of portal and SDK and deploying to little different version.

I will note your info in case I will face similar problem again.

Many thanks.

Richard
David H Nebinger
RE: BeanLocator has not been set for servlet context
2012年4月3日 上午7:59
答复

David H Nebinger

Community Moderator

等级: Liferay Legend

帖子: 11046

加入日期: 2006年9月1日

最近的帖子

You should not be using nightly builds for normal Liferay usage/development. Those are for the actual Liferay developers/contributors. Those builds would never represent a release version of Liferay.

If that's what you're using, it will be no surprise at all when you run into issues...
Richard Kosegi
RE: BeanLocator has not been set for servlet context
2012年4月3日 上午8:02
答复

Richard Kosegi

等级: New Member

帖子: 19

加入日期: 2011年9月5日

最近的帖子

Hi David,

I know, you're correct, but in 6.1 there was lot of features which I want to had in times where I run into issues (current stable release in that time was 6.0)

Richard.
Ali Shahrami
RE: BeanLocator has not been set for servlet context
2012年5月30日 下午2:34
答复

Ali Shahrami

等级: Junior Member

帖子: 52

加入日期: 2009年7月31日

最近的帖子

I have recently faced the very same issue, while trying to upgrade Tomcat, and found out that libraries in lib/ext folder were not loaded. After updating common.loader as below, the problem went away:

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

You can find the common.loader in catalina.properties

Ali
Mahdi Lashkari
RE: BeanLocator has not been set for servlet context
2012年6月11日 上午12:17
答复

Mahdi Lashkari

等级: New Member

帖子: 7

加入日期: 2012年5月2日

最近的帖子

I have also faced this problem when I created an EntityFinder based on custom query. I done everything and service builder built for me an EntityFinderUtil that should be used in EntityLocalServiceUtil. But when I used EntityLocalServiceUtil, the error of BeanLocator has not been set for servlet occurred. The only thing that I done to resolve this problem was adding one bean tag to portlet-spring.xml about EntityFinderUtil .
<bean id="sut.mahdi.portletName.service.persistence.EntityFinderUtil" class="sut.mahdi.portletName.service.persistence.EntityFinderUtil" >
<property name="finder" ref="sut.mahdi.portletName.service.persistence.EntityFinder"></property>
</bean>
hope this help!
Mario Lueder
RE: BeanLocator has not been set for servlet context
2012年6月25日 上午2:22
答复

Mario Lueder

等级: New Member

帖子: 5

加入日期: 2012年6月25日

最近的帖子

Thanks a lot, Mahdi Lashkari solution helped me and solved my problem.

I created also an EntityFinder myself like Mahdi Lashkari did. As long as I am using eclipse to deploy the portlet everything is working fine. But when I am deploying it using the war file, I am receiving the error message "BeanLocator has not been set for servlet"

Best regards
Mario
Aristide Cittadino
RE: BeanLocator has not been set for servlet context
2014年6月20日 上午5:52
答复

Aristide Cittadino

等级: New Member

帖子: 4

加入日期: 2013年10月16日

最近的帖子

I had the same problem , the fix for me was that my project was named :"GD-RPA" but liferay plugin register the servlet context with "GD-RPA-portlet".
The service builder (Maven Task) generates classes registering the servlet context with the same name of the artifact id (in my case GD-RPA).
So liferay was registering at GD-RPA-portlet but my service classes were pointing to GD-RPA.
The fix is to name the artifact id with the "-portlet" suffix,

Hope it helps
Jobin Mathew
RE: BeanLocator has not been set for servlet context
2014年8月19日 下午11:48
答复

Jobin Mathew

等级: Junior Member

帖子: 65

加入日期: 2014年7月4日

最近的帖子

me too had the same issue,
This issue occurs only when we not adding "-portlet" suffix to the project name while we creating a portlet.
no need to change the hibernate.jar and all..
Thanks to Aristide Cittadino emoticon
Dan Overman
RE: BeanLocator has not been set for servlet context
2015年10月7日 上午8:43
答复

Dan Overman

等级: New Member

帖子: 1

加入日期: 2011年7月13日

最近的帖子

I had the same problem. Whenever I tried calling a method from servicebuilder using ..localServiceUtil the same error occured. I tried all ways described in various posts but nothing worked. I even changed the name of portlet with suffix -portlet but it did not work.

Finally I created a new project with suffix as "-portlet". Thereafter everything worked and the Beanlocator error did not appear.

Thanks,
Sushant Agrawal
Felix Gonzalez de Santos
RE: BeanLocator has not been set for servlet context
2015年10月8日 上午7:56
答复

Felix Gonzalez de Santos

等级: New Member

帖子: 3

加入日期: 2011年2月11日

最近的帖子

Sometimes the problem is that the project name has changed. In that case you must re-run maven goal liferay:build-service to generate the correct services names. All the info about context names is defined in the file ClpSerializer.java, exactly in the method getServletContextName().
Ashok Kumar G
RE: BeanLocator has not been set for servlet context
2015年10月26日 上午3:47
答复

Ashok Kumar G

等级: Junior Member

帖子: 29

加入日期: 2011年11月16日

最近的帖子

I did the following to solve the above problem:

1. Set the plugin config property pluginName in pom.xml to the correct context

 1            <plugin>
 2                <groupId>com.liferay.maven.plugins</groupId>
 3                <artifactId>liferay-maven-plugin</artifactId>
 4                <version>${liferay.version}</version>
 5                <configuration>
 6                    <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
 7                    <appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir>
 8                    <liferayVersion>${liferay.version}</liferayVersion>
 9                    <pluginType>portlet</pluginType>
10                    <pluginName>XXXX-portlet</pluginName>
11                </configuration>
12            </plugin>


2. Optionally set the XXXX-portlet-deployment-context property in liferay plugin properties file or portlet.properties file

1XXXX-portlet-deployment-context=XXXX-portlet


3. Re-Build the services
4. Verify if the generated ClpSerializer.java contains the correct contexts

 1    public static String getServletContextName() {
 2        if (Validator.isNotNull(_servletContextName)) {
 3            return _servletContextName;
 4        }
 5
 6        synchronized (ClpSerializer.class) {
 7            if (Validator.isNotNull(_servletContextName)) {
 8                return _servletContextName;
 9            }
10
11            try {
12                ClassLoader classLoader = ClpSerializer.class.getClassLoader();
13
14                Class<?> portletPropsClass = classLoader.loadClass(
15                        "com.liferay.util.portlet.PortletProps");
16
17                Method getMethod = portletPropsClass.getMethod("get",
18                        new Class<?>[] { String.class });
19
20                String portletPropsServletContextName = (String) getMethod.invoke(null,
21                        "XXXX-portlet-deployment-context");
22
23                if (Validator.isNotNull(portletPropsServletContextName)) {
24                    _servletContextName = portletPropsServletContextName;
25                }
26            } catch (Throwable t) {
27                if (_log.isInfoEnabled()) {
28                    _log.info(
29                        "Unable to locate deployment context from portlet properties");
30                }
31            }
32
33            if (Validator.isNull(_servletContextName)) {
34                try {
35                    String propsUtilServletContextName = PropsUtil.get(
36                            "XXXX-portlet-deployment-context");
37
38                    if (Validator.isNotNull(propsUtilServletContextName)) {
39                        _servletContextName = propsUtilServletContextName;
40                    }
41                } catch (Throwable t) {
42                    if (_log.isInfoEnabled()) {
43                        _log.info(
44                            "Unable to locate deployment context from portal properties");
45                    }
46                }
47            }
48
49            if (Validator.isNull(_servletContextName)) {
50                _servletContextName = "upay-portlet";
51            }
52
53            return _servletContextName;
54        }
55    }


5. Deploy the war, verify the war name and the logs for the correct context name.
Florian Limpöck
RE: BeanLocator has not been set for servlet context
2016年1月19日 上午4:37
答复

Florian Limpöck

等级: New Member

帖子: 1

加入日期: 2016年1月19日

最近的帖子

I tryed anything written, but nothing worked for me, until i added the project's version

to maven-pluginname in pom:


 1             <configuration>
 2                <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
 3                <appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
 4                <appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir>
 5                <appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir>
 6                <liferayVersion>${liferay.version}</liferayVersion>
 7                <pluginType>portlet</pluginType>
 8                <pluginName>${project.artifactId}-${project.version}</pluginName>
 9            </configuration>

and in liferay-plugin-package.properties:

1 artifactId-version-deployment-context=artifactId-version

for example:

1portlet-sample-1.0-deployment-context=portlet-sample-1.0

where artifactId = portlet-sample

and version = 1.0

After all I i built services, and redeployed my war.

I came to the solution because I debugged:

com.liferay.portal.kernel.bean.PortletBeanLocatorUtil

where

BeanLocator beanLocator = getBeanLocator(servletContextName);
is called which always returned null without versionnumber...

I hope someone helps this.
Chí Văn Ngô
RE: BeanLocator has not been set for servlet context
2016年3月26日 下午12:06
答复

Chí Văn Ngô

等级: New Member

帖子: 2

加入日期: 2011年7月11日

最近的帖子

You have to remove the duplication jar which created by this project. This error appears when I rename my project (for examples: prj-portlet to prjA-portlet, I need to remove prj-portlet-service.jar now)
Shahbaz Khan
RE: BeanLocator has not been set for servlet context
2016年3月27日 上午6:44
答复

Shahbaz Khan

等级: Junior Member

帖子: 68

加入日期: 2012年10月13日

最近的帖子

Undeploy the portlet from the portal and then run clean, build service and then deploy the portlet.