activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Nicholson <robert.nichol...@gmail.com>
Subject Re: Use of jndi.properties with activemq?
Date Mon, 14 Sep 2009 23:54:11 GMT
Why would I get this ClassCastException then? I do have a  
jndi.properties in a JNDI.jar that's in my classpath and here's it's  
contents

# use the following property to configure the default connector
#java.naming.provider.url = tcp://localhost:61616
java.naming.provider.url = vm://localhost
#connectionFactoryNames=ConnectionFactory

# register some queues in JNDI using the form
# queue.[jndiName] = [physicalName]
queue.QREQ = QUEUE_NAME

When I took at look at the source to  
jndi.ActiveMQInitialContextFactory I didn't see any support for  
jndi.properties so is this something that's support to  
InitialContextFactory?

The classcastexception happens in the following code

Object obj = context.lookup(getQueueConnectionFactory());
             if (!(obj instanceof QueueConnectionFactory)) {
                 String msg = "QueueConnectionFactory expected, but  
got "
                     + obj == null ? "null" :  obj.getClass().getName();
                 LOGGER.fatalError(msg);
                 throw new IllegalStateException(msg);
             }
             QueueConnectionFactory factory = (QueueConnectionFactory)  
obj;
             Queue queue = (Queue) context.lookup(getSendQueue());

The ContextFactory lookup goes ok but for some reason the queue lookup  
returns an ReadOnlyContext
and not a Queue.

On Sep 14, 2009, at 8:36 AM, Rob Davies wrote:

>
> On 14 Sep 2009, at 14:27, Robert Nicholson wrote:
>
>> When using org.apache.activemq.jndi.ActiveMQInitialContextFactory  
>> will it ever look for a local jndi.properties file?
>>
>> I'm trying to get JMeter working with the JMSSampler and I keep  
>> getting a classcastexception when it does the lookup
>>
>>>>> 2009/09/13 21:35:43 ERROR - jmeter.threads.JMeterThread: Test  
>>>>> failed!
>>>>> java.lang.ClassCastException:  
>>>>> org.apache.activemq.jndi.ReadOnlyContext
>>>>> cannot be cast to javax.jms.Queue
>>
>>
>>
>>
>>
>
>
> Yes - if it can find it on its classpath - see http://activemq.apache.org/jndi-support.html
>
> cheers,
>
> Rob
>
> Rob Davies
> http://twitter.com/rajdavies
> I work here: http://fusesource.com
> My Blog: http://rajdavies.blogspot.com/
> I'm writing this: http://www.manning.com/snyder/
>
>
>
>
>


Mime
View raw message