<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd">
<context:annotation-config />
<context:component-scan base-package="com.hippocommunity.components" />
<context:component-scan base-package="com.hippocommunity.services" />
</beans>package com.hippocommunity.errorhandlers;
// SNIP
public class MyPageErrorHandler implements PageErrorHandler {
@Autowired private LinkCreatorService linkCreatorService;
// SNIP}
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">
<bean id="org.hippoecm.hst.core.container.PageErrorHandler" class="com.hippocommunity.errorhandlers.MyPageErrorHandler" />
</beans>
28.03.2017 11:30:43 WARN localhost-startStop-1 [AbstractBeanFactory.getTypeForFactoryBean:1485] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hippoecm.hst.pagecomposer.jaxrs.security.SecurityModel#SecurityModelEventListener' defined in class path resource [org/hippoecm/hst/pagecomposer/SpringComponentManager-pagecomposer.xml]: Cannot resolve reference to bean 'jcrObservationEventListenerItems' while setting bean property 'targetObject'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'jcrObservationEventListenerItems': org.springframework.beans.factory.FactoryBeanNotInitializedException: FactoryBean is not fully initialized yet
Same issues happen when we add some custom jax-rs plain restservices and use @Autowired there.Kind regards,Dennis
--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
27.03.2017 16:15:45 WARN localhost-startStop-1 [AbstractBeanFactory.getTypeForFactoryBean:1485] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#1' defined in class path resource [org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-plain-pipeline.xml]: Cannot create inner bean 'org.hippoecm.hst.core.container.HstSitePipeline#88be024' of type [org.hippoecm.hst.core.container.HstSitePipeline] while setting bean property 'arguments' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hippoecm.hst.core.container.HstSitePipeline#88be024' defined in class path resource [org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-plain-pipeline.xml]: Cannot resolve reference to bean 'jaxrsRestPlainServiceValve' while setting bean property 'processingValves' with key [4]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxrsRestPlainServiceValve' defined in class path resource [org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-plain-pipeline.xml]: Cannot create inner bean 'org.hippoecm.hst.jaxrs.cxf.CXFJaxrsService#60342df6' of type [org.hippoecm.hst.jaxrs.cxf.CXFJaxrsService] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hippoecm.hst.jaxrs.cxf.CXFJaxrsService#60342df6' defined in class path resource [org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-plain-pipeline.xml]: Cannot create inner bean 'org.apache.cxf.jaxrs.JAXRSServerFactoryBean#704c3cea' of type [org.apache.cxf.jaxrs.JAXRSServerFactoryBean] while setting bean property 'jaxrsServerFactoryBean'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.cxf.jaxrs.JAXRSServerFactoryBean#704c3cea' defined in class path resource [org/hippoecm/hst/site/optional/jaxrs/SpringComponentManager-rest-plain-pipeline.xml]: Cannot resolve reference to bean 'jaxrsRestPlainResourceProviders' while setting bean property 'resourceProviders'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'jaxrsRestPlainResourceProviders': org.springframework.beans.factory.FactoryBeanNotInitializedException: FactoryBean is not fully initialized yet
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
Hello Woonsan,This setup seems to be almost identical. What you are missing when trying to reproduce my problem is: You doesn't seem to have added a custom PageErrorHandler or custom jaxrs resource.Could you maybe add a custom PageErrorHandler that autowires the FooService aswell, and see if you get any warnings. If not, there might indeed be something wrong at my project. :)
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
29.03.2017 08:55:53 WARN localhost-startStop-1 [AbstractBeanFactory.getTypeForFactoryBean:1485] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hippoecm.hst.pagecomposer.jaxrs.security.SecurityModel#SecurityModelEventListener' defined in class path resource [org/hippoecm/hst/pagecomposer/SpringComponentManager-pagecomposer.xml]: Cannot resolve reference to bean 'jcrObservationEventListenerItems' while setting bean property 'targetObject'; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'jcrObservationEventListenerItems': org.springframework.beans.factory.FactoryBeanNotInitializedException: FactoryBean is not fully initialized yet
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
29.03.2017 21:54:41 WARN localhost-startStop-1 [AbstractBeanFactory.getTypeForFactoryBean:1485] Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#3' defined in file [C:\Users\dennisn\Documents\Git\Hippo\myhippoproject\target\tomcat8x\webapps\site\WEB-INF\classes\META-INF\hst-assembly\overrides\custom-jaxrs-resources.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Either 'targetClass' or 'targetObject' is required
Hi Dennis,
Thank you very much for sharing the github project! It was really helpful!I was able to see the same warning locally, too. It is indeed a very interesting problem case.But the good news is, the warning message seems almost harmless to me! :-) So, you can ignore the warning in this context.Here's my explanation.- When an applicationContext is initialized, if auto-wiring is used, then for each @Autowired field/property, the AutowiredAnnotationBeanPostProcessor tries to find a *type-matched bean* from the beanFactory.- In your project, actually the warning occurred while it tries to find a bean of type FooService (a *type-matched bean* by FooService type in this case) for MyPageErrorHandler bean. I found this by attaching debugger at AbstractBeanFactory.getTypeForFactoryBean:1485 literally and looking at the stack trace.- The way how it determines the best *type-matched bean* is, (1) iterate each bean definition from all the beans registered in the beanFactory, (2) if a bean definition is not a factoryBean, it checks the type directly and put in into a bag or ignore, or if it is a factoryBean, it needs to create a bean from the factoryBean to find out the type exactly, or return null with that kind of warning if the factory cannot create object yet for some reason, c) from the all the candidate beans collected by the type, it finally determines which to take for the @Autowired field/property.- In your project, during the scanning/determination process, it left some warnings on some of factory beans due to not being ready to create object at the moment, but it found out the proper FooService bean in the end and assign in to the MyPageErrorHandler bean. I confirmed this by expressions in debug session:-- org.hippoecm.hst.site.HstServices.getComponentManager().getComponent("org.hippoecm.hst.core.container.PageErrorHandler")-- org.hippoecm.hst.site.HstServices.getComponentManager().getComponent("jcrObservationEventListenerItems ")- Luckily in this case, the *ignored* (with warning) bean definitions were simply the factory beans to create a java.util.List objects such as 'jcrObservationEventListenerItems'.Therefore, you can ignore this kind of warning logs if the warning logs are concerning about only factory bean definitions which are out of interest in terms of auto-wiring in your project.Regards,Woonsan
Thank you for researching this Woonsan, although the conclusion is we can ignore the warnings, isn't it better to prevent them from happening?I've seen the same warning happening when adding the urlrewriter plugin. With that particular case I had the urlrewriting-context.xml in my project and was able to add depends-on="jcrObservationEventListenerItems" to the MethodInvokingFactoryBean, This made the warnings disappear.
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.
On Wed, Mar 29, 2017 at 4:03 PM, 'dennis.nijssen' via Hippo Community <hippo-community@googlegroups.com> wrote:Thank you for researching this Woonsan, although the conclusion is we can ignore the warnings, isn't it better to prevent them from happening?I've seen the same warning happening when adding the urlrewriter plugin. With that particular case I had the urlrewriting-context.xml in my project and was able to add depends-on="jcrObservationEventListenerItems" to the MethodInvokingFactoryBean, This made the warnings disappear."depends-on" seems to make it more difficult to maintain the software.So I have another solution:- AbstractBeanFactory has a special routine for factory bean: #getTypeForFactoryBean(String, RootBeanDefinition).- That routine invokes FactoryBean#getObjectType(). So in most cases, it doesn't require the factory bean to create an object only for type checking.- However, unfortunately, MethodInvokingFactoryBean#getObjectType() was implemented to try to create an object because it is unaware of the type unlike somethings like ListFactoryBean or MapFactoryBean that can safely infer the type is either java.util.List or java.util.Map.
--
71 Summer Street, 2nd Floor, Boston, MA 02110Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
Hello Woonsan,
Thank you for describing everything so clearly. I completely understand the depends-on is just a quick hack, and eventually will make the product much harder to maintain. So I believe your solution is better in terms of maintainability.Do you have any idea of a timeline maybe when this could be resolved? I understand it won't be released tomorrow or next week :) But can we expect it in Hippo 11.2.1 or Hippo 12 or is it even further away?Thanks again for all the time and effort you put into researching this issue.
To post to this group, send email to hippo-community@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.