Foren

BeanLocator is null and is not set Exception, on converting 5.2.3 Ext...

gianluca maranzana, geändert vor 13 Jahren.

BeanLocator is null and is not set Exception, on converting 5.2.3 Ext...

Junior Member Beiträge: 26 Beitrittsdatum: 30.07.08 Neueste Beiträge
I'm facing a problem similar to this thread : https://www.liferay.com/en/community/forums/-/message_boards/message/6757266

and read a Jira that look similar too:

LPS-12221 BeanLocator has not been set reappears in 6.0.5 http://issues.liferay.com/browse/LPS-12221 ....

I've just fiew services that are correctly working by the tunnel-web (I say this 'cause portlets and jsps works and call services, EXcept for ones those need bean injection!), but my ext-spring.xml (that will be loaded, following portal.properties, just for last one but with all others pring configs..) falls in a "BeanLocator has not been set".

NB. I've used the conversion ant script for old 5.2.3 ext to the 6.0.5 plugin, correctly deployed (just 'till when I've wrote the ext-spring.xml..).

Anyone can tell me if is this problem faced and resolved?

Where I need to focus on for solve?

...or there is any GOOD tutorial to convert old services/bean injection to new servicebuilder for lf6?

Sorry, maybe looks stupid... but I don't understand well how to write a hook plugin with LF IDE servicebuilder....


G.

15:01:59,951 ERROR [PortalBeanLocatorUtil:39] BeanLocator is null
com.liferay.portal.kernel.bean.BeanLocatorException: java.lang.NullPointerExcept
ion
        at com.liferay.portal.bean.BeanLocatorImpl.locate(BeanLocatorImpl.java:5
9)
        at com.liferay.portal.kernel.bean.PortalBeanLocatorUtil.locate(PortalBea
nLocatorUtil.java:83)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:98)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor.postProcessBeforeInitialization(BeanReferenceAnnotationBeanPostProcesso
r.java:49)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanF
actory.java:394)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1405)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:190)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:95)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:117)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor.postProcessBeforeInitialization(BeanReferenceAnnotationBeanPostProcesso
r.java:49)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanF
actory.java:394)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1405)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:190)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:95)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:117)
        at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostP
rocessor.postProcessBeforeInitialization(BeanReferenceAnnotationBeanPostProcesso
r.java:49)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanF
actory.java:394)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1405)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:575)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:425)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<i nit>(ClassPathXmlApplicationContext.java:139)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<i nit>(ClassPathXmlApplicationContext.java:93)
        at com.liferay.portal.spring.context.ArrayApplicationContext.<init>(Arra
yApplicationContext.java:31)
        at com.liferay.portal.spring.util.SpringUtil.loadContext(SpringUtil.java
:54)
        at com.liferay.portal.spring.context.PortalContextLoaderListener.context
Initialized(PortalContextLoaderListener.java:66)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContex
t.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
467)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
1)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)

        at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.ja
va:637)
        at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.j
ava:563)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498
)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)

        at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)

        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
)
        at org.apache.catalina.core.StandardService.start(StandardService.java:5
19)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710
)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NullPointerException
        at com.liferay.portal.bean.BeanLocatorImpl.doLocate(BeanLocatorImpl.java
:105)
        at com.liferay.portal.bean.BeanLocatorImpl.locate(BeanLocatorImpl.java:5
6)
        ... 65 more</init></i></i>


PS. please, note the final "Caused by: java.lang.NullPointerException"... is caused by BeanLocatorImpl.class 'couse _applicationContext is null, so can't return _applicationContext.getBean(name) (where name is my bean id...).