1 Reply Latest reply on Oct 6, 2014 5:06 AM by Tristan Tarrant

    InstantiationError: org.infinispan.configuration.parsing.Namespace

    sj 86 Newbie

      Hi i am new to infinispan tree cache. I am trying to connect to the database using treecache API. infinispan.xml is

                                                                            

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan
        xmlns
      :xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi
      :schemaLocation="urn:infinispan:config:5.2 http://www.infinispan.org/schemas/infinispan-config-5.2.xsd"
        xmlns
      ="urn:infinispan:config:5.2">
      <namedCache name="category">
        
      <loaders passivation="false" shared="false" preload="true">
        
      <loader class="org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore" fetchPersistentState="true" purgeOnStartup="false">
        
      <properties>
        
      <property name="databaseType" value="MYSQL" />
        
      <property name="connectionFactoryClass" value="org.infinispan.loaders.jdbc.connectionfactory.SimpleConnectionFactory" />
        
      <property name="connectionUrl" value="jdbc:mysql://localhost:3306/test" />
        
      <property name="userName" value="root" />
        
      <property name="password" value="root" />
        
      <property name="driverClass" value="com.mysql.jdbc.Driver" />
        
      <property name="stringsTableNamePrefix" value="cache" />
        
      <property name="dropTableOnExit" value="false" />
        
      <property name="createTableOnStart" value="false" />
        
      <property name="timestampColumnName" value="timestamp" />
        
      <property name="timestampColumnType" value="INT8" />
        
      <property name="idColumnName" value="category" />
        
      <property name="idColumnType" value="VARCHAR(255)" />
        
      <property name="dataColumnName" value="id" />
        
      <property name="dataColumnType" value="INTEGER" />
        
      </properties>
        
      </loader>
        
      </loaders>
        
      <transaction transactionMode="TRANSACTIONAL" />
        
      <invocationBatching enabled="true" />
      </namedCache>
      </infinispan>

       

      and tree cache API is

       

      import java.io.IOException;
        
      import org.infinispan.Cache;
        
      import org.infinispan.configuration.cache.ConfigurationBuilder;
        
      import org.infinispan.manager.DefaultCacheManager;
        
      import org.infinispan.tree.TreeCache;
        
      import org.infinispan.tree.TreeCacheFactory;
        
      public class Example {
        
      public static void main(String[] args) throws IOException{
        
      String configFile = "infinispan.xml";  
        
      DefaultCacheManager m = new DefaultCacheManager(configFile);
        
      Cache<String, String> cache = m.getCache();
        
      TreeCache<String, String> tree = new TreeCacheFactory().createTreeCache(cache);

        
      }
        
      }


      I am getting the following error i don't where i am going wrong. any answer will help me a lot.


      log4j:WARN No appenders could be found for logger (org.jboss.logging).
      log4j
      :WARN Please initialize the log4j system properly.
      log4j
      :WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
      Exception in thread "main" java.util.ServiceConfigurationError: org.infinispan.configuration.parsing.ConfigurationParser: Provider org.infinispan.configuration.parsing.Parser51 could not be instantiated
        at java
      .util.ServiceLoader.fail(ServiceLoader.java:224)
        at java
      .util.ServiceLoader.access$100(ServiceLoader.java:181)
        at java
      .util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
        at java
      .util.ServiceLoader$1.next(ServiceLoader.java:445)
        at org
      .infinispan.commons.util.ServiceFinder.addServices(ServiceFinder.java:60)
        at org
      .infinispan.commons.util.ServiceFinder.load(ServiceFinder.java:42)
        at org
      .infinispan.configuration.parsing.ParserRegistry.<init>(ParserRegistry.java:53)
        at org
      .infinispan.configuration.parsing.ParserRegistry.<init>(ParserRegistry.java:47)
        at org
      .infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:261)
        at org
      .infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:234)
        at org
      .infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:221)
        at org
      .infinispan.jboss.Example.main(Example.java:16)
      Caused by: java.lang.InstantiationError: org.infinispan.configuration.parsing.Namespace
        at org
      .infinispan.configuration.parsing.Parser51.<clinit>(Parser51.java:88)
        at sun
      .reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun
      .reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun
      .reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java
      .lang.reflect.Constructor.newInstance(Constructor.java:526)
        at java
      .lang.Class.newInstance(Class.java:374)
        at java
      .util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
        
      ... 9
      more