Dnia Tue, 18 Oct 2005 17:49:01 +0200, Anders Eriksson napisaƂ(a):

> Resource res = new ClassPathResource("demo_adapter_config.xml");
> XmlBeanFactory factory = new XmlBeanFactory(res);
> factory.getBean("gatewayServerPool");
> //factory.getBean("inboundConnectorA"); //I also tried to bootstrap the
> related connector, with same problem

> [java] org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'gatewayServerPool' defined in class path resource
> [demo_adapter_config.xml]: Initialization of bean failed; nested exception
> is java.lang.IllegalArgumentException: applicationContext should have been
> set by Spring
> [java] java.lang.IllegalArgumentException: applicationContext should have
> been set by Spring

> But what am I doing wrong in the first place? I believe I am initializing my
> message consuming code incorrectly... is there some sort of "formal start"
> method of the container or the connector? Or perhaps some other explicit
> Spring config is needed?

It's in fact Spring issue. Jencks' JCAContainer implements 
ApplicationContextAware and you are using "just" BeanFactory. As it's not 
running inside any ApplicationContext, the behaviour is correct. To have all 
non lazy singleton beans set up and wired at start up you need to use for 
example ClassPathXmlApplicationContext.

Regards,
Bartek

Reply via email to