activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: active mq configuration for Tomcat 5.5
Date Mon, 22 Jan 2007 17:26:47 GMT
Sounds like a classpath issue - you've probably got a few different
ActiveMQ jars on the classpath.

On 1/19/07, Suchitha Koneru (sukoneru) <sukoneru@cisco.com> wrote:
> Thank  you so much for the help.
> I am looking up the correct name because in the resource link of
> context.xml I have
> Connection Factory mapped to global resource
> "jms/TopicConnectionFactory". This global resource is mentioned in
> Server.xml.
>
>
>  <ResourceLink name="ConnectionFactory"
> > global="jms/TopicConnectionFactory" type=
> > "org.apache.activemq.ActiveMQConnectionFactory" />
>
> The object at run time is
> Of the type
> org.apache.activemq.ActiveMQConnectionFactory.
>
> Using JNDI , I am able to look up the connection factory and the topic.
>
> The problem is  with the type of object being returned, even though it
> is of type
>
> org.apache.activemq.ActiveMQConnectionFactory , I cannot cast it to the
> same type i.e. org.apache.activemq.ActiveMQConnectionFactory
>
> This problem appears to be very tricky.
>
>
> -----Original Message-----
> From: James Strachan [mailto:james.strachan@gmail.com]
> Sent: Friday, January 19, 2007 1:10 AM
> To: activemq-users@geronimo.apache.org
> Subject: Re: active mq configuration for Tomcat 5.5
>
> It looks like you are looking up the wrong name, shouldn't it be
> "jms/TopicConnectionFactory"?
> Also try actually printing out what the object is that you've found.
>
> Given the problems you're having using JNDI, it might be worth just
> replacing all the JNDI crap with just one line...
>
> ConnectionFactory factory = new ActiveMQConnection()
>
> :)
>
> On 1/19/07, Suchitha Koneru (sukoneru) <sukoneru@cisco.com> wrote:
> > Hello active mq users ,
> >                 I  have the following configuration on my system
> > tomcat 5.5 java 1.5.09
> >
> > In server.xml , I placed the JNDI resources as follows
> > <GlobalNamingResources>
> >
> > <Resource name="jms/TopicConnectionFactory"
> >
> > auth="Container"
> >
> > type="org.apache.activemq.ActiveMQConnectionFactory"
> >
> > description="JMS Connection Factory"
> >
> > factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> >
> > brokerURL="tcp://localhost:61716"
> >
> > brokerName="LocalActiveMQBroker"/>
> >
> > <Resource name="jms/Topic"
> >
> > auth="Container"
> >
> > type="org.apache.activemq.command.ActiveMQTopic"
> >
> > description="sample Topic"
> >
> > factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> >
> > physicalName="FOO.BAR"/>
> >
> > </GlobalNamingResources>
> >
> > I have a web app called UI , I am trying to access these  global jndi
> > recources from this web app, Hence the context.xml for this web app
> > has the following <Context reloadable="true">
> >
> > <ResourceLink name="ConnectionFactory"
> > global="jms/TopicConnectionFactory" type=
> > "org.apache.activemq.ActiveMQConnectionFactory" />
> >
> > <ResourceLink name="PNMTopic" global="jms/Topic" type=
> > "org.apache.activemq.command.ActiveMQTopic" />
> >
> > </Context>
> >
> > The subsciber class in  the UI context is as follows
> >
> > public class PNMSubscriber {
> >
> > TopicConnection tConn ;
> >
> > TopicConnectionFactory tFactory ;
> >
> > Topic pnmTopic;
> >
> > ActiveMQTopicSession pnmSession ;
> >
> > public PNMSubscriber(){
> >
> > try{
> >
> > InitialContext initialContext = new InitialContext();
> >
> > Context envContext = (Context) initialContext.lookup("java:comp/env");
> >
> > tFactory =
> > (TopicConnectionFactory)envContext.lookup("ConnectionFactory");
> >
> > tConn = tFactory.createTopicConnection();
> >
> > pnmSession = (ActiveMQTopicSession) tConn.createTopicSession(true,
> > Session.AUTO_ACKNOWLEDGE);
> >
> > pnmTopic = (Topic)envContext.lookup("PNMTopic");
> >
> > pnmSubscriber = pnmSession.createSubscriber(pnmTopic);
> >
> > }catch(Exception e){
> >
> > e.printStackTrace();
> >
> > }
> >
> > }
> >
> > I get a class cast exception as follows
> >
> > java.lang.ClassCastException:
> > org.apache.activemq.ActiveMQConnectionFactory
> >         at
> > com.cpnm.common.messaging.PNMSubscriber.<init>(PNMSubscriber.java:40)
> >
> > The exception is raised , at the following line , in the code
> >
> > tFactory =
> > (TopicConnectionFactory)envContext.lookup("ConnectionFactory");
> >
> > I tried casting the object to "ActiveMQConnectionFactory" , I still
> > get the same exception.
> >
> > I think, iam missing something in the configuration, please let me
> > know, if I need to add anything else.
> >
> > Please help me out !!
> >
> > thank you,
> >
> > Suchitha.
> >
> >
> >
> >
> >
> >
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>


-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message