activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From petera <peter.ander...@egsgroup.com>
Subject Re: Postgres persistence in Tomcat
Date Wed, 13 Sep 2006 08:39:51 GMT

James,

The problem goes away if I keep the connection open during my Tomcat
session.

Is this advisable ? Should I use connection pooling with ActiveMQ
connections ?

Peter


petera wrote:
> 
> 
> James,
> 
> Sorry I spoke to soon. I am using a web app to produce and consume
> messages. I can produce the messages or consume the messages in separate
> Tomcat sessions but when
> I try to to both in the same session I get the following error message:
> 
> javax.jms.JMSException: Could not connect to broker URL:
> vm://localhost?brokerConfig=xbean:activemq.xml. Reason:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'org.apache.activemq.store.PersistenceAdapterFactoryBean'
> defined in class path resource [activemq.xml]: Can't resolve reference to
> bean 'postgres-ds' while setting property 'dataSource'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'postgres-ds' defined in class path resource
> [activemq.xml]: Error setting property values; nested exception is
> org.springframework.beans.PropertyAccessExceptionsException:
> PropertyAccessExceptionsException (1 errors); nested
> propertyAccessExceptions are:
> [org.springframework.beans.MethodInvocationException: Property
> 'dataSourceName' threw exception; nested exception is
> java.lang.IllegalArgumentException: DataSource with name 'postgres'
> already exists!]
> 
> FULL log of ActiveMQ interaction creating and attempting to consume simple
> text messages:
> 
> Sep 12, 2006 10:25:18 AM
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions
> INFO: Loading XML bean definitions from class path resource [activemq.xml]
> Sep 12, 2006 10:25:18 AM
> org.springframework.context.support.AbstractRefreshableApplicationContext
> refreshBeanFactory
> INFO: Bean factory for application context
> [org.apache.xbean.spring.context.ClassPathXmlApplicationContext;hashCode=16710868]:
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer,org.apache.activemq.xbean.XBeanBrokerService,postgres-ds];
> root of BeanFactory hierarchy
> Sep 12, 2006 10:25:19 AM
> org.springframework.context.support.AbstractApplicationContext refresh
> INFO: 3 beans defined in application context
> [org.apache.xbean.spring.context.ClassPathXmlApplicationContext;hashCode=16710868]
> Sep 12, 2006 10:25:19 AM org.springframework.core.CollectionFactory
> <clinit>
> INFO: JDK 1.4+ collections available
> Sep 12, 2006 10:25:19 AM
> org.springframework.context.support.AbstractApplicationContext
> initMessageSource
> INFO: Unable to locate MessageSource with name 'messageSource': using
> default
> [org.springframework.context.support.DelegatingMessageSource@42c516]
> Sep 12, 2006 10:25:19 AM
> org.springframework.context.support.AbstractApplicationContext
> initApplicationEventMulticaster
> INFO: Unable to locate ApplicationEventMulticaster with name
> 'applicationEventMulticaster': using default
> [org.springframework.context.event.SimpleApplicationEventMulticaster@16b6cd]
> Sep 12, 2006 10:25:19 AM
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> preInstantiateSingletons
> INFO: Pre-instantiating singletons in factory
> [org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer,org.apache.activemq.xbean.XBeanBrokerService,postgres-ds];
> root of BeanFactory hierarchy]
> Sep 12, 2006 10:25:19 AM org.apache.activemq.broker.BrokerService
> getBroker
> INFO: ActiveMQ 4.0.1 JMS Message Broker (localhost) is starting
> Sep 12, 2006 10:25:19 AM org.apache.activemq.broker.BrokerService
> getBroker
> INFO: For help or more information please see:
> http://incubator.apache.org/activemq/
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.jdbc.JDBCPersistenceAdapter createAdapter
> INFO: Database driver recognized: [postgresql_native_driver]
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter doCreateTables
> WARNING: Could not create JDBC tables; they could already exist. Failure
> was: CREATE TABLE ACTIVEMQ_MSGS(ID INTEGER NOT NULL, CONTAINER
> VARCHAR(250), MSGID_PROD VARCHAR(250), MSGID_SEQ INTEGER, EXPIRATION
> BIGINT, MSG BYTEA, PRIMARY KEY ( ID ) ) Message: ERROR: relation
> "activemq_msgs" already exists
>  SQLState: 42P07 Vendor code: 0
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter doCreateTables
> WARNING: Could not create JDBC tables; they could already exist. Failure
> was: CREATE INDEX ACTIVEMQ_MSGS_MIDX ON ACTIVEMQ_MSGS
> (MSGID_PROD,MSGID_SEQ) Message: ERROR: current transaction is aborted,
> commands ignored until end of transaction block
>  SQLState: 25P02 Vendor code: 0
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter doCreateTables
> WARNING: Could not create JDBC tables; they could already exist. Failure
> was: CREATE INDEX ACTIVEMQ_MSGS_CIDX ON ACTIVEMQ_MSGS (CONTAINER) Message:
> ERROR: current transaction is aborted, commands ignored until end of
> transaction block
>  SQLState: 25P02 Vendor code: 0
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter doCreateTables
> WARNING: Could not create JDBC tables; they could already exist. Failure
> was: CREATE INDEX ACTIVEMQ_MSGS_EIDX ON ACTIVEMQ_MSGS (EXPIRATION)
> Message: ERROR: current transaction is aborted, commands ignored until end
> of transaction block
>  SQLState: 25P02 Vendor code: 0
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter doCreateTables
> WARNING: Could not create JDBC tables; they could already exist. Failure
> was: CREATE TABLE ACTIVEMQ_ACKS(CONTAINER VARCHAR(250) NOT NULL, CLIENT_ID
> VARCHAR(250) NOT NULL, SUB_NAME VARCHAR(250) NOT NULL, SELECTOR
> VARCHAR(250), LAST_ACKED_ID INTEGER, PRIMARY KEY ( CONTAINER, CLIENT_ID,
> SUB_NAME)) Message: ERROR: current transaction is aborted, commands
> ignored until end of transaction block
>  SQLState: 25P02 Vendor code: 0
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.journal.JournalPersistenceAdapter recover
> INFO: Journal Recovery Started from: Active Journal: using 5 x 20.0 Megs
> at: /Volumes/RAID/apache-tomcat-5.5.17/activemq-data/journal
> Sep 12, 2006 10:25:19 AM
> org.apache.activemq.store.journal.JournalPersistenceAdapter recover
> INFO: Journal Recovered: 1 message(s) in transactions recovered.
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.TransportServerThreadSupport doStart
> INFO: Listening for connections at:
> tcp://EGS-COM-42-Peter-Anderson.local:61616
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent
> start
> WARNING: brokerName not set
> Sep 12, 2006 10:25:20 AM org.apache.activemq.broker.TransportConnector
> start
> INFO: Connector default Started
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.TransportServerThreadSupport doStart
> INFO: Listening for connections at:
> tcp://EGS-COM-42-Peter-Anderson.local:61613?wireFormat=stomp
> Sep 12, 2006 10:25:20 AM org.apache.activemq.broker.TransportConnector
> start
> INFO: Connector stomp Started
> Sep 12, 2006 10:25:20 AM org.apache.activemq.network.NetworkConnector
> doStart
> INFO: Network Connector default Started
> Sep 12, 2006 10:25:20 AM org.apache.activemq.broker.BrokerService start
> INFO: ActiveMQ JMS Message Broker (localhost,
> ID:EGS-COM-42-Peter-Anderson.local-50379-1158053119113-1:0) started
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.vm.VMTransportFactory bind
> INFO: binding to broker: localhost
> Sep 12, 2006 10:25:20 AM org.apache.activemq.broker.TransportConnector
> start
> INFO: Connector vm://localhost Started
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.vm.VMTransportFactory stopped
> INFO: Shutting down VM connectors for broker: localhost
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.vm.VMTransportFactory stopped
> INFO: Shutting down VM connectors for broker: localhost
> Sep 12, 2006 10:25:20 AM org.apache.activemq.broker.TransportConnector
> stop
> INFO: Connector vm://localhost Stopped
> Sep 12, 2006 10:25:20 AM org.apache.activemq.broker.BrokerService stop
> INFO: ActiveMQ Message Broker (localhost,
> ID:EGS-COM-42-Peter-Anderson.local-50379-1158053119113-1:0) is shutting
> down
> Sep 12, 2006 10:25:20 AM org.apache.activemq.network.NetworkConnector
> doStop
> INFO: Network Connector default Stopped
> Sep 12, 2006 10:25:20 AM
> org.apache.activemq.transport.discovery.multicast.MulticastDiscoveryAgent
> run
> SEVERE: failed to process packet: java.net.SocketException: Socket closed
> Sep 12, 2006 10:25:22 AM org.apache.activemq.broker.TransportConnector
> stop
> INFO: Connector default Stopped
> Sep 12, 2006 10:25:22 AM org.apache.activemq.broker.TransportConnector
> stop
> INFO: Connector stomp Stopped
> Sep 12, 2006 10:25:22 AM
> org.apache.activemq.transport.vm.VMTransportFactory stopped
> INFO: Shutting down VM connectors for broker: localhost
> Sep 12, 2006 10:25:22 AM org.apache.activemq.broker.BrokerService stop
> INFO: ActiveMQ JMS Message Broker (localhost,
> ID:EGS-COM-42-Peter-Anderson.local-50379-1158053119113-1:0) stopped
> Sep 12, 2006 10:27:36 AM
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions
> INFO: Loading XML bean definitions from class path resource [activemq.xml]
> Sep 12, 2006 10:27:36 AM
> org.springframework.context.support.AbstractRefreshableApplicationContext
> refreshBeanFactory
> INFO: Bean factory for application context
> [org.apache.xbean.spring.context.ClassPathXmlApplicationContext;hashCode=5223444]:
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer,org.apache.activemq.xbean.XBeanBrokerService,postgres-ds];
> root of BeanFactory hierarchy
> Sep 12, 2006 10:27:36 AM
> org.springframework.context.support.AbstractApplicationContext refresh
> INFO: 3 beans defined in application context
> [org.apache.xbean.spring.context.ClassPathXmlApplicationContext;hashCode=5223444]
> Sep 12, 2006 10:27:36 AM
> org.springframework.context.support.AbstractApplicationContext
> initMessageSource
> INFO: Unable to locate MessageSource with name 'messageSource': using
> default
> [org.springframework.context.support.DelegatingMessageSource@847705]
> Sep 12, 2006 10:27:36 AM
> org.springframework.context.support.AbstractApplicationContext
> initApplicationEventMulticaster
> INFO: Unable to locate ApplicationEventMulticaster with name
> 'applicationEventMulticaster': using default
> [org.springframework.context.event.SimpleApplicationEventMulticaster@a1f659]
> Sep 12, 2006 10:27:36 AM
> org.springframework.beans.factory.support.DefaultListableBeanFactory
> preInstantiateSingletons
> INFO: Pre-instantiating singletons in factory
> [org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer,org.apache.activemq.xbean.XBeanBrokerService,postgres-ds];
> root of BeanFactory hierarchy]
> Sep 12, 2006 10:27:36 AM
> org.springframework.beans.factory.support.AbstractBeanFactory
> destroySingletons
> INFO: Destroying singletons in factory
> {org.springframework.beans.factory.support.DefaultListableBeanFactory
> defining beans
> [org.springframework.beans.factory.config.PropertyPlaceholderConfigurer,org.apache.activemq.xbean.XBeanBrokerService,postgres-ds];
> root of BeanFactory hierarchy}
> javax.jms.JMSException: Could not connect to broker URL:
> vm://localhost?brokerConfig=xbean:activemq.xml. Reason:
> org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'org.apache.activemq.store.PersistenceAdapterFactoryBean'
> defined in class path resource [activemq.xml]: Can't resolve reference to
> bean 'postgres-ds' while setting property 'dataSource'; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error creating
> bean with name 'postgres-ds' defined in class path resource
> [activemq.xml]: Error setting property values; nested exception is
> org.springframework.beans.PropertyAccessExceptionsException:
> PropertyAccessExceptionsException (1 errors); nested
> propertyAccessExceptions are:
> [org.springframework.beans.MethodInvocationException: Property
> 'dataSourceName' threw exception; nested exception is
> java.lang.IllegalArgumentException: DataSource with name 'postgres'
> already exists!]
>  
> 
> 
> 
> 
> 
> James.Strachan wrote:
>> 
>> On 9/11/06, petera <peter.anderson@egsgroup.com> wrote:
>>>
>>> James,
>>>
>>> Now loaded the bean-spring jar file I am getting further ut now
>>> receiving
>>> error message:
>>>
>>> >Could not connect to broker URL:
>>> vm://localhost?brokerConfig=xbean:activemq.xml. Reason:
>>> org.springframework.beans.factory.BeanDefinitionStoreException: Error
>>> registering bean with >name 'postgres-ds' defined in class path resource
>>> [activemq.xml]: Bean class [org.postgresql.ds.PGPoolingDataSource] not
>>> found; nested exception is java.lang.ClassNotFoundException:
>>> >org.postgresql.ds.PGPoolingDataSource
>>>
>>> I have the Postgres 8.1.4 jdbc jar loaded in commons/lib
>> 
>> The answer is that last bit of log...
>> 
>> exception is java.lang.ClassNotFoundException:
>>>org.postgresql.ds.PGPoolingDataSource
>> 
>> So you need to find a jar with that class and add it to your classpath
>> -- 
>> 
>> James
>> -------
>> http://radio.weblogs.com/0112098/
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6281322
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message