You should try to use a spring application context instead of using
directly a bean factory.  This may work better.

Cheers,
Guillaume Nodet


Anders Eriksson wrote:

Hi, I am evaluating Jencks 1.1, ActiveMQ 3.1 and Spring 1.2.5 (also tried 1.2.3) and I am configuring a JMS consumer pool with those tools. Essential Jencks config look like this:

...
    <bean id="gatewayServerPool" class="org.jencks.JCAContainer">
<!-- lets use the default configuration of work manager and transaction manager-->
      <property name="bootstrapContext">
        <bean class="org.jencks.factory.BootstrapContextFactoryBean">
          <property name="threadPoolSize" value="5"/>
        </bean>
      </property>
<!-- the JCA Resource Adapter -->
      <property name="resourceAdapter">
<bean id="activeMQResourceAdapter" class="org.activemq.ra.ActiveMQResourceAdapter"> <property name="serverUrl" value="tcp://localhost:61616"/ <tcp://localhost:61616%22/>>
        </bean>
      </property>
    </bean>
...

I start the consumption code by doing

        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

hoping to kick start the container... The problem is that the JCAContainer complains that Spring doesnt set the applicationContext!

[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 [java] at org.jencks.JCAContainer.afterPropertiesSet(JCAContainer.java:70) [java] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1058)


I looked at the source http://cvs.jencks.codehaus.org/jencks/src/main/java/org/jencks/JCAContainer.java?rev=1.2&view=markup <http://cvs.jencks.codehaus.org/jencks/src/main/java/org/jencks/JCAContainer.java?rev=1.2&view=markup> and found a work around by adding

      <property name="lazyLoad" value="true"/>

to the JCAContainer config and then it seems to work!

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?

Thanks,
--
/Anders


Reply via email to