Bruce,
Regardless of the useless thread sleep, this code is working without call to
the start() method :). I have run this sample many times and have managed
to send messages successfully.
I can export you my Eclipse project so you can check yourself if you like
:).
The previous sample was stripped down from more complex example.
Regards
bsnyder wrote:
>
> On 6/14/07, frofake <[EMAIL PROTECTED]> wrote:
>>
>> I created more complex example which kept throwing exceptions and I
>> stripped
>> down to this example for easier overview.
>>
>> version: servicemix-3.1-incubating
>> manual start of ActiveMq server, version: activemq-4.1.0
>>
>> code:
>> ------------------------------------------------------------------------------------
>> public static void main(String[] args) {
>> JBIContainer jbiContainer = null;
>> try {
>> ApplicationContext context = new
>> ClassPathXmlApplicationContext("jmsFlow-configuration2.xml");
>> Thread.sleep(Long.MAX_VALUE);
>>
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>> finally {
>> try {
>> jbiContainer.stop();
>> } catch (JBIException e) {
>> e.printStackTrace();
>> }
>> // System.exit(0);
>> }
>> }
>> ------------------------------------------------------------------------------------
>>
>> contents of the configuration file: jmsFlow-configuration2.xml
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans xmlns="http://xbean.org/schemas/spring/1.0"
>> xmlns:sm="http://servicemix.apache.org/config/1.0"
>> xmlns:mycompany="http://www.mycompany.com"
>> xmlns:jms="http://servicemix.apache.org/jms/1.0"
>> xmlns:amqra="http://activemq.org/ra/1.0"
>> xmlns:eip="http://servicemix.apache.org/eip/1.0"
>> xmlns:saxon="http://servicemix.apache.org/saxon/1.0">
>>
>> <!-- the JBI container -->
>> <sm:container id="jbi" rootDir="./work/data/smx"
>> useMBeanServer="true"
>> createMBeanServer="false"
>> flowName="jms?jmsURL=tcp://localhost:44444">
>>
>> <sm:activationSpecs>
>>
>> <sm:activationSpec componentName="trace"
>> service="mycompany:trace">
>> <sm:component>
>> <bean
>>
>> class="org.apache.servicemix.components.util.TraceComponent"/>
>> </sm:component>
>> </sm:activationSpec>
>> </sm:activationSpecs>
>> </sm:container>
>>
>> <bean id="jmsFactory"
>> class="org.apache.activemq.pool.PooledConnectionFactory">
>> <property name="connectionFactory">
>> <bean
>> class="org.apache.activemq.ActiveMQConnectionFactory">
>> <property name="brokerURL"
>> value="tcp://localhost:44444"/>
>> </bean>
>> </property>
>> </bean>
>> </beans>
>>
>> ------------------------------------------------------------------------------------
>> Exception content:
>>
>> org.springframework.beans.factory.BeanCreationException: Error creating
>> bean
>> with name 'jbi' defined in class path resource
>> [jmsFlow-configuration.xml]:
>> Invocation of init method failed; nested exception is
>> java.lang.IllegalArgumentException: RegistryContext: object to bind must
>> be
>> Remote, Reference, or Referenceable
>> Caused by: java.lang.IllegalArgumentException: RegistryContext: object to
>> bind must be Remote, Reference, or Referenceable
>> at com.sun.jndi.rmi.registry.RegistryContext.encodeObject(Unknown
>> Source)
>> at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
>> at com.sun.jndi.rmi.registry.RegistryContext.bind(Unknown Source)
>> at javax.naming.InitialContext.bind(Unknown Source)
>> at
>> org.apache.servicemix.jbi.framework.ClientFactory.start(ClientFactory.java:84)
>> at
>> org.apache.servicemix.jbi.container.JBIContainer.start(JBIContainer.java:597)
>>
>> with further down the line:
>>
>> at
>> org.apache.servicemix.jbi.container.SpringJBIContainer.afterPropertiesSet(SpringJBIContainer.java:79)
>> at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1057)
>> at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1024)
>> at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:421)
>> at
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
>> at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)
>> at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
>> at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
>> at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
>> at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
>> at
>> org.apache.xbean.spring.context.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:161)
>> at
>> org.apache.xbean.spring.context.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:51)
>>
>> ------------------------------------------------------------------------------------
>>
>> Any tips appreciated, thank you.
>
> Well if this is really your code, the JBI container is never
> instantiated and never started so the code will certainly fail, but
> not with the exception that you've provided above. And why is that
> call to Thread.sleep() in there? I'm guessing that you must have
> pasted the wrong code.
>
> Bruce
> --
> perl -e 'print
> unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
>
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
>
>
--
View this message in context:
http://www.nabble.com/Exception-when-starting-embedded-SM-tf3921552s12049.html#a11137335
Sent from the ServiceMix - User mailing list archive at Nabble.com.