2017-11-26 5 views
1

SQL ServerでIgniteサードパーティパーシステンスを実装しようとしています。 Web Consoleを使用してJavaモデルを生成しましたが、生成されたユーティリティと設定ファイルを問題なく実行できました(LoadCachesまたはServerNodeCodeStartup、ServerConfigurationFactoryの設定で)。キャッシュロードコールは問題なく実行されます。Apache Ignite:IgniteCheckedException:不明なペア

public TestPersistentStore() throws Exception { 
    try (Ignite ignite = Ignition.start(ServerConfigurationFactory.createConfiguration())) { 

     // Auto-close cache at the end of the example. 
     try (IgniteCache<Integer, Customer> cache = ignite.cache("CustomerCache")) { 
      // Make initial cache loading from persistent store. This is a 
      // distributed operation and will call CacheStore.loadCache(...) 
      // method on all nodes in topology. 
      loadCache(cache); 

      // Start transaction and execute several cache operations with 
      // read/write-through to persistent store. 
      executeTransaction(cache); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } finally { 
      // Distributed cache could be removed from cluster only by #destroyCache() call. 
      ignite.destroyCache("CustomerCache"); 
     } 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 
} 

executeTransactionの内容:

private static void executeTransaction(IgniteCache<Integer, Customer> cache) { 
    int id = 1; 

    try (Transaction tx = Ignition.ignite("acmecorp").transactions().txStart()) { 
     Customer val = cache.get(id); 

     System.out.println("Read value: " + val); 

     val = cache.getAndPut(id, new Customer(id, "Isaac", "Newton", "Ixelles")); 

     System.out.println("Overwrote old value: " + val); 

     val = cache.get(id); 

     System.out.println("Read value: " + val); 

     tx.commit(); 
    } 

    System.out.println("Read value after commit: " + cache.get(id)); 
} 

(これらのコード行の多くはCacheJdbcStoreExampleからコピーされた)実行の

結果:

[22:53:35] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=3.5GB] 
>>> Loaded 10 keys with backups in 450ms. 
Read value: Customer [firstName=Isaac, lastName=Newton, address=Ixelles] 
Overwrote old value: Customer [firstName=Isaac, lastName=Newton, address=Ixelles] 
Read value: Customer [firstName=Isaac, lastName=Newton, address=Ixelles] 
Read value after commit: Customer [firstName=Isaac, lastName=Newton, address=Ixelles] 
Read value skipping store (expecting null): null 
Read value with store lookup (expecting NOT null): Customer [firstName=Isaac, lastName=Newton, address=Ixelles] 
Read value skipping store (expecting NOT null): Customer [firstName=Isaac, lastName=Newton, address=Ixelles] 
[22:53:36] Ignite node stopped OK [name=acmecorp, uptime=00:00:00:638] 

だから、これがために働きますお客様テーブル/キャッシュ。

TestPersistentStore2

public TestPersistentStore2() throws Exception { 
    try (Ignite ignite = Ignition.start(ServerConfigurationFactory.createConfiguration())) { 

     // Auto-close cache at the end of the example. 
     try (IgniteCache<Integer, Item> cache = ignite.cache("ItemCache")) { 
      // Make initial cache loading from persistent store. This is a 
      // distributed operation and will call CacheStore.loadCache(...) 
      // method on all nodes in topology. 
      loadCache(cache); 

      // Start transaction and execute several cache operations with 
      // read/write-through to persistent store. 
      executeTransaction(cache); 
     } catch (Exception e) { 
      System.out.println("sumthin happened"); 
      e.printStackTrace(); 
     } finally { 
      // Distributed cache could be removed from cluster only by #destroyCache() call. 
      ignite.destroyCache("ItemCache"); 
     } 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 
} 

TestPersistentStore2#executeTransaction私は、次の例外を取得しかし

private static void executeTransaction(IgniteCache<Integer, Item> cache) { 
     int id = 1; 

     try (Transaction tx = Ignition.ignite("acmecorp").transactions().txStart()) { 
      Item val = cache.get(id); 

      System.out.println("Read value: " + val); 

      val = cache.getAndPut(id, new Item(id, "n", "b", "t", "m", "d")); 

      System.out.println("Overwrote old value: " + val); 

      val = cache.get(id); 

      System.out.println("Read value: " + val); 

      tx.commit(); 
     } 

     System.out.println("Read value after commit: " + cache.get(id)); 

     // Clear entry from memory, but keep it in store. 
     cache.clear(id); 

     // Operations on this cache will not affect store. 
     IgniteCache<Integer, Item> cacheSkipStore = cache.withSkipStore(); 

     System.out.println("Read value skipping store (expecting null): " + cacheSkipStore.get(id)); 

     System.out.println("Read value with store lookup (expecting NOT null): " + cache.get(id)); 

     // Expecting not null, since entry should be in memory since last call. 
     System.out.println("Read value skipping store (expecting NOT null): " + cacheSkipStore.get(id)); 
    } 

を次のように私は、同じコードを使用しますが、他のテーブル/キャッシュ(項目)を使用したいですexecuteTransactionのcache.get(id)呼び出しで:

>>> Loaded 72 keys with backups in 648ms. 
javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Unknown pair [platformId=0, typeId=123254525] 
    at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1312) 
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.cacheException(IgniteCacheProxy.java:2630) 
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.get(IgniteCacheProxy.java:1188) 
    at infoh415.project.test.TestPersistentStore2.executeTransaction(TestPersistentStore2.java:98) 
    at infoh415.project.test.TestPersistentStore2.<init>(TestPersistentStore2.java:69) 
    at infoh415.project.test.TestPersistentStore2.main(TestPersistentStore2.java:130) 
Caused by: class org.apache.ignite.IgniteCheckedException: Unknown pair [platformId=0, typeId=123254525] 
    at org.apache.ignite.internal.util.IgniteUtils.cast(IgniteUtils.java:7229) 
    at org.apache.ignite.internal.util.future.GridFutureAdapter.resolve(GridFutureAdapter.java:258) 
    at org.apache.ignite.internal.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:170) 
    at org.apache.ignite.internal.util.future.GridFutureAdapter.get(GridFutureAdapter.java:139) 
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get0(GridCacheAdapter.java:4499) 
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:4480) 
    at org.apache.ignite.internal.processors.cache.GridCacheAdapter.get(GridCacheAdapter.java:1324) 
    at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.get(IgniteCacheProxy.java:1181) 
    ... 3 more 
Caused by: java.lang.ClassNotFoundException: Unknown pair [platformId=0, typeId=123254525] 
    at org.apache.ignite.internal.MarshallerContextImpl.getClassName(MarshallerContextImpl.java:392) 
    at org.apache.ignite.internal.MarshallerContextImpl.getClass(MarshallerContextImpl.java:342) 
    at org.apache.ignite.internal.binary.BinaryContext.descriptorForTypeId(BinaryContext.java:686) 
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize0(BinaryReaderExImpl.java:1755) 
    at org.apache.ignite.internal.binary.BinaryReaderExImpl.deserialize(BinaryReaderExImpl.java:1714) 
    at org.apache.ignite.internal.binary.BinaryObjectImpl.deserializeValue(BinaryObjectImpl.java:797) 
    at org.apache.ignite.internal.binary.BinaryObjectImpl.value(BinaryObjectImpl.java:143) 
    at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinary(CacheObjectUtils.java:161) 
    at org.apache.ignite.internal.processors.cache.CacheObjectUtils.unwrapBinaryIfNeeded(CacheObjectUtils.java:41) 
    at org.apache.ignite.internal.processors.cache.CacheObjectContext.unwrapBinaryIfNeeded(CacheObjectContext.java:125) 
    at org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinaryIfNeeded(GridCacheContext.java:1734) 
    at org.apache.ignite.internal.processors.cache.GridCacheContext.unwrapBinaryIfNeeded(GridCacheContext.java:1722) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.setResult(GridPartitionedSingleGetFuture.java:645) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.localGet(GridPartitionedSingleGetFuture.java:438) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.mapKeyToNode(GridPartitionedSingleGetFuture.java:324) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.map(GridPartitionedSingleGetFuture.java:212) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.GridPartitionedSingleGetFuture.init(GridPartitionedSingleGetFuture.java:204) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.getAsync0(GridDhtAtomicCache.java:1445) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.access$1600(GridDhtAtomicCache.java:129) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$16.apply(GridDhtAtomicCache.java:513) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache$16.apply(GridDhtAtomicCache.java:511) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.asyncOp(GridDhtAtomicCache.java:806) 
    at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.getAsync(GridDhtAtomicCache.java:511) 
    ... 7 more 
Disconnected from the target VM, address: '127.0.0.1:49513', transport: 'socket' 

私はCustomerCacheとItemCacheのCacheConfigurationの違いを二重チェックしましたが、予期しないことはありません(テーブル名とフィールド名に唯一の差異があります)。私はまた、モデルクラスを比較しました、再び彼らは似ています。 のコンフィグ対

CustomerCacheここの設定を取り付け

/** 
* Create configuration for cache "CustomerCache". 
* 
* @return Configured cache. 
* @throws Exception if failed to create cache configuration. 
**/ 
public static CacheConfiguration cacheCustomerCache() throws Exception { 
    CacheConfiguration ccfg = new CacheConfiguration(); 

    ccfg.setName("CustomerCache"); 
    ccfg.setCacheMode(CacheMode.PARTITIONED); 
    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); 

    CacheJdbcPojoStoreFactory cacheStoreFactory = new CacheJdbcPojoStoreFactory(); 

    cacheStoreFactory.setDataSourceFactory(new Factory<DataSource>() { 
     /** {@inheritDoc} **/ 
     @Override public DataSource create() { 
      return DataSources.INSTANCE_dsSQLServer_Acmecorp; 
     }; 
    }); 

    cacheStoreFactory.setDialect(new SQLServerDialect()); 

    cacheStoreFactory.setTypes(jdbcTypeCustomer(ccfg.getName())); 

    ccfg.setCacheStoreFactory(cacheStoreFactory); 

    ccfg.setReadThrough(true); 
    ccfg.setWriteThrough(true); 

    ArrayList<QueryEntity> qryEntities = new ArrayList<>(); 

    QueryEntity qryEntity = new QueryEntity(); 

    qryEntity.setKeyType("java.lang.Integer"); 
    qryEntity.setValueType("infoh415.project.model.Customer"); 
    qryEntity.setKeyFieldName("customerId"); 

    HashSet<String> keyFields = new HashSet<>(); 

    keyFields.add("customerId"); 

    qryEntity.setKeyFields(keyFields); 

    LinkedHashMap<String, String> fields = new LinkedHashMap<>(); 

    fields.put("firstName", "java.lang.String"); 
    fields.put("lastName", "java.lang.String"); 
    fields.put("address", "java.lang.String"); 
    fields.put("customerId", "java.lang.Integer"); 

    qryEntity.setFields(fields); 

    HashMap<String, String> aliases = new HashMap<>(); 

    aliases.put("customerId", "customer_id"); 
    aliases.put("firstName", "first_name"); 
    aliases.put("lastName", "last_name"); 

    qryEntity.setAliases(aliases); 
    qryEntities.add(qryEntity); 

    ccfg.setQueryEntities(qryEntities); 

    return ccfg; 
} 

/** 
* Create JDBC type for "jdbcTypeCustomer". 
* 
* @param cacheName Cache name. 
* @return Configured JDBC type. 
**/ 
private static JdbcType jdbcTypeCustomer(String cacheName) { 
    JdbcType type = new JdbcType(); 

    type.setCacheName(cacheName); 
    type.setKeyType(Integer.class); 
    type.setValueType("infoh415.project.model.Customer"); 
    type.setDatabaseSchema("dbo"); 
    type.setDatabaseTable("Customer"); 

    type.setKeyFields(new JdbcTypeField(Types.INTEGER, "customer_id", int.class, "customerId")); 

    type.setValueFields(
     new JdbcTypeField(Types.VARCHAR, "first_name", String.class, "firstName"), 
     new JdbcTypeField(Types.VARCHAR, "last_name", String.class, "lastName"), 
     new JdbcTypeField(Types.VARCHAR, "address", String.class, "address") 
    ); 

    return type; 
} 

ItemCache

/** 
* Create configuration for cache "ItemCache". 
* 
* @return Configured cache. 
* @throws Exception if failed to create cache configuration. 
**/ 
public static CacheConfiguration cacheItemCache() throws Exception { 
    CacheConfiguration ccfg = new CacheConfiguration(); 

    ccfg.setName("ItemCache"); 
    ccfg.setCacheMode(CacheMode.PARTITIONED); 
    ccfg.setAtomicityMode(CacheAtomicityMode.ATOMIC); 

    CacheJdbcPojoStoreFactory cacheStoreFactory = new CacheJdbcPojoStoreFactory(); 

    cacheStoreFactory.setDataSourceFactory(new Factory<DataSource>() { 
     /** {@inheritDoc} **/ 
     @Override public DataSource create() { 
      return DataSources.INSTANCE_dsSQLServer_Acmecorp; 
     }; 
    }); 

    cacheStoreFactory.setDialect(new SQLServerDialect()); 

    cacheStoreFactory.setTypes(jdbcTypeItem(ccfg.getName())); 

    ccfg.setCacheStoreFactory(cacheStoreFactory); 

    ccfg.setReadThrough(true); 
    ccfg.setWriteThrough(true); 

    ArrayList<QueryEntity> qryEntities = new ArrayList<>(); 

    QueryEntity qryEntity = new QueryEntity(); 

    qryEntity.setKeyType("java.lang.Integer"); 
    qryEntity.setValueType("infoh415.project.model.Item"); 
    qryEntity.setKeyFieldName("itemId"); 

    HashSet<String> keyFields = new HashSet<>(); 

    keyFields.add("itemId"); 

    qryEntity.setKeyFields(keyFields); 

    LinkedHashMap<String, String> fields = new LinkedHashMap<>(); 

    fields.put("name", "java.lang.String"); 
    fields.put("brand", "java.lang.String"); 
    fields.put("type", "java.lang.String"); 
    fields.put("manufacturer", "java.lang.String"); 
    fields.put("description", "java.lang.String"); 
    fields.put("itemId", "java.lang.Integer"); 

    qryEntity.setFields(fields); 

    HashMap<String, String> aliases = new HashMap<>(); 

    aliases.put("itemId", "item_id"); 

    qryEntity.setAliases(aliases); 
    qryEntities.add(qryEntity); 

    ccfg.setQueryEntities(qryEntities); 

    return ccfg; 
} 

/** 
* Create JDBC type for "jdbcTypeItem". 
* 
* @param cacheName Cache name. 
* @return Configured JDBC type. 
**/ 
private static JdbcType jdbcTypeItem(String cacheName) { 
    JdbcType type = new JdbcType(); 

    type.setCacheName(cacheName); 
    type.setKeyType(Integer.class); 
    type.setValueType("infoh415.project.model.Item"); 
    type.setDatabaseSchema("dbo"); 
    type.setDatabaseTable("Item"); 

    type.setKeyFields(new JdbcTypeField(Types.INTEGER, "item_id", int.class, "itemId")); 

    type.setValueFields(
     new JdbcTypeField(Types.VARCHAR, "name", String.class, "name"), 
     new JdbcTypeField(Types.VARCHAR, "brand", String.class, "brand"), 
     new JdbcTypeField(Types.VARCHAR, "type", String.class, "type"), 
     new JdbcTypeField(Types.VARCHAR, "manufacturer", String.class, "manufacturer"), 
     new JdbcTypeField(Types.VARCHAR, "description", String.class, "description") 
    ); 

    return type; 
} 

お客様のModelクラス

package infoh415.project.model; 

import java.io.Serializable; 

/** 
* Customer definition. 
* 
* This file was generated by Ignite Web Console (11/26/2017, 10:52) 
**/ 
public class Customer implements Serializable { 
    /** */ 
    private static final long serialVersionUID = 0L; 

    private int customerId; 

    /** Value for firstName. */ 
    private String firstName; 

    /** Value for lastName. */ 
    private String lastName; 

    /** Value for address. */ 
    private String address; 

    public Customer(String firstName, String lastName, String address) { 
     this.firstName = firstName; 
     this.lastName = lastName; 
     this.address = address; 
    } 

    public Customer(int customerId, String firstName, String lastName, String address) { 
     this.customerId = customerId; 
     this.firstName = firstName; 
     this.lastName = lastName; 
     this.address = address; 
    } 

    public int getCustomerId() { 
     return customerId; 
    } 

    public void setCustomerId(int customerId) { 
     this.customerId = customerId; 
    } 

    /** 
    * Gets firstName 
    * 
    * @return Value for firstName. 
    **/ 
    public String getFirstName() { 
     return firstName; 
    } 

    /** 
    * Sets firstName 
    * 
    * @param firstName New value for firstName. 
    **/ 
    public void setFirstName(String firstName) { 
     this.firstName = firstName; 
    } 

    /** 
    * Gets lastName 
    * 
    * @return Value for lastName. 
    **/ 
    public String getLastName() { 
     return lastName; 
    } 

    /** 
    * Sets lastName 
    * 
    * @param lastName New value for lastName. 
    **/ 
    public void setLastName(String lastName) { 
     this.lastName = lastName; 
    } 

    /** 
    * Gets address 
    * 
    * @return Value for address. 
    **/ 
    public String getAddress() { 
     return address; 
    } 

    /** 
    * Sets address 
    * 
    * @param address New value for address. 
    **/ 
    public void setAddress(String address) { 
     this.address = address; 
    } 

    /** {@inheritDoc} **/ 
    @Override public boolean equals(Object o) { 
     if (this == o) 
      return true; 

     if (!(o instanceof Customer)) 
      return false; 

     Customer that = (Customer)o; 

     if (firstName != null ? !firstName.equals(that.firstName) : that.firstName != null) 
      return false; 


     if (lastName != null ? !lastName.equals(that.lastName) : that.lastName != null) 
      return false; 


     if (address != null ? !address.equals(that.address) : that.address != null) 
      return false; 

     return true; 
    } 

    /** {@inheritDoc} **/ 
    @Override public int hashCode() { 
     int res = firstName != null ? firstName.hashCode() : 0; 

     res = 31 * res + (lastName != null ? lastName.hashCode() : 0); 

     res = 31 * res + (address != null ? address.hashCode() : 0); 

     return res; 
    } 

    /** {@inheritDoc} **/ 
    @Override public String toString() { 
     return "Customer [" + 
      "firstName=" + firstName + ", " + 
      "lastName=" + lastName + ", " + 
      "address=" + address + 
     "]"; 
    } 
} 
":不明なペア[platformId = 0、タイプID = 123254525]クラスorg.apache.ignite.IgniteCheckedException" エラーを意味し、トレースする方法 項目

package infoh415.project.model; 

import java.io.Serializable; 

/** 
* Item definition. 
* 
* This file was generated by Ignite Web Console (11/26/2017, 10:52) 
**/ 
public class Item implements Serializable { 
    /** */ 
    private static final long serialVersionUID = 0L; 

    private int itemId; 

    /** Value for name. */ 
    private String name; 

    /** Value for brand. */ 
    private String brand; 

    /** Value for type. */ 
    private String type; 

    /** Value for manufacturer. */ 
    private String manufacturer; 

    /** Value for description. */ 
    private String description; 

    public Item(String name, String brand, String type, String manufacturer, String description) { 
     this.name = name; 
     this.brand = brand; 
     this.type = type; 
     this.manufacturer = manufacturer; 
     this.description = description; 
    } 

    public Item(int itemId, String name, String brand, String type, String manufacturer, String description) { 
     this.itemId = itemId; 
     this.name = name; 
     this.brand = brand; 
     this.type = type; 
     this.manufacturer = manufacturer; 
     this.description = description; 
    } 

    public int getItemId() { 
     return itemId; 
    } 

    public void setItemId(int itemId) { 
     this.itemId = itemId; 
    } 

    /** 
    * Gets name 
    * 
    * @return Value for name. 
    **/ 
    public String getName() { 
     return name; 
    } 

    /** 
    * Sets name 
    * 
    * @param name New value for name. 
    **/ 
    public void setName(String name) { 
     this.name = name; 
    } 

    /** 
    * Gets brand 
    * 
    * @return Value for brand. 
    **/ 
    public String getBrand() { 
     return brand; 
    } 

    /** 
    * Sets brand 
    * 
    * @param brand New value for brand. 
    **/ 
    public void setBrand(String brand) { 
     this.brand = brand; 
    } 

    /** 
    * Gets type 
    * 
    * @return Value for type. 
    **/ 
    public String getType() { 
     return type; 
    } 

    /** 
    * Sets type 
    * 
    * @param type New value for type. 
    **/ 
    public void setType(String type) { 
     this.type = type; 
    } 

    /** 
    * Gets manufacturer 
    * 
    * @return Value for manufacturer. 
    **/ 
    public String getManufacturer() { 
     return manufacturer; 
    } 

    /** 
    * Sets manufacturer 
    * 
    * @param manufacturer New value for manufacturer. 
    **/ 
    public void setManufacturer(String manufacturer) { 
     this.manufacturer = manufacturer; 
    } 

    /** 
    * Gets description 
    * 
    * @return Value for description. 
    **/ 
    public String getDescription() { 
     return description; 
    } 

    /** 
    * Sets description 
    * 
    * @param description New value for description. 
    **/ 
    public void setDescription(String description) { 
     this.description = description; 
    } 

    /** {@inheritDoc} **/ 
    @Override public boolean equals(Object o) { 
     if (this == o) 
      return true; 

     if (!(o instanceof Item)) 
      return false; 

     Item that = (Item)o; 

     if (name != null ? !name.equals(that.name) : that.name != null) 
      return false; 


     if (brand != null ? !brand.equals(that.brand) : that.brand != null) 
      return false; 


     if (type != null ? !type.equals(that.type) : that.type != null) 
      return false; 


     if (manufacturer != null ? !manufacturer.equals(that.manufacturer) : that.manufacturer != null) 
      return false; 


     if (description != null ? !description.equals(that.description) : that.description != null) 
      return false; 

     return true; 
    } 

    /** {@inheritDoc} **/ 
    @Override public int hashCode() { 
     int res = name != null ? name.hashCode() : 0; 

     res = 31 * res + (brand != null ? brand.hashCode() : 0); 

     res = 31 * res + (type != null ? type.hashCode() : 0); 

     res = 31 * res + (manufacturer != null ? manufacturer.hashCode() : 0); 

     res = 31 * res + (description != null ? description.hashCode() : 0); 

     return res; 
    } 

    /** {@inheritDoc} **/ 
    @Override public String toString() { 
     return "Item [" + 
      "name=" + name + ", " + 
      "brand=" + brand + ", " + 
      "type=" + type + ", " + 
      "manufacturer=" + manufacturer + ", " + 
      "description=" + description + 
     "]"; 
    } 
} 

のの

Modelクラスは、誰かが何を説明していただけますこの問題の原因 - 私は既にデバッグモードでIgniteコードをステップ実行しようとしました。MarshallerContextImpl#getClassNameの最初の行にMappedName mappedName = cache.get(typeId); Itemにnullを返します。しかし、なぜ私は理解していない。どんな助けもありがとう!ありがとうございました。

更新日: Igniteバージョン使用:ignite-core 2.2。0

更新:loadCacheの内容:項目テーブルの

private static void loadCache(IgniteCache<Integer, Item> cache) { 
     long start = System.currentTimeMillis(); 

     // Start loading cache from persistent store on all caching nodes. 
     //  cache.loadCache(null, ENTRY_COUNT); 
     cache.loadCache(null); 

     long end = System.currentTimeMillis(); 

     System.out.println(">>> Loaded " + cache.size() + " keys with backups in " + (end - start) + "ms."); 
    } 

表の定義:

create table Item 
(
    item_id int not null 
     primary key, 
    name varchar(50) not null, 
    brand varchar(20) not null, 
    type varchar(20) not null, 
    manufacturer varchar(30) not null, 
    description varchar(200) 
) 
+0

問題を再現できませんでした。失敗していない方法ではなく、失敗したメソッドを共有してください。どのIgniteバージョンを使用していますか? – alamar

+0

私はignite-core 2.2.0を使用しています。上記の説明を更新する。 – aol

+0

loadCacheメソッドとItemのテーブル定義が追加されました。私は私のテーブルに予期しないデータがあるかどうかを確認します。 – aol

答えて

1

loadCaches()で、私は正確ではない何かを置くとき、私はそれを再現することができますキャッシュ内のアイテム:

private void loadCache(IgniteCache<Integer, Item> cache, /* Ignite.binary() */ IgniteBinary binary) { 
    // Note the absence of package name here: 
    BinaryObjectBuilder builder = binary.builder("Item"); 
    builder.setField("name", "a"); 
    builder.setField("brand", "B"); 
    builder.setField("type", "c"); 
    builder.setField("manufacturer", "D"); 
    builder.setField("description", "e"); 
    builder.setField("itemId", 1); 

    cache.withKeepBinary().put(1, builder.build()); 
} 

精査のための方法。

+1

私のアイテムテーブルをクリアして、すべてを再挿入しましたが、問題は発生しません。どうしてか分かりません。しかし、ヒントをいただきありがとうございます - それは失敗する原因となっていたテーブルのいくつかの値だった可能性があります。とにかく、チップのおかげで! – aol