I am embedding an ActiveMQ broker directly inside an app (long story).  I am
doing so explicitly with Java code (i.e., "broker = new BrokerService();",
etc.).  I would like to completely avoid any writing of files when
performing normal JMS tasks, such as sending and receiving messages (again,
long story... access control issues).  [This may change later, but for now,
I am trying to avoid disk use.  Persistence is not a concern.]  I do this to
create/start the broker:

        m_broker = new BrokerService();
        m_broker.setBrokerName(S_STR_BROKER_NAME);
        m_broker.addConnector("vm://" + S_STR_BROKER_NAME);
        m_broker.setUseJmx(false);
        m_broker.setPersistent(false);
        m_broker.setPersistenceAdapter(null);
        m_broker.start();

However, when I start the broker, I see the following log output:

INFO [main]: ActiveMQ 5.0.0 JMS Message Broker (mainbroker) is starting
INFO [main]: For help or more information please see:
http://activemq.apache.org/
INFO [main]: AMQStore starting using directory: activemq-data/mainbroker
INFO [main]: Kaha Store using data directory
activemq-data/mainbroker/kr-store/state
INFO [main]: Active data files: []
WARN [main]: The ReferenceStore is not valid - recovering ...
INFO [main]: Kaha Store successfully deleted data directory
activemq-data/mainbroker/kr-store/data
INFO [main]: Journal Recovery Started from: DataManager:(data-)
INFO [main]: Recovered 0 operations from redo log in 0.015 seconds.
INFO [main]: Finished recovering the ReferenceStore
INFO [main]: Using Persistence Adapter: MemoryPersistenceAdapter
INFO [main]: Kaha Store using data directory
activemq-data/mainbroker/kr-store/data
INFO [main]: Connector vm://mainbroker Started
INFO [main]: ActiveMQ JMS Message Broker (mainbroker,
ID:yurik2.engr.akamai.com-54085-1207691353487-0:0) started

So, on the one hand, it is using MemoryPersistenceAdapter (as I want, I
think), but also it's initializing some Kaha stuff (and also Journal
stuff... not sure if that's separate or the same thing) -- which I'd rather
it not do, if possible.

Later, when the in-VM client (which, unlike the above broker initialization
code, is constrained by rather strict security rules about file writing)
does a JMS send(), I get a security exception:

javax.jms.JMSException: access denied (java.io.FilePermission
activemq-data/mainbroker/kr-store/data read)
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1178)
        at
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1640)
        at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:226)
        at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:240)
        at com.akamai.edgejava.tests.JmsTest.doGet(JmsTest.java:142)
__NOTE__ This is where I do send().
        ...etc...
Caused by: java.security.AccessControlException: access denied
(java.io.FilePermission activemq-data/mainbroker/kr-store/data read)
        at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
        at
java.security.AccessController.checkPermission(AccessController.java:546)
        at
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
        at java.io.File.list(File.java:971)
        at java.io.File.listFiles(File.java:1090)
        at
org.apache.activemq.kaha.impl.data.DataManagerImpl.<init>(DataManagerImpl.java:70)
        at
org.apache.activemq.kaha.impl.KahaStore.getDataManager(KahaStore.java:358)
        at
org.apache.activemq.kaha.impl.KahaStore.getMapContainer(KahaStore.java:221)
        at
org.apache.activemq.store.kahadaptor.KahaReferenceStoreAdapter.getMapReferenceContainer(KahaReferenceStoreAdapter.java:198)
        at
org.apache.activemq.store.kahadaptor.KahaReferenceStoreAdapter.createTopicReferenceStore(KahaReferenceStoreAdapter.java:165)
        at
org.apache.activemq.store.amq.AMQPersistenceAdapter.createTopicMessageStore(AMQPersistenceAdapter.java:414)
        at
org.apache.activemq.broker.region.DestinationFactoryImpl.createDestination(DestinationFactoryImpl.java:114)
        at
org.apache.activemq.broker.region.AbstractRegion.createDestination(AbstractRegion.java:399)
        at
org.apache.activemq.broker.jmx.ManagedTopicRegion.createDestination(ManagedTopicRegion.java:56)
        at
org.apache.activemq.broker.region.AbstractRegion.addDestination(AbstractRegion.java:116)
        at
org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:259)
        at
org.apache.activemq.broker.region.RegionBroker.send(RegionBroker.java:382)
        at
org.apache.activemq.broker.TransactionBroker.send(TransactionBroker.java:224)
        at
org.apache.activemq.broker.BrokerFilter.send(BrokerFilter.java:125)
        at
org.apache.activemq.broker.CompositeDestinationBroker.send(CompositeDestinationBroker.java:95)
        at
org.apache.activemq.broker.MutableBrokerFilter.send(MutableBrokerFilter.java:135)
        at
org.apache.activemq.broker.TransportConnection.processMessage(TransportConnection.java:434)
...etc...

It's trying to read "activemq-data/mainbroker/kr-store/data", which is not
allowed for reasons I won't go into here.  Why is it trying to do this Kaha
stuff, if I want memory persistence only?  Is there a way to disable this?

Thank you so much.
-- 
View this message in context: 
http://www.nabble.com/completely-disabling-Kaha-Store-tp16575091s2354p16575091.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to