2017-11-26 17 views
1

SQL Server에서 Ignite 타사 지속성을 구현하려고합니다. 웹 콘솔을 사용하여 Java 모델을 생성했으며 생성 된 유틸리티 및 구성 파일을 아무런 문제없이 실행할 수있었습니다 (LoadCaches 또는 ServerNodeCodeStartup, ServerConfigurationFactory의 구성 사용). 캐시로드 호출이 아무런 문제없이 실행됩니다. executeTransaction의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(); 
    } 
} 

내용 :

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의 CacheConfiguration과 ItemCache의 차이점을 두 번 확인했는데 예기치 않은 문제는 없습니다 (유일한 차이점은 테이블과 필드 이름에 있음). 나는 또한 모델 클래스를 비교했다. 다시 비슷하다. ItemCache의 설정 대 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; 
} 

여기 의 설정을 부착

/** 
* 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; 
} 

모델 클래스 고객

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 + 
     "]"; 
    } 
} 
,369의 오류 수단과 방법을 추적 :

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 + 
     "]"; 
    } 
} 

누군가가 "알 수없는 한 쌍 [platformId = 0, 유형 ID = 123254525] 클래스 org.apache.ignite.IgniteCheckedException"가 무엇인지 설명시겠습니까 항목의 1,363,210

모델 클래스 이 문제의 원인 - 이미 디버그 모드에서 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."); 
    } 

테이블 정의 : loadCaches()에, 나는 정확히하지 뭔가를 넣을 때

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

나는 그것을 재현 할 수 있습니다 캐시의 예상 항목 :

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