why eviction needs Mbean in standalone environment?
sridhar_ratna Jul 2, 2009 1:20 AMHi,
I am specifying eviction policy for some of the regions in jboss cache.
When i started the cache, its throwing exception that
java.lang.NullPointerException at org.jboss.cache.config.parsing.XmlConfigurationParser2x.getMBeanElement(XmlConfigurationParser2x.java:214)
My configuration file is
<?xml version="1.0" encoding="UTF-8"?> <jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1"> <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" syncRollbackPhase="false" syncCommitPhase="false" /> <locking isolationLevel="REPEATABLE_READ" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="200000" nodeLockingScheme="mvcc" writeSkewCheck="false" useLockStriping="false" concurrencyLevel="500" /> <eviction wakeUpInterval="5000"> <default algorithmClass="org.jboss.cache.eviction.LRUPolicy" eventQueueSize="200000"> <property name="maxNodes" value="10000" /> <property name="timeToLive" value="0" /> </default> <region name="/male" > <property name="maxNodes" value="10000" /> <property name="timeToLive" value="-1" /> <property name="maxAge" value="-1" /> </region> </eviction> <!-- <invocationBatching enabled="true"/> --> <jmxStatistics enabled="true" /> <loaders passivation="false" shared="false"> <preload> <node fqn="/male" /> </preload> <loader class="org.jboss.cache.loader.jdbm.JdbmCacheLoader" async="false" fetchPersistentState="true" ignoreModifications="false"> <properties> location=c:/cache/ncrb </properties> </loader> </loaders> </jbosscache>
and the code fragment is
package com.cmc.facts.grid; import org.apache.log4j.Logger; import org.jboss.cache.Cache; import org.jboss.cache.CacheFactory; import org.jboss.cache.DefaultCacheFactory; import org.jboss.cache.Fqn; import org.jboss.cache.Node; /** * @author sridhar * */ public final class GridJbossCacheManager { public static final String CACHE_CFG_PATH = System.getProperty("jbcachexml.path"); /** JBoss Cache instance. */ private Cache<Long, Object> cache = null; /** Cache node for caching example data. */ private Node<Long, Object> cacheRoot = null; /** Singleton instance. */ private static GridJbossCacheManager instance = null; public static GridJbossCacheManager getInstance() { if (instance == null) { instance = new GridJbossCacheManager(); } return instance; } public void start() { try { CacheFactory<Long, Object> factory = new DefaultCacheFactory<Long, Object>(); cache = factory.createCache(CACHE_CFG_PATH); cache.create(); cache.start(); cacheRoot = cache.getRoot(); } catch (Exception e) { LOG.error(e.getMessage(), e); System.exit(1); } LOG.debug("JBoss Cache data manager started."); } public void stop() { if (cache != null) { cache.stop(); } instance = null; LOG.debug("JBoss Cache data manager stopped."); } public Cache<Long, Object> getCache() { return cache; } public static void main(String[] args) { GridJbossCacheManager cacheMgr = GridJbossCacheManager.getInstance(); cacheMgr.start(); } }
the exception stacktrace is
java.lang.NullPointerException at org.jboss.cache.config.parsing.XmlConfigurationParser2x.getMBeanElement(XmlConfigurationParser2x.java:214) at org.jboss.cache.config.parsing.XmlConfigurationParser2x.parseStream(XmlConfigurationParser2x.java:104) at org.jboss.cache.config.parsing.XmlConfigurationParser2x.parseFile(XmlConfigurationParser2x.java:90) at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:91) at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:77) at com.cmc.facts.grid.GridJbossCacheManager.start(GridJbossCacheManager.java:80) at com.cmc.facts.grid.StartGridJbossCacheNode.main(StartGridJbossCacheNode.java:12)
I am using Jboss 3.1 in a standalone environment.
From the stacktrace, its looking for MBeans. Why does it require Mbeans?
Please help me.
Thanks in advance
Sridhar