you should be able to pass config inline (persistent=true or
broker.persistent=true can't remember which one is correct)

another potential solution (i never used this one) would be to use
activemq.xml with xbean: http://activemq.apache.org/broker-xbean-uri.html

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/3/12 Davide Bolognini <[email protected]>

> Hi all,
>
> I would like to create a queue with ActiveMQ and exploit the persistence.
> At
> the same time I wouldn't use Spring and its world. So I developed an
> application like this:
>
> tomee.xml
>  <Resource id="IndexerQueueJmsResourceAdapter"
> type="ActiveMQResourceAdapter">
>     BrokerXmlConfig         =
> broker:(tcp://localhost:61616)?persistent=true
>     ServerUrl               = vm://localhost
>     MaximumRedeliveries     = 4
>     DataSource                          = IndexerQueueDataSource
>   </Resource>
>
>   <Resource id="IndexerQueueDataSource" type="DataSource">
>     JdbcDriver com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
>     JdbcUrl jdbc:mysql://localhost:3306/activemq
>     UserName x
>     Password x
>     JtaManaged true
>     PoolPreparedStatements true
>   </Resource>
>
> [....]
>
> The persistence was so given by MySQL. This application worked very well,
> and I didn't use the file activemq.xml.
>
> But now I would like to move the persistence from MySql to the file system.
> So I would like to use KahaDB. The first step was to remove the DataSource
> in the ActiveMQResourceAdapter. The application worked good, saving the
> messages in the home directory /activemq-data/etc., but the problem is that
> I have an exception starting TomEE
>
> SEVERE: Failed to start ActiveMQ
> java.lang.Exception: ActiveMQFactory.createBroker.InvocationTargetException
>         at
>
> org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:127)
>         at
>
> org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.start(ActiveMQResourceAdapter.java:126)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:1784)
>         at
>
> org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:425)
>         at
> org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:344)
>         at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
>         at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
>         at
> org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:233)
>         at
> org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:130)
>         at
>
> org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:121)
>         at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>         at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>         at
>
> org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
>         at
> org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
>         at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
>         at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
>         at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
> Caused by: java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at
>
> org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:121)
>         ... 21 more
> Caused by: java.lang.IllegalArgumentException: Unknown datasource Default
> Unmanaged JDBC Database
>         at
>
> org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker(ActiveMQ5Factory.java:88)
>         ... 26 more
>
> Following some form posts, I added
>
> DataSource =
>
> (so without explain the source) in the ActiveMQResourceAdapter and the
> exception desappears. However now the messages are not saved.
>
> So the question is: have you any idea to configure the KahaDB persistence
> without using Spring?
>
> Thanks a lot
>
> Davide
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Activemq-KahaDB-tp4661443.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Reply via email to