org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException

JBoss Issue Tracker | sridhar reddy | 8 years ago
  1. 0

    I have the following jboss cache xml as below [code] <?xml version="1.0" encoding="UTF-8"?> <jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.0"> <locking isolationLevel="READ_COMMITTED" lockParentForChildInsertRemove="false" lockAcquisitionTimeout="20000" nodeLockingScheme="mvcc" writeSkewCheck="false" concurrencyLevel="500" /> <transaction transactionManagerLookupClass="org.jboss.cache.transaction.GenericTransactionManagerLookup" syncRollbackPhase="false" syncCommitPhase="false" /> <eviction wakeUpInterval="500"> <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm" eventQueueSize="200000"> <property name="maxNodes" value="5000" /> <property name="timeToLive" value="1000" /> </default> <region name="/org/jboss/data1"> <property name="timeToLive" value="2000" /> </region> <region name="/org/jboss/data2" algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="100000"> <property name="maxNodes" value="3000" /> <property name="minTimeToLive" value="4000" /> </region> </eviction> <clustering mode="replication" > <jgroupsConfig configFile="C:/workspace/GridJBCache3/src/config/jgroups.xml" /> </clustering> <loaders passivation="false" shared="false"> <preload> <node fqn="/" /> </preload> <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true" ignoreModifications="true" purgeOnStartup="true"> <properties> cache.jdbc.table.name=jbosscache cache.jdbc.table.create=true cache.jdbc.table.drop=false cache.jdbc.table.primarykey=jbosscache_pk cache.jdbc.fqn.column=fqn cache.jdbc.fqn.type=varchar(255) cache.jdbc.node.column=node cache.jdbc.node.type=bytea cache.jdbc.parent.column=parent cache.jdbc.driver=org.postgresql.Driver cache.jdbc.url=jdbc:postgresql://localhost:5432/facts7 cache.jdbc.user=f7tms cache.jdbc.password=f7tms </properties> </loader> </loaders> </jbosscache> [/code] and jgroups.xml file as below [code] <config> <UDP mcast_addr="${jgroups.udp.mcast_addr:228.10.10.10}" mcast_port="${jgroups.udp.mcast_port:45588}" tos="8" ucast_recv_buf_size="20000000" ucast_send_buf_size="640000" mcast_recv_buf_size="25000000" mcast_send_buf_size="640000" loopback="false" discard_incompatible_packets="true" max_bundle_size="64000" max_bundle_timeout="30" use_incoming_packet_handler="true" ip_ttl="${jgroups.udp.ip_ttl:2}" enable_bundling="true" enable_diagnostics="true" thread_naming_pattern="cl" use_concurrent_stack="true" thread_pool.enabled="true" thread_pool.min_threads="2" thread_pool.max_threads="8" thread_pool.keep_alive_time="5000" thread_pool.queue_enabled="true" thread_pool.queue_max_size="1000" thread_pool.rejection_policy="discard" oob_thread_pool.enabled="true" oob_thread_pool.min_threads="1" oob_thread_pool.max_threads="8" oob_thread_pool.keep_alive_time="5000" oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="Run" /> <PING timeout="2000" num_initial_members="3" /> <MERGE2 max_interval="30000" min_interval="10000" /> <FD_SOCK /> <FD timeout="10000" max_tries="5" shun="true" /> <VERIFY_SUSPECT timeout="1500" /> <BARRIER /> <pbcast.NAKACK use_stats_for_retransmission="false" exponential_backoff="150" use_mcast_xmit="true" gc_lag="0" retransmit_timeout="50,300,600,1200" discard_delivered_msgs="true" /> <UNICAST timeout="300,600,1200" /> <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" max_bytes="1000000" /> <VIEW_SYNC avg_send_interval="60000" /> <pbcast.GMS print_local_addr="true" join_timeout="3000" shun="false" view_bundling="true" /> <FC max_credits="500000" min_threshold="0.20" /> <FRAG2 frag_size="60000" /> - <!-- pbcast.STREAMING_STATE_TRANSFER / --> <pbcast.STATE_TRANSFER /> - <!-- pbcast.FLUSH / --> </config> [/code] My code start the cache as [code] package org.gridgain.examples.jbosscache; import java.io.File; 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; import org.jboss.cache.config.Configuration; import org.jboss.cache.config.parsing.XmlConfigurationParser; import org.jgroups.JChannelFactory; public final class GridJbossCacheManager { /** Cache configuration path relative to GridGain installation. */ public static final String CACHE_CFG_PATH = "C:/workspace/GridJBCache3/src/config/jboss-cache.xml"; /** JGroups configuration path relative to GridGain installation. */ public static final String JGROUPS_CFG_PATH = "C:/workspace/GridJBCache3/src/config/jgroups.xml"; /** JBoss Cache instance. */ private Cache<Long, String> cache = null; /** Cache node for caching example data. */ private Node<Long, String> cacheRoot = null; /** Singleton instance. */ private static GridJbossCacheManager instance = new GridJbossCacheManager(); /** * Gets singleton. * * @return Singleton. */ public static GridJbossCacheManager getInstance() { return instance; } /** * Ensure singleton. */ private GridJbossCacheManager() { // No-op. } public void start() throws GridException { File cacheCfg = new File(CACHE_CFG_PATH); if (cacheCfg == null) { throw new GridException("Failed to find cache configuration file: " + CACHE_CFG_PATH); } File jgroupsCfg = new File(JGROUPS_CFG_PATH); if (jgroupsCfg == null) { throw new GridException("Failed to find jgroups configuration: " + JGROUPS_CFG_PATH); } // Make sure JBoss Cache and GridGain are on the same "wave length". JChannelFactory factory = new JChannelFactory(); //null; try { //factory = new JChannelFactory(jgroupsCfg); factory.setMultiplexerConfig(jgroupsCfg.getCanonicalPath()); } catch (Exception e) { throw new GridException("Failed to start Data Manager.", e); } try { XmlConfigurationParser parser = new XmlConfigurationParser(); // Start JBoss Cache cache with shared JGroups configuration. Configuration svrCfg = parser.parseFile(cacheCfg.getCanonicalPath()); svrCfg.getRuntimeConfig().setMuxChannelFactory(factory); CacheFactory<Long, String> dataFactory = DefaultCacheFactory.getInstance(); // Instantiate and start JBoss Cache. cache = dataFactory.createCache(svrCfg); // Cache node for storing example data. cacheRoot = cache.getRoot().addChild(Fqn.fromString("/")); } catch (Exception e) { throw new GridException("Failed to start Data Manager.", e); } System.out.println("JBoss Cache data manager started."); } } [/code] When i ran this program i am getting the following error [code] Exception in thread "main" Exception: ---------- >>> Type: java.lang.Exception >>> Message: failed parsing C:\workspace\GridJBCache3\src\config\jgroups.xml >>> Stack trace: >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:216) >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:205) >>> at org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:131) >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38) >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58) Caused By: ---------- >>> Type: java.io.IOException >>> Message: invalid XML configuration: XML protocol stack configuration does not start with a '<config>' element; maybe the XML configuration needs to be converted to the new format ? use 'java org.jgroups.conf.XmlConfigurator <old XML file> -new_format' to do so >>> Stack trace: >>> at org.jgroups.JChannelFactory.parse(JChannelFactory.java:476) >>> at org.jgroups.JChannelFactory.parse(JChannelFactory.java:462) >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:213) >>> at org.jgroups.JChannelFactory.setMultiplexerConfig(JChannelFactory.java:205) >>> at org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:131) >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38) >>> at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58) [/code] Now i have added the [code] <protocol_stacks> <stack name="udp" description="Default: IP multicast based stack, with flow control and message bundling"> [/code] to jgroups.xml. When i ran the program, its giving the following error. [code] log4j:WARN No appenders could be found for logger (org.jboss.cache.util.FileLookup). log4j:WARN Please initialize the log4j system properly. Exception in thread "main" org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException at org.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:148) at org.jboss.cache.factories.ComponentRegistry$PrioritizedMethod.invoke(ComponentRegistry.java:1005) at org.jboss.cache.factories.ComponentRegistry.internalStart(ComponentRegistry.java:775) at org.jboss.cache.factories.ComponentRegistry.start(ComponentRegistry.java:629) at org.jboss.cache.invocation.CacheInvocationDelegate.start(CacheInvocationDelegate.java:344) at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:121) at org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:105) at org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:148) at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38) at org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:144) ... 9 more Caused by: org.jboss.cache.CacheException: Failed to create multiplexed channel using stack null at org.jboss.cache.RPCManagerImpl.getMultiplexerChannel(RPCManagerImpl.java:353) at org.jboss.cache.RPCManagerImpl.initialiseChannelAndRpcDispatcher(RPCManagerImpl.java:267) at org.jboss.cache.RPCManagerImpl.start(RPCManagerImpl.java:167) ... 14 more Caused by: java.lang.IllegalArgumentException: stack name and service ID have to be non null at org.jgroups.JChannelFactory.createMultiplexerChannel(JChannelFactory.java:336) at org.jgroups.JChannelFactory.createMultiplexerChannel(JChannelFactory.java:328) at org.jboss.cache.RPCManagerImpl.getMultiplexerChannel(RPCManagerImpl.java:349) ... 16 more [/code]

    JBoss Issue Tracker | 8 years ago | sridhar reddy
    org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException
  2. 0

    [JBCACHE-1484] Jboss cache failed with external jgroups configuration - JBoss Issue Tracker

    jboss.org | 1 year ago
    org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException
  3. 0

    Unable to start cas deployment

    Oracle Community | 4 months ago | 3299837
    org.jboss.cache.CacheException: Unable to invoke method public void org.jboss.cache.RPCManagerImpl.start() on object instance org.jboss.cache.RPCManagerImpl@5a30f739
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    TreeCache issue when creating a new Hibernate session factory

    Stack Overflow | 5 years ago | era
    org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException
  6. 0

    'CacheException: java.lang.reflect.InvocationTargetException' when starting additional nodes in JBoss TCP cluster - Red Hat Customer Portal

    redhat.com | 5 months ago
    org.jboss.cache.CacheException: java.lang.reflect.InvocationTargetException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      stack name and service ID have to be non null

      at org.jgroups.JChannelFactory.createMultiplexerChannel()
    2. JGroups
      JChannelFactory.createMultiplexerChannel
      1. org.jgroups.JChannelFactory.createMultiplexerChannel(JChannelFactory.java:336)
      2. org.jgroups.JChannelFactory.createMultiplexerChannel(JChannelFactory.java:328)
      2 frames
    3. org.jboss.cache
      RPCManagerImpl.start
      1. org.jboss.cache.RPCManagerImpl.getMultiplexerChannel(RPCManagerImpl.java:349)
      2. org.jboss.cache.RPCManagerImpl.initialiseChannelAndRpcDispatcher(RPCManagerImpl.java:267)
      3. org.jboss.cache.RPCManagerImpl.start(RPCManagerImpl.java:167)
      3 frames
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. org.jboss.cache
      DefaultCacheFactory.createCache
      1. org.jboss.cache.util.reflect.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:144)
      2. org.jboss.cache.factories.ComponentRegistry$PrioritizedMethod.invoke(ComponentRegistry.java:1005)
      3. org.jboss.cache.factories.ComponentRegistry.internalStart(ComponentRegistry.java:775)
      4. org.jboss.cache.factories.ComponentRegistry.start(ComponentRegistry.java:629)
      5. org.jboss.cache.invocation.CacheInvocationDelegate.start(CacheInvocationDelegate.java:344)
      6. org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:121)
      7. org.jboss.cache.DefaultCacheFactory.createCache(DefaultCacheFactory.java:105)
      7 frames
    6. org.gridgain.examples
      GridJbossCacheExampleNodeLoader.main
      1. org.gridgain.examples.jbosscache.GridJbossCacheManager.start(GridJbossCacheManager.java:148)
      2. org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.loadNode(GridJbossCacheExampleNodeLoader.java:38)
      3. org.gridgain.examples.jbosscache.GridJbossCacheExampleNodeLoader.main(GridJbossCacheExampleNodeLoader.java:58)
      3 frames