You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by petera <pe...@egsgroup.com> on 2006/09/06 10:41:31 UTC
Postgres persistence in Tomcat
Hi,
I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
persist the messages to a Postgres database rather than the default
apache-derby database.
What additional config parameters do I need to set in my context.xml file.
TIA Peter
context.xml:
<Context antiJARLocking="true">
<Resource
name="jms/ConnectionFactory"
auth="Container"
type="org.apache.activemq.ActiveMQConnectionFactory"
description="JMS Connection Factory"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
brokerURL="vm://localhost"
brokerName="LocalActiveMQBroker"
useEmbeddedBroker="false"/>
<Resource name="jms/MyTopic"
auth="Container"
type="org.apache.activemq.command.ActiveMQTopic"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="MY.TEST.FOO"/>
<Resource name="jms/MyQueue"
auth="Container"
type="org.apache.activemq.command.ActiveMQQueue"
factory="org.apache.activemq.jndi.JNDIReferenceFactory"
physicalName="MY.TEST.BAR"/>
</Context>
--
View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6167044
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Postgres persistence in Tomcat
Posted by Adrian Co <ac...@exist.com>.
AFAIK, ActiveMQ will create the database and tables it needs. Are you
encountering any exceptions?
petera wrote:
> Adrian,
>
> Thanks for your help. The documentation is a bit patchy on actually setting
> up the messaging database.
>
> Do I just create an activemq database in postgres and then activemq
> automatically creates the tables it requires. Or do I
> need to create some tables for it to use ?
>
> TIA Peter
>
>
>
> Adrian Co wrote:
>
>> Hi,
>>
>> One way I could think of is to configure your broker using an external
>> config file (i.e. activemq.xml) and just change the dataSource of the
>> persistence adapter to postgres. Example:
>> https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
>>
>> Just uncomment the postgres-ds bean and uncomment the reference in the
>> persistence adapter.
>>
>> And use that config file to configure your embedded broker. i.e.
>> brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
>> activemq.xml is in the classpath
>>
>> or
>>
>> brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
>> for file path referencing
>>
>> Hope this helps.
>>
>> Regards,
>> Adrian Co
>>
>> petera wrote:
>>
>>> Hi,
>>>
>>> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
>>> persist the messages to a Postgres database rather than the default
>>> apache-derby database.
>>>
>>> What additional config parameters do I need to set in my context.xml
>>> file.
>>>
>>>
>>> TIA Peter
>>>
>>>
>>> context.xml:
>>>
>>> <Context antiJARLocking="true">
>>>
>>> <Resource
>>> name="jms/ConnectionFactory"
>>> auth="Container"
>>> type="org.apache.activemq.ActiveMQConnectionFactory"
>>> description="JMS Connection Factory"
>>> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> brokerURL="vm://localhost"
>>> brokerName="LocalActiveMQBroker"
>>> useEmbeddedBroker="false"/>
>>>
>>> <Resource name="jms/MyTopic"
>>> auth="Container"
>>> type="org.apache.activemq.command.ActiveMQTopic"
>>> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> physicalName="MY.TEST.FOO"/>
>>>
>>> <Resource name="jms/MyQueue"
>>> auth="Container"
>>> type="org.apache.activemq.command.ActiveMQQueue"
>>> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> physicalName="MY.TEST.BAR"/>
>>>
>>> </Context>
>>>
>>>
>>>
>>>
>>
>>
>
>
Re: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
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 <pe...@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.
Re: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
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 <pe...@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#a6262661
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
James,
Yes the problem was my company uses the JDBC 2 version of the Postgres jar.
Using the JDBC 3 version contains the correct classes required and produces
the persistent messages in Postgres.
Thanks to both you and Mark for your help.
Peter
James.Strachan wrote:
>
> On 9/11/06, petera <pe...@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#a6249956
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Postgres persistence in Tomcat
Posted by James Strachan <ja...@gmail.com>.
On 9/11/06, petera <pe...@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/
Re: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
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
What am I missing ?
TIA Peter
petera wrote:
>
> James,
>
> I am trying to configure the broker with activemq.xml file i.e.
>
> brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml"
>
> I am not using spring for development but have placed the spring jar
> (spring-1.2.6.jar) in my WEB_INF/lib directory.
>
> When I try to produce some messages I get the following error:
>
> Could not connect to broker URL:
> vm://localhost?brokerConfig=xbean:activemq.xml. Reason:
> java.io.IOException: Could load xbean
> factory:java.lang.NoClassDefFoundError
>
> What I am missing ?
>
> TIA Peter
>
> activemq.xml setup for persisting to Postgres database:
>
>
> <!--
> 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 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.home}/activemq-data"/>
> -->
> <!-- To use a different datasource, use the following syntax : -->
> <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
> dataSource="#postgres-ds"/>
> </persistenceAdapter>
>
> <transportConnectors>
> <transportConnector name="default" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
> <transportConnector name="stomp" uri="stomp://localhost:61613"/>
> </transportConnectors>
>
> <networkConnectors>
> <!-- by default just auto discover the other brokers -->
> <networkConnector name="default" 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 -->
>
>
>
>
>
>
> James.Strachan wrote:
>>
>> Just create a valid login/pwd so that there is an empty database then
>> ActiveMQ will do the rest
>>
>> On 9/7/06, petera <pe...@egsgroup.com> wrote:
>>>
>>> Adrian,
>>>
>>> Thanks for your help. The documentation is a bit patchy on actually
>>> setting
>>> up the messaging database.
>>>
>>> Do I just create an activemq database in postgres and then activemq
>>> automatically creates the tables it requires. Or do I
>>> need to create some tables for it to use ?
>>>
>>> TIA Peter
>>>
>>>
>>>
>>> Adrian Co wrote:
>>> >
>>> > Hi,
>>> >
>>> > One way I could think of is to configure your broker using an external
>>> > config file (i.e. activemq.xml) and just change the dataSource of the
>>> > persistence adapter to postgres. Example:
>>> >
>>> https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
>>> >
>>> > Just uncomment the postgres-ds bean and uncomment the reference in the
>>> > persistence adapter.
>>> >
>>> > And use that config file to configure your embedded broker. i.e.
>>> > brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
>>> > activemq.xml is in the classpath
>>> >
>>> > or
>>> >
>>> > brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
>>> > for file path referencing
>>> >
>>> > Hope this helps.
>>> >
>>> > Regards,
>>> > Adrian Co
>>> >
>>> > petera wrote:
>>> >> Hi,
>>> >>
>>> >> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like
>>> to
>>> >> persist the messages to a Postgres database rather than the default
>>> >> apache-derby database.
>>> >>
>>> >> What additional config parameters do I need to set in my context.xml
>>> >> file.
>>> >>
>>> >>
>>> >> TIA Peter
>>> >>
>>> >>
>>> >> context.xml:
>>> >>
>>> >> <Context antiJARLocking="true">
>>> >>
>>> >> <Resource
>>> >> name="jms/ConnectionFactory"
>>> >> auth="Container"
>>> >> type="org.apache.activemq.ActiveMQConnectionFactory"
>>> >> description="JMS Connection Factory"
>>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> >> brokerURL="vm://localhost"
>>> >> brokerName="LocalActiveMQBroker"
>>> >> useEmbeddedBroker="false"/>
>>> >>
>>> >> <Resource name="jms/MyTopic"
>>> >> auth="Container"
>>> >> type="org.apache.activemq.command.ActiveMQTopic"
>>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> >> physicalName="MY.TEST.FOO"/>
>>> >>
>>> >> <Resource name="jms/MyQueue"
>>> >> auth="Container"
>>> >> type="org.apache.activemq.command.ActiveMQQueue"
>>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> >> physicalName="MY.TEST.BAR"/>
>>> >>
>>> >> </Context>
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6186145
>>> Sent from the ActiveMQ - User forum at Nabble.com.
>>>
>>>
>>
>>
>> --
>>
>> James
>> -------
>> http://radio.weblogs.com/0112098/
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6247570
Sent from the ActiveMQ - User forum at Nabble.com.
RE: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
Mark,
Thanks. I think out threads crossed. I am now getting a different error
message SEE my latest thread.
TIA Peter
Mark Ashworth-2 wrote:
>
> Place the xbean-spring-2.2.jar in the WEB-INF/lib directory
>
>
>
> -----Original Message-----
> From: petera [mailto:peter.anderson@egsgroup.com]
> Sent: 11 September 2006 11:43 AM
> To: activemq-users@geronimo.apache.org
> Subject: Re: Postgres persistence in Tomcat
>
>
> James,
>
> I am trying to configure the broker with activemq.xml file i.e.
>
> brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml"
>
> I am not using spring for development but have placed the spring jar
> (spring-1.2.6.jar) in my WEB_INF/lib directory.
>
> When I try to produce some messages I get the following error:
>
> Could not connect to broker URL:
> vm://localhost?brokerConfig=xbean:activemq.xml. Reason:
> java.io.IOException:
> Could load xbean factory:java.lang.NoClassDefFoundError
>
> What I am missing ?
>
> TIA Peter
>
> activemq.xml setup for persisting to Postgres database:
>
>
> <!--
> 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.PropertyPlaceholderConfigure
> r"/>
>
>
> <broker 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.home}/activemq-data"/>
> -->
> <!-- To use a different datasource, use the following syntax : -->
> <journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
> dataSource="#postgres-ds"/>
> </persistenceAdapter>
>
> <transportConnectors>
> <transportConnector name="default" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
> <transportConnector name="stomp" uri="stomp://localhost:61613"/>
> </transportConnectors>
>
> <networkConnectors>
> <!-- by default just auto discover the other brokers -->
> <networkConnector name="default" 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 -->
>
>
>
>
>
>
> James.Strachan wrote:
>>
>> Just create a valid login/pwd so that there is an empty database then
>> ActiveMQ will do the rest
>>
>> On 9/7/06, petera <pe...@egsgroup.com> wrote:
>>>
>>> Adrian,
>>>
>>> Thanks for your help. The documentation is a bit patchy on actually
>>> setting
>>> up the messaging database.
>>>
>>> Do I just create an activemq database in postgres and then activemq
>>> automatically creates the tables it requires. Or do I
>>> need to create some tables for it to use ?
>>>
>>> TIA Peter
>>>
>>>
>>>
>>> Adrian Co wrote:
>>> >
>>> > Hi,
>>> >
>>> > One way I could think of is to configure your broker using an external
>>> > config file (i.e. activemq.xml) and just change the dataSource of the
>>> > persistence adapter to postgres. Example:
>>> >
>>>
> https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/relea
> se/conf/activemq.xml
>>> >
>>> > Just uncomment the postgres-ds bean and uncomment the reference in the
>>> > persistence adapter.
>>> >
>>> > And use that config file to configure your embedded broker. i.e.
>>> > brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
>>> > activemq.xml is in the classpath
>>> >
>>> > or
>>> >
>>> > brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
>>> > for file path referencing
>>> >
>>> > Hope this helps.
>>> >
>>> > Regards,
>>> > Adrian Co
>>> >
>>> > petera wrote:
>>> >> Hi,
>>> >>
>>> >> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like
>>> to
>>> >> persist the messages to a Postgres database rather than the default
>>> >> apache-derby database.
>>> >>
>>> >> What additional config parameters do I need to set in my context.xml
>>> >> file.
>>> >>
>>> >>
>>> >> TIA Peter
>>> >>
>>> >>
>>> >> context.xml:
>>> >>
>>> >> <Context antiJARLocking="true">
>>> >>
>>> >> <Resource
>>> >> name="jms/ConnectionFactory"
>>> >> auth="Container"
>>> >> type="org.apache.activemq.ActiveMQConnectionFactory"
>>> >> description="JMS Connection Factory"
>>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> >> brokerURL="vm://localhost"
>>> >> brokerName="LocalActiveMQBroker"
>>> >> useEmbeddedBroker="false"/>
>>> >>
>>> >> <Resource name="jms/MyTopic"
>>> >> auth="Container"
>>> >> type="org.apache.activemq.command.ActiveMQTopic"
>>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> >> physicalName="MY.TEST.FOO"/>
>>> >>
>>> >> <Resource name="jms/MyQueue"
>>> >> auth="Container"
>>> >> type="org.apache.activemq.command.ActiveMQQueue"
>>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>>> >> physicalName="MY.TEST.BAR"/>
>>> >>
>>> >> </Context>
>>> >>
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>>
> http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6186145
>>> Sent from the ActiveMQ - User forum at Nabble.com.
>>>
>>>
>>
>>
>> --
>>
>> James
>> -------
>> http://radio.weblogs.com/0112098/
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6243677
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
>
>
--
View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6247608
Sent from the ActiveMQ - User forum at Nabble.com.
RE: Postgres persistence in Tomcat
Posted by Mark Ashworth <ma...@cibecs.com>.
Place the xbean-spring-2.2.jar in the WEB-INF/lib directory
-----Original Message-----
From: petera [mailto:peter.anderson@egsgroup.com]
Sent: 11 September 2006 11:43 AM
To: activemq-users@geronimo.apache.org
Subject: Re: Postgres persistence in Tomcat
James,
I am trying to configure the broker with activemq.xml file i.e.
brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml"
I am not using spring for development but have placed the spring jar
(spring-1.2.6.jar) in my WEB_INF/lib directory.
When I try to produce some messages I get the following error:
Could not connect to broker URL:
vm://localhost?brokerConfig=xbean:activemq.xml. Reason: java.io.IOException:
Could load xbean factory:java.lang.NoClassDefFoundError
What I am missing ?
TIA Peter
activemq.xml setup for persisting to Postgres database:
<!--
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.PropertyPlaceholderConfigure
r"/>
<broker 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.home}/activemq-data"/>
-->
<!-- To use a different datasource, use the following syntax : -->
<journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
dataSource="#postgres-ds"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="default" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
<transportConnector name="stomp" uri="stomp://localhost:61613"/>
</transportConnectors>
<networkConnectors>
<!-- by default just auto discover the other brokers -->
<networkConnector name="default" 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 -->
James.Strachan wrote:
>
> Just create a valid login/pwd so that there is an empty database then
> ActiveMQ will do the rest
>
> On 9/7/06, petera <pe...@egsgroup.com> wrote:
>>
>> Adrian,
>>
>> Thanks for your help. The documentation is a bit patchy on actually
>> setting
>> up the messaging database.
>>
>> Do I just create an activemq database in postgres and then activemq
>> automatically creates the tables it requires. Or do I
>> need to create some tables for it to use ?
>>
>> TIA Peter
>>
>>
>>
>> Adrian Co wrote:
>> >
>> > Hi,
>> >
>> > One way I could think of is to configure your broker using an external
>> > config file (i.e. activemq.xml) and just change the dataSource of the
>> > persistence adapter to postgres. Example:
>> >
>>
https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/relea
se/conf/activemq.xml
>> >
>> > Just uncomment the postgres-ds bean and uncomment the reference in the
>> > persistence adapter.
>> >
>> > And use that config file to configure your embedded broker. i.e.
>> > brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
>> > activemq.xml is in the classpath
>> >
>> > or
>> >
>> > brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
>> > for file path referencing
>> >
>> > Hope this helps.
>> >
>> > Regards,
>> > Adrian Co
>> >
>> > petera wrote:
>> >> Hi,
>> >>
>> >> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
>> >> persist the messages to a Postgres database rather than the default
>> >> apache-derby database.
>> >>
>> >> What additional config parameters do I need to set in my context.xml
>> >> file.
>> >>
>> >>
>> >> TIA Peter
>> >>
>> >>
>> >> context.xml:
>> >>
>> >> <Context antiJARLocking="true">
>> >>
>> >> <Resource
>> >> name="jms/ConnectionFactory"
>> >> auth="Container"
>> >> type="org.apache.activemq.ActiveMQConnectionFactory"
>> >> description="JMS Connection Factory"
>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> >> brokerURL="vm://localhost"
>> >> brokerName="LocalActiveMQBroker"
>> >> useEmbeddedBroker="false"/>
>> >>
>> >> <Resource name="jms/MyTopic"
>> >> auth="Container"
>> >> type="org.apache.activemq.command.ActiveMQTopic"
>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> >> physicalName="MY.TEST.FOO"/>
>> >>
>> >> <Resource name="jms/MyQueue"
>> >> auth="Container"
>> >> type="org.apache.activemq.command.ActiveMQQueue"
>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> >> physicalName="MY.TEST.BAR"/>
>> >>
>> >> </Context>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6186145
>> Sent from the ActiveMQ - User forum at Nabble.com.
>>
>>
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
>
--
View this message in context:
http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6243677
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
James,
I am trying to configure the broker with activemq.xml file i.e.
brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml"
I am not using spring for development but have placed the spring jar
(spring-1.2.6.jar) in my WEB_INF/lib directory.
When I try to produce some messages I get the following error:
Could not connect to broker URL:
vm://localhost?brokerConfig=xbean:activemq.xml. Reason: java.io.IOException:
Could load xbean factory:java.lang.NoClassDefFoundError
What I am missing ?
TIA Peter
activemq.xml setup for persisting to Postgres database:
<!--
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 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.home}/activemq-data"/>
-->
<!-- To use a different datasource, use the following syntax : -->
<journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
dataSource="#postgres-ds"/>
</persistenceAdapter>
<transportConnectors>
<transportConnector name="default" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
<transportConnector name="stomp" uri="stomp://localhost:61613"/>
</transportConnectors>
<networkConnectors>
<!-- by default just auto discover the other brokers -->
<networkConnector name="default" 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 -->
James.Strachan wrote:
>
> Just create a valid login/pwd so that there is an empty database then
> ActiveMQ will do the rest
>
> On 9/7/06, petera <pe...@egsgroup.com> wrote:
>>
>> Adrian,
>>
>> Thanks for your help. The documentation is a bit patchy on actually
>> setting
>> up the messaging database.
>>
>> Do I just create an activemq database in postgres and then activemq
>> automatically creates the tables it requires. Or do I
>> need to create some tables for it to use ?
>>
>> TIA Peter
>>
>>
>>
>> Adrian Co wrote:
>> >
>> > Hi,
>> >
>> > One way I could think of is to configure your broker using an external
>> > config file (i.e. activemq.xml) and just change the dataSource of the
>> > persistence adapter to postgres. Example:
>> >
>> https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
>> >
>> > Just uncomment the postgres-ds bean and uncomment the reference in the
>> > persistence adapter.
>> >
>> > And use that config file to configure your embedded broker. i.e.
>> > brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
>> > activemq.xml is in the classpath
>> >
>> > or
>> >
>> > brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
>> > for file path referencing
>> >
>> > Hope this helps.
>> >
>> > Regards,
>> > Adrian Co
>> >
>> > petera wrote:
>> >> Hi,
>> >>
>> >> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
>> >> persist the messages to a Postgres database rather than the default
>> >> apache-derby database.
>> >>
>> >> What additional config parameters do I need to set in my context.xml
>> >> file.
>> >>
>> >>
>> >> TIA Peter
>> >>
>> >>
>> >> context.xml:
>> >>
>> >> <Context antiJARLocking="true">
>> >>
>> >> <Resource
>> >> name="jms/ConnectionFactory"
>> >> auth="Container"
>> >> type="org.apache.activemq.ActiveMQConnectionFactory"
>> >> description="JMS Connection Factory"
>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> >> brokerURL="vm://localhost"
>> >> brokerName="LocalActiveMQBroker"
>> >> useEmbeddedBroker="false"/>
>> >>
>> >> <Resource name="jms/MyTopic"
>> >> auth="Container"
>> >> type="org.apache.activemq.command.ActiveMQTopic"
>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> >> physicalName="MY.TEST.FOO"/>
>> >>
>> >> <Resource name="jms/MyQueue"
>> >> auth="Container"
>> >> type="org.apache.activemq.command.ActiveMQQueue"
>> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> >> physicalName="MY.TEST.BAR"/>
>> >>
>> >> </Context>
>> >>
>> >>
>> >>
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6186145
>> Sent from the ActiveMQ - User forum at Nabble.com.
>>
>>
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
>
--
View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6243677
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Postgres persistence in Tomcat
Posted by James Strachan <ja...@gmail.com>.
Just create a valid login/pwd so that there is an empty database then
ActiveMQ will do the rest
On 9/7/06, petera <pe...@egsgroup.com> wrote:
>
> Adrian,
>
> Thanks for your help. The documentation is a bit patchy on actually setting
> up the messaging database.
>
> Do I just create an activemq database in postgres and then activemq
> automatically creates the tables it requires. Or do I
> need to create some tables for it to use ?
>
> TIA Peter
>
>
>
> Adrian Co wrote:
> >
> > Hi,
> >
> > One way I could think of is to configure your broker using an external
> > config file (i.e. activemq.xml) and just change the dataSource of the
> > persistence adapter to postgres. Example:
> > https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
> >
> > Just uncomment the postgres-ds bean and uncomment the reference in the
> > persistence adapter.
> >
> > And use that config file to configure your embedded broker. i.e.
> > brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
> > activemq.xml is in the classpath
> >
> > or
> >
> > brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
> > for file path referencing
> >
> > Hope this helps.
> >
> > Regards,
> > Adrian Co
> >
> > petera wrote:
> >> Hi,
> >>
> >> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
> >> persist the messages to a Postgres database rather than the default
> >> apache-derby database.
> >>
> >> What additional config parameters do I need to set in my context.xml
> >> file.
> >>
> >>
> >> TIA Peter
> >>
> >>
> >> context.xml:
> >>
> >> <Context antiJARLocking="true">
> >>
> >> <Resource
> >> name="jms/ConnectionFactory"
> >> auth="Container"
> >> type="org.apache.activemq.ActiveMQConnectionFactory"
> >> description="JMS Connection Factory"
> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> >> brokerURL="vm://localhost"
> >> brokerName="LocalActiveMQBroker"
> >> useEmbeddedBroker="false"/>
> >>
> >> <Resource name="jms/MyTopic"
> >> auth="Container"
> >> type="org.apache.activemq.command.ActiveMQTopic"
> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> >> physicalName="MY.TEST.FOO"/>
> >>
> >> <Resource name="jms/MyQueue"
> >> auth="Container"
> >> type="org.apache.activemq.command.ActiveMQQueue"
> >> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> >> physicalName="MY.TEST.BAR"/>
> >>
> >> </Context>
> >>
> >>
> >>
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6186145
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Postgres persistence in Tomcat
Posted by petera <pe...@egsgroup.com>.
Adrian,
Thanks for your help. The documentation is a bit patchy on actually setting
up the messaging database.
Do I just create an activemq database in postgres and then activemq
automatically creates the tables it requires. Or do I
need to create some tables for it to use ?
TIA Peter
Adrian Co wrote:
>
> Hi,
>
> One way I could think of is to configure your broker using an external
> config file (i.e. activemq.xml) and just change the dataSource of the
> persistence adapter to postgres. Example:
> https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
>
> Just uncomment the postgres-ds bean and uncomment the reference in the
> persistence adapter.
>
> And use that config file to configure your embedded broker. i.e.
> brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
> activemq.xml is in the classpath
>
> or
>
> brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
> for file path referencing
>
> Hope this helps.
>
> Regards,
> Adrian Co
>
> petera wrote:
>> Hi,
>>
>> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
>> persist the messages to a Postgres database rather than the default
>> apache-derby database.
>>
>> What additional config parameters do I need to set in my context.xml
>> file.
>>
>>
>> TIA Peter
>>
>>
>> context.xml:
>>
>> <Context antiJARLocking="true">
>>
>> <Resource
>> name="jms/ConnectionFactory"
>> auth="Container"
>> type="org.apache.activemq.ActiveMQConnectionFactory"
>> description="JMS Connection Factory"
>> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> brokerURL="vm://localhost"
>> brokerName="LocalActiveMQBroker"
>> useEmbeddedBroker="false"/>
>>
>> <Resource name="jms/MyTopic"
>> auth="Container"
>> type="org.apache.activemq.command.ActiveMQTopic"
>> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> physicalName="MY.TEST.FOO"/>
>>
>> <Resource name="jms/MyQueue"
>> auth="Container"
>> type="org.apache.activemq.command.ActiveMQQueue"
>> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
>> physicalName="MY.TEST.BAR"/>
>>
>> </Context>
>>
>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/Postgres-persistence-in-Tomcat-tf2225497.html#a6186145
Sent from the ActiveMQ - User forum at Nabble.com.
Re: Postgres persistence in Tomcat
Posted by Adrian Co <ac...@exist.com>.
Hi,
One way I could think of is to configure your broker using an external
config file (i.e. activemq.xml) and just change the dataSource of the
persistence adapter to postgres. Example:
https://svn.apache.org/repos/asf/incubator/activemq/trunk/assembly/src/release/conf/activemq.xml
Just uncomment the postgres-ds bean and uncomment the reference in the
persistence adapter.
And use that config file to configure your embedded broker. i.e.
brokerURL="vm://localhost?brokerConfig=xbean:activemq.xml" <- assuming
activemq.xml is in the classpath
or
brokerURL="vm://localhost?brokerConfig=xbean:file:c:/activemq.xml" <-
for file path referencing
Hope this helps.
Regards,
Adrian Co
petera wrote:
> Hi,
>
> I am using ActiveMQ 4.0.1 running under Tomcat 5.5.17. I would like to
> persist the messages to a Postgres database rather than the default
> apache-derby database.
>
> What additional config parameters do I need to set in my context.xml file.
>
>
> TIA Peter
>
>
> context.xml:
>
> <Context antiJARLocking="true">
>
> <Resource
> name="jms/ConnectionFactory"
> auth="Container"
> type="org.apache.activemq.ActiveMQConnectionFactory"
> description="JMS Connection Factory"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> brokerURL="vm://localhost"
> brokerName="LocalActiveMQBroker"
> useEmbeddedBroker="false"/>
>
> <Resource name="jms/MyTopic"
> auth="Container"
> type="org.apache.activemq.command.ActiveMQTopic"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> physicalName="MY.TEST.FOO"/>
>
> <Resource name="jms/MyQueue"
> auth="Container"
> type="org.apache.activemq.command.ActiveMQQueue"
> factory="org.apache.activemq.jndi.JNDIReferenceFactory"
> physicalName="MY.TEST.BAR"/>
>
> </Context>
>
>
>