I've solved this. The error is that following the tutorial on
http://activemq.apache.org/tomcat.html leads to a big error: tomcat
shouldn't have a JNDI call because it tries to start it's own activemq
instance. So, please, activemq administrators change that page because it's
totally wrong.



mtorrent wrote:
> 
> Hi,
> 
> I'm new to ActiveMQ. I'm building a web service in Java that inserts a
> registry to mysql database via hibernate, and then inserts a message to
> activemq. Everything is on linux (ubuntu-9.04), and acivemq is running ok
> because I have another application as consumer working propperly.
> The web service is inside tomcat+axis. The problem is that when running on
> eclipse everything works ok (internal eclipse tomcat server), but when I
> deploy the web service on tomcat outside eclipse, activemq producing is
> not working.
> 
> Here's tomcat log when not working:
> 
> 03-may-2010 18:34:42 org.apache.activemq.broker.BrokerService
> getTempDataStore
> INFO: Successfully deleted temporary storage
> 03-may-2010 18:34:42 org.apache.activemq.broker.BrokerService start
> INFO: Using Persistence Adapter:
> AMQPersistenceAdapter(activemq-data/localhost)
> 03-may-2010 18:34:42 org.apache.activemq.store.amq.AMQPersistenceAdapter
> start
> INFO: AMQStore starting using directory: activemq-data/localhost
> 03-may-2010 18:34:43 org.apache.activemq.kaha.impl.KahaStore initialize
> INFO: Kaha Store using data directory
> activemq-data/localhost/kr-store/state
> 03-may-2010 18:34:43 org.apache.activemq.store.amq.AMQPersistenceAdapter
> start
> INFO: Active data files: [1]
> 03-may-2010 18:34:43 org.apache.activemq.broker.jmx.ManagementContext$1
> run
> ADVERTENCIA: Failed to start jmx connector: Cannot bind to URL
> [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException:
> jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]
> 03-may-2010 18:34:43 org.apache.activemq.broker.BrokerService getBroker
> INFO: ActiveMQ 5.3.1 JMS Message Broker (localhost) is starting
> 03-may-2010 18:34:43 org.apache.activemq.broker.BrokerService getBroker
> INFO: For help or more information please see: http://activemq.apache.org/
> 03-may-2010 18:34:43 org.apache.activemq.kaha.impl.KahaStore initialize
> INFO: Kaha Store using data directory
> activemq-data/localhost/kr-store/data
> 03-may-2010 18:34:43 org.apache.activemq.broker.BrokerService start
> INFO: ActiveMQ JMS Message Broker (localhost,
> ID:marc-laptop-53953-1272904410919-0:1) started
> 03-may-2010 18:34:43 org.apache.activemq.broker.TransportConnector start
> INFO: Connector vm://localhost Started
> 03-may-2010 18:34:43 org.apache.activemq.broker.jmx.ManagementContext$1
> run
> ADVERTENCIA: Failed to start jmx connector: Cannot bind to URL
> [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException:
> jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]
> 03-may-2010 18:34:43 org.apache.activemq.kaha.impl.KahaStore initialize
> INFO: Kaha Store using data directory activemq-data/localhost/tmp_storage
> 03-may-2010 18:34:43 org.apache.activemq.broker.TransportConnector stop
> INFO: Connector vm://localhost Stopped
> 03-may-2010 18:34:43 org.apache.activemq.broker.BrokerService stop
> INFO: ActiveMQ Message Broker (localhost,
> ID:marc-laptop-53953-1272904410919-0:1) is shutting down
> 03-may-2010 18:34:43 org.apache.activemq.broker.BrokerService stop
> INFO: ActiveMQ JMS Message Broker (localhost,
> ID:marc-laptop-53953-1272904410919-0:1) stopped
> 03-may-2010 18:35:13
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor fillBatch
> GRAVE: Failed to fill batch
> org.apache.activemq.kaha.RuntimeStoreException: The store is closed
>       at
> org.apache.activemq.kaha.impl.container.BaseContainerImpl.checkClosed(BaseContainerImpl.java:213)
>       at
> org.apache.activemq.kaha.impl.container.MapContainerImpl.load(MapContainerImpl.java:100)
>       at
> org.apache.activemq.kaha.impl.container.MapContainerImpl.getFirst(MapContainerImpl.java:450)
>       at
> org.apache.activemq.store.kahadaptor.KahaReferenceStore.recoverNextMessages(KahaReferenceStore.java:114)
>       at
> org.apache.activemq.store.amq.AMQMessageStore.recoverNextMessages(AMQMessageStore.java:533)
>       at
> org.apache.activemq.broker.region.cursors.QueueStorePrefetch.doFillBatch(QueueStorePrefetch.java:97)
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:251)
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:104)
>       at
> org.apache.activemq.broker.region.cursors.StoreQueueCursor.reset(StoreQueueCursor.java:157)
>       at org.apache.activemq.broker.region.Queue.doBrowse(Queue.java:847)
>       at 
> org.apache.activemq.broker.region.Queue.expireMessages(Queue.java:632)
>       at org.apache.activemq.broker.region.Queue.access$100(Queue.java:89)
>       at org.apache.activemq.broker.region.Queue$2.run(Queue.java:122)
>       at
> org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
>       at java.util.TimerThread.mainLoop(Timer.java:512)
>       at java.util.TimerThread.run(Timer.java:462)
> 03-may-2010 18:35:13
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor reset
> GRAVE: Failed to fill batch
> java.lang.RuntimeException:
> org.apache.activemq.kaha.RuntimeStoreException: The store is closed
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:254)
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:104)
>       at
> org.apache.activemq.broker.region.cursors.StoreQueueCursor.reset(StoreQueueCursor.java:157)
>       at org.apache.activemq.broker.region.Queue.doBrowse(Queue.java:847)
>       at 
> org.apache.activemq.broker.region.Queue.expireMessages(Queue.java:632)
>       at org.apache.activemq.broker.region.Queue.access$100(Queue.java:89)
>       at org.apache.activemq.broker.region.Queue$2.run(Queue.java:122)
>       at
> org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
>       at java.util.TimerThread.mainLoop(Timer.java:512)
>       at java.util.TimerThread.run(Timer.java:462)
> Caused by: org.apache.activemq.kaha.RuntimeStoreException: The store is
> closed
>       at
> org.apache.activemq.kaha.impl.container.BaseContainerImpl.checkClosed(BaseContainerImpl.java:213)
>       at
> org.apache.activemq.kaha.impl.container.MapContainerImpl.load(MapContainerImpl.java:100)
>       at
> org.apache.activemq.kaha.impl.container.MapContainerImpl.getFirst(MapContainerImpl.java:450)
>       at
> org.apache.activemq.store.kahadaptor.KahaReferenceStore.recoverNextMessages(KahaReferenceStore.java:114)
>       at
> org.apache.activemq.store.amq.AMQMessageStore.recoverNextMessages(AMQMessageStore.java:533)
>       at
> org.apache.activemq.broker.region.cursors.QueueStorePrefetch.doFillBatch(QueueStorePrefetch.java:97)
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:251)
>       ... 9 more
> 03-may-2010 18:35:13 org.apache.activemq.broker.region.Queue doBrowse
> GRAVE: Problem retrieving message for browse
> java.lang.RuntimeException: java.lang.RuntimeException:
> org.apache.activemq.kaha.RuntimeStoreException: The store is closed
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:107)
>       at
> org.apache.activemq.broker.region.cursors.StoreQueueCursor.reset(StoreQueueCursor.java:157)
>       at org.apache.activemq.broker.region.Queue.doBrowse(Queue.java:847)
>       at 
> org.apache.activemq.broker.region.Queue.expireMessages(Queue.java:632)
>       at org.apache.activemq.broker.region.Queue.access$100(Queue.java:89)
>       at org.apache.activemq.broker.region.Queue$2.run(Queue.java:122)
>       at
> org.apache.activemq.thread.SchedulerTimerTask.run(SchedulerTimerTask.java:33)
>       at java.util.TimerThread.mainLoop(Timer.java:512)
>       at java.util.TimerThread.run(Timer.java:462)
> Caused by: java.lang.RuntimeException:
> org.apache.activemq.kaha.RuntimeStoreException: The store is closed
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:254)
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.reset(AbstractStoreCursor.java:104)
>       ... 8 more
> Caused by: org.apache.activemq.kaha.RuntimeStoreException: The store is
> closed
>       at
> org.apache.activemq.kaha.impl.container.BaseContainerImpl.checkClosed(BaseContainerImpl.java:213)
>       at
> org.apache.activemq.kaha.impl.container.MapContainerImpl.load(MapContainerImpl.java:100)
>       at
> org.apache.activemq.kaha.impl.container.MapContainerImpl.getFirst(MapContainerImpl.java:450)
>       at
> org.apache.activemq.store.kahadaptor.KahaReferenceStore.recoverNextMessages(KahaReferenceStore.java:114)
>       at
> org.apache.activemq.store.amq.AMQMessageStore.recoverNextMessages(AMQMessageStore.java:533)
>       at
> org.apache.activemq.broker.region.cursors.QueueStorePrefetch.doFillBatch(QueueStorePrefetch.java:97)
>       at
> org.apache.activemq.broker.region.cursors.AbstractStoreCursor.fillBatch(AbstractStoreCursor.java:251)
>       ... 9 more 
> 
> Here's activemq.xml:
> 
> 
> <!--
>     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.
> -->
> <beans
>   xmlns="http://www.springframework.org/schema/beans";
>   xmlns:amq="http://activemq.apache.org/schema/core";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>   http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core.xsd";>
> 
>     <!-- Allows us to use system properties as variables in this
> configuration file -->
>     <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>         <property name="locations">
>            
> <value>file:${activemq.base}/conf/credentials.properties</value>
>         </property>      
>     </bean>
> 
>     <!-- 
>         The <broker> element is used to configure the ActiveMQ broker. 
>     -->
>     <broker xmlns="http://activemq.apache.org/schema/core";
> brokerName="localhost" dataDirectory="${activemq.base}/data"
> destroyApplicationContextOnStop="true">
>  
>         <!--
>                       For better performances use VM cursor and small memory 
> limit.
>                       For more information, see:
>             
>             http://activemq.apache.org/message-cursors.html
>             
>             Also, if your producer is "hanging", it's probably due to
> producer flow control.
>             For more information, see:
>             http://activemq.apache.org/producer-flow-control.html
>         -->
>               
>         <destinationPolicy>
>             <policyMap>
>               <policyEntries>
>                 <policyEntry topic=">" producerFlowControl="true"
> memoryLimit="1mb">
>                   <pendingSubscriberPolicy>
>                     <vmCursor />
>                   </pendingSubscriberPolicy>
>                 </policyEntry>
>                 <policyEntry queue=">" producerFlowControl="true"
> memoryLimit="1mb">
>                   <!-- Use VM cursor for better latency
>                        For more information, see:
>                        
>                        http://activemq.apache.org/message-cursors.html
>                        
>                   <pendingQueuePolicy>
>                     <vmQueueCursor/>
>                   </pendingQueuePolicy>
>                   -->
>                 </policyEntry>
>               </policyEntries>
>             </policyMap>
>         </destinationPolicy> 
>  
>         
>         <!-- 
>             The managementContext is used to configure how ActiveMQ is
> exposed in 
>             JMX. By default, ActiveMQ uses the MBean server that is
> started by 
>             the JVM. For more information, see: 
>             
>             http://activemq.apache.org/jmx.html 
>         -->
>         <managementContext>
>             <managementContext createConnector="true"/>
>         </managementContext>
> 
>         <!-- 
>             Configure message persistence for the broker. The default
> persistence
>             mechanism is the KahaDB store (identified by the kahaDB tag). 
>             For more information, see: 
>             
>             http://activemq.apache.org/persistence.html 
>         -->
>       <!--
>         <persistenceAdapter>
>             <kahaDB directory="${activemq.base}/data/kahadb"/>
>         </persistenceAdapter>
>         -->
>         <persistenceAdapter>
>               <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.base}/activemq-data" dataSource="#mysql-ds"/>
>       </persistenceAdapter>
>           <!--
>             The systemUsage controls the maximum amount of space the
> broker will 
>             use before slowing down producers. For more information, see:
>             
>             http://activemq.apache.org/producer-flow-control.html
>              
>         <systemUsage>
>             <systemUsage>
>                 <memoryUsage>
>                     <memoryUsage limit="20 mb"/>
>                 </memoryUsage>
>                 <storeUsage>
>                     <storeUsage limit="1 gb" name="foo"/>
>                 </storeUsage>
>                 <tempUsage>
>                     <tempUsage limit="100 mb"/>
>                 </tempUsage>
>             </systemUsage>
>         </systemUsage>
>               -->
>                 
>         <!-- 
>             The transport connectors expose ActiveMQ over a given protocol
> to
>             clients and other brokers. For more information, see: 
>             
>             http://activemq.apache.org/configuring-transports.html 
>         -->
>         <transportConnectors>
>             <transportConnector name="openwire"
> uri="tcp://0.0.0.0:61616"/>
>         </transportConnectors>
> 
>     </broker>
> 
>       <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="xxx"/>
>               <property name="password" value="xxx"/>
>               <property name="poolPreparedStatements" value="true"/>
>       </bean> 
> 
>     <!-- 
>         Uncomment to enable Camel
>         Take a look at activemq-camel.xml for more details
>          
>     <import resource="camel.xml"/>
>     -->
> 
>     <!-- 
>         Enable web consoles, REST and Ajax APIs and demos
>         Take a look at activemq-jetty.xml for more details 
>     -->
>     <import resource="jetty.xml"/>
>     
> </beans>
> 
> 
> 
> I've tried usingJmx="false" and nothing happened.
> 
> Thank's in advance,
> 
> Marc
> 

-- 
View this message in context: 
http://old.nabble.com/unable-to-produce-a-message-from-tomcat-web-service-tp28437584p28446130.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to