activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uma...@comcast.net
Subject Re: Problems with VM transport
Date Tue, 27 Mar 2007 03:24:20 GMT

Hi -

   I am using the embedded broker in a servlet container. Each webapp in the servlet
container instantiates a connection factory that refers to broker URL of 

            vm://localhost?broker.persistent=false

as follows:

        (Servlet Container
                 (WebApp1
                       ConnectionFactory -> vm://localhost?broker.persistent=false
                 )
        )

and this works fine. But as soon as I instantiate another webapp (WebApp2) that
also uses embedded broker as follows:

        (Servlet Container
                 (WebApp1
                       ConnectionFactory -> vm://localhost?broker.persistent=false
                 )
                 (WebApp2
                       ConnectionFactory -> vm://localhost?broker.persistent=false
                 )
        )

the second webapp fails with the JMSException given below:

   javax.jms.JMSException: Could not create Transport. Reason: javax.management.InstanceAlreadyExistsException:
org.apache.activemq:BrokerName=localhost,Type=Broker
        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:33)
        at org.apache.activemq.ActiveMQConnectionFactory.createTransport(ActiveMQConnectionFactory.java:229)
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:242)
        at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:211)
        at org.apache.activemq.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:158)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.createConnection(AbstractMessageListenerContainer.java:989)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.refreshSharedConnection(AbstractMessageListenerContainer.java:455)
        //...


I thought I could (tentatively) work around this problem by disabling Jmx, so I switched the
broker URL (for both webapps) to

          vm://localhost?broker.persistent=false&useJmx=false

This did not help.  Is there fundamentally a problem with multiple
instances of ActiveMQConnectionFactory referring to the same broker URL
(which is likely to to be the case when using embedded broker)?

Thanks,

/U


 -------------- Original message ----------------------
From: Adrian Co <aco@exist.com>
> uma_rk@comcast.net wrote:
> > Adrian,
> >
> > Thanks for the note. 
> >
> >       > >    Startup:   vm://localhost
> >       > >    During runtime (after an event): 
> >       > >            failover(vm://localhost,tcp://remote:61616)
> >       > >
> >       > >   Would modifying the broker URL of the connection factory cause

> problems?
> >        > >   
> >         > Personally, I'm not sure if you can I haven't tried it, but I don't

> >         > think it makes sense to make a vm transport failover. The assumption

> is 
> >         > that you have a broker running in the same vm as your jms client. If

> the 
> >         > broker crashes, it means your client *should* have crashed also and

> it 
> >         > can't failover over to a remote broker anymore.
> >
> > Makes sense - now I see why someone else referred to me as 'retard' :-).
> >  I need to have the client listen to two different brokers (the embedded
> > and the external) at the same time (so that the client receives messages 
> published
> > by both the brokers and the messages published by the client are sent to both 
> the
> > brokers).  Is this the correct URI to network the embedded broker with an 
> external broker?
> >
> >             static:(vm://localhost,tcp://remotehost:61616)
> >   
> Hum. AFAIK,  static just tells the client to choose one url to connect 
> to. I don't think you can listen to two or more brokers using a single 
> connection. You might want to network the brokers together if thats 
> possible. If someone can let me know if its possible to listen to more 
> than two brokers using a single jms connection, I'd appreciate it also. :-)
> >
> > Could you also clarify an additional question? If I instantiate multiple
> > connection factories in the same VM pointing to the embedded broker
> > would all the cconnection factories in the VM share the same broker
> > (as opposed to attempting to "instantiating a new embedded broker" if 
> > such a thing were possible)?
> >   
> If they are in the same jvm, and there's already an embedded broker, it 
> will be reused.
> > Thanks again,
> >
> > /U
> >
> >  
> 


Mime
View raw message