activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ttmdev <joe.fernan...@ttmsolutions.com>
Subject Re: embedded broker exceptions
Date Thu, 26 Jul 2007 03:23:36 GMT

Hi Suchitha,

Not sure what the problem might be; however, you may want to try a different
approach and leverage amq's JNDIReferenceFactory. This is a small tutorial
showing how to use it w/in a Tomcat, AMQ 4.0.1 and Java 6 configuration.

http://fabien.carrion.free.fr/tomcat/jndi-jms-examples-howto.xml

Looks like this approach may also lead to some cleaner code because you can
dispense with having to set up the properties within your java code. 

Hope this helps.  

Regards,
Joe 



Suchitha Koneru (sukoneru) wrote:
> 
> Hello Users, 
>               Iam trying to use an embedded broker . The  active mq
> version  is 4.1.1(release version) . As per the documentation ,
> org.apache.activemq.ActiveMQConnectionFactory implements
> javax.jms.TopicConnectionFactory.  I get a run time exception in this
> regard . The exception is as follows 
>  
> java.lang.IncompatibleClassChangeError: Class
> org.apache.activemq.ActiveMQConnectionFactory does not implement the
> requested  interface javax.jms.TopicConnectionFactory
>  
> The complete exception statck trace  and activemq.xml is attached.
>  
> The Tomcat version is 5.5.20 and Java is 1.6. 
>  
> The code for starting the broker is 
> String Prov_URL =
> "vm://localhost?brokerConfig=xbean:file:./../../activemq.xml" ;
> 
> connectionProperties.put(Context.PROVIDER_URL, Prov_URL);
> 
> connectionProperties.put(Context.INITIAL_CONTEXT_FACTORY,
> MessagingConstants.ACTIVEMQ_FACTORY);
> 
> conContext = new InitialContext(connectionProperties);
> 
> TopicConnectionFactory Herbiefactory = null;
> 
> javax.jms.TopicConnection HerbieTopic=null ;
> 
> // lookup the connection factory
> 
> Herbiefactory =(ActiveMQConnectionFactory)
> conContext.lookup("ConnectionFactory");  //exception is caused at this
> line .
> 
> // create a new TopicConnection for subscribing and receiving events
> 
> HerbieTopic = Herbiefactory.createTopicConnection();
> 
> All the needed jars are placed in common/lib of Tomcat.
> 
> Please let me know, if Iam missing something
> 
> thank you,
> 
> Suchitha.
> 
>  
> 
>  
> 
> 
> 2007-07-25 17:54:58,586 [main] ERROR [localhost].[/servlets] - Exception
> sending context initialized event to listener instance of class
> com.cisco.cpnm.server.context.ApplicationInitListener
> java.lang.IncompatibleClassChangeError: Class
> org.apache.activemq.ActiveMQConnectionFactory does not implement the
> requested interface javax.jms.TopicConnectionFactory
> 	at com.messaging.jms.JmsEventReceiver.getConn(JmsEventReceiver.java:239)
> 	at com.messaging.jms.JmsEventReceiver.init(JmsEventReceiver.java:182)
> 	at com.messaging.jms.JmsServiceProvider.init(JmsServiceProvider.java:61)
> 	at com.messaging.HerbieEventService.init(HerbieEventService.java:62)
> 	at
> com.messaging.HerbieEventServiceThread.init(HerbieEventServiceThread.java:41)
> 	at
> com.cisco.cpnm.server.context.ApplicationInitListener.initServices(ApplicationInitListener.java:204)
> 	at
> com.cisco.cpnm.server.context.ApplicationInitListener.contextInitialized(ApplicationInitListener.java:88)
> 	at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
> 	at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
> 	at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
> 	at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
> 	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
> 	at
> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
> 	at
> org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
> 	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
> 	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
> 	at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
> 	at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
> 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
> 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
> 	at
> org.apache.catalina.core.StandardService.start(StandardService.java:450)
> 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
> <!--
>     Licensed to the Apache Software Foundation (ASF) under one or more
>     contributor license agreements.  See the NOTICE file distributed with
>     this work for additional information regarding copyright ownership.
>     The ASF licenses this file to You under the Apache License, Version
> 2.0
>     (the "License"); you may not use this file except in compliance with
>     the License.  You may obtain a copy of the License at
>    
>     http://www.apache.org/licenses/LICENSE-2.0
>    
>     Unless required by applicable law or agreed to in writing, software
>     distributed under the License is distributed on an "AS IS" BASIS,
>     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>     See the License for the specific language governing permissions and
>     limitations under the License.
> -->
> <!-- START SNIPPET: example -->
> <beans>
> 
>   <!-- Allows us to use system properties as variables in this
> configuration file -->
>   <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>   
>   <broker brokerName="localhost" useJmx="true"
> xmlns="http://activemq.org/config/1.0">
>   
>     <!--  Use the following to set the broker memory limit 
>     <memoryManager>  
>         <usageManager id="memory-manager" limit="20 MB"/>
>     </memoryManager>
>     -->
>     
>     <!-- Use the following to configure how ActiveMQ is exposed in JMX
>     <managementContext>
>        <managementContext connectorPort="1099"
> jmxDomainName="org.apache.activemq"/>
>     </managementContext>
>     -->
> 
>     <!-- In ActiveMQ 4, you can setup destination policies -->  
>     <destinationPolicy>
>       <policyMap><policyEntries>
>         
>           <policyEntry topic="FOO.>">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
> 
>       </policyEntries></policyMap>
>     </destinationPolicy>
>   
>   
>     <persistenceAdapter>
>         <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/../..activemq-data"/>
>       <!-- To use a different datasource, use the following syntax : -->
>       <!-- 
>       <journaledJDBC journalLogFiles="5" dataDirectory="./activemq-data"
> dataSource="#postgres-ds"/>
>        -->
>     </persistenceAdapter>
>   
>     <transportConnectors>
>        <transportConnector name="openwire"
> uri="tcp://localhost:61716?trace=true&wireFormat.maxInactivityDuration=-1"
> discoveryUri="multicast://default"/>
>        <!-- <transportConnector name="ssl"    
> uri="ssl://localhost:61617"/> -->
>        <!-- <transportConnector name="stomp"  
> uri="stomp://localhost:61613"/> -->
>     </transportConnectors>
>     
>     <networkConnectors>
>       <!-- by default just auto discover the other brokers -->
>       <networkConnector name="default-nc" uri="multicast://default"/>
>       <!--
>       <networkConnector name="host1 and host2"
> uri="static://(tcp://host1:61616,tcp://host2:61616)" failover="true"/>
>       -->
>     </networkConnectors>
>     
>   </broker>
>   
>   <!--  This xbean configuration file supports all the standard spring xml
> configuration options -->
>   
>   <!-- Postgres DataSource Sample Setup -->
>   <!-- 
>   <bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource">
>     <property name="serverName" value="localhost"/>
>     <property name="databaseName" value="activemq"/>
>     <property name="portNumber" value="0"/>
>     <property name="user" value="activemq"/>
>     <property name="password" value="activemq"/>
>     <property name="dataSourceName" value="postgres"/>
>     <property name="initialConnections" value="1"/>
>     <property name="maxConnections" value="10"/>
>   </bean>
>   -->
>   
>   <!-- MySql DataSource Sample Setup -->
>   <!-- 
>   <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>     <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
>     <property name="url"
> value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"/>
>     <property name="username" value="activemq"/>
>     <property name="password" value="activemq"/>
>     <property name="poolPreparedStatements" value="true"/>
>   </bean>
>   -->  
>    
>   <!-- Oracle DataSource Sample Setup -->
>   <!--
>   <bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>     <property name="driverClassName"
> value="oracle.jdbc.driver.OracleDriver"/>
>     <property name="url" value="jdbc:oracle:thin:@localhost:1521:AMQDB"/>
>     <property name="username" value="scott"/>
>     <property name="password" value="tiger"/>
>     <property name="poolPreparedStatements" value="true"/>
>   </bean>
>   -->
>         
>   <!-- Embedded Derby DataSource Sample Setup -->
>   
>   <bean id="derby-ds" class="org.apache.derby.jdbc.EmbeddedDataSource">
>     <property name="databaseName" value="derbydb"/>
>     <property name="createDatabase" value="create"/>
>   </bean>
> 
> </beans>
> <!-- END SNIPPET: example -->
> 
> 

-- 
View this message in context: http://www.nabble.com/embedded-broker--exceptions-tf4148846s2354.html#a11803564
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message