AbstractProcessor не найден в последовательности - PullRequest
0 голосов
/ 24 октября 2018

У меня есть веб-приложение на Java, и я использую согласованность, чтобы получить итоговый номер выполнения метода в обоих узлах weblogic.Вот конфигурация pof.xml:

<user-type>
        <type-id>1040</type-id>
        <class-name>     com.process.UserMethodKeyUpdateProcessor</class-name>
        <serializer>
            <class-name>com.process.UserMethodKeyUpdateProcessor$Serializer</class-name>
        </serializer>
</user-type>

это файл конфигурации когерентности:

<coherence-application
        xmlns="http://xmlns.oracle.com/coherence/coherence-application">

   <cache-configuration-ref>META-INF/coherence-cache-config.xml</cache-configuration-ref>
   <pof-configuration-ref>META-INF/pof-config.xml</pof-configuration-ref>

</coherence-application>

ниже приведено отображение кэша:

<cache-mapping>
            <cache-name>perDayCountCache</cache-name>
            <scheme-name>perDayCountCache-gar</scheme-name>
        </cache-mapping>

Вот мой процессоркласс, который расширил AbstractProcessor:

public class UserMethodKeyUpdateProcessor extends AbstractProcessor  {
    private UserMethodKey userMethodKey;
    private Integer count;


    public UserMethodKeyUpdateProcessor(UserMethodKey userMethodKey, Integer count) {
        this.userMethodKey = userMethodKey;
        this.count = count;
    }

    @Override
    public Object process(InvocableMap.Entry entry) {

        System.err.println("##UserMetUpdateProcessor process: "+entry);
        UserMethodKey userMethodKey  = (UserMethodKey) entry.getKey();
        System.out.println("#UserMetUpdateProcessor  cache: " + userMethodKey);
        int countCacheRead = (int) entry.getValue();
        System.out.println("## countCacheRead : "+ countCacheRead);
        System.out.println("#UserMetUpdateProcessor ID cache: " + userMethodKey);
        countCacheRead = countCacheRead +1;

        entry.setValue(countCacheRead);
        return "";
    }

    public static class Serializer implements PofSerializer {
        private final int USER_METHOD_KEY= 0;
        private final int COUNT= 1;


        @Override
        public void serialize(PofWriter writer, Object o) throws IOException {
            UserMethodKeyUpdateProcessor processor = (UserMethodKeyUpdateProcessor) o;
            writer.writeObject(USER_METHOD_KEY,processor.userMethodKey);
            writer.writeInt(COUNT,processor.count);

            writer.writeRemainder(null);//important
        }

        @Override
        public Object deserialize(PofReader reader) throws IOException {
            UserMethodKeyUpdateProcessor processor = new UserMethodKeyUpdateProcessor(
                    reader.readObject(USER_METHOD_KEY),
                    reader.readInt(COUNT)
            );

            reader.readRemainder();//important
            return processor;
        }
    }
}

там вы видите использование этого кэша в моем проекте:

 AllowedPerDay allowed = info.getResourceMethod().getAnnotation(AllowedPerDay.class);
        if (allowed.value() > counter) {
            System.out.println("counter before update is : "+ counter);
//            cache.put(userMethodKey, counter + 1);
            System.out.println("counter after update is : "+ counter);
            System.out.println("counter after update is : "+ counter);
            UserMethodKeyUpdateProcessor processor=new UserMethodKeyUpdateProcessor(userMethodKey,counter);// todo process
            cacheUserCount.size();
            cacheUserCount.invoke(userMethodKey, processor);
            return true;
        }

Как только я компилирую свой проект, эта ошибка происходит:

Error:(134, 27) java: cannot access com.tangosol.util.processor.AbstractProcessor
  class file for com.tangosol.util.processor.AbstractProcessor not found

Я не знаю, почему он не находит класс процессора.Точнее, когда я добавляю эту строку в свой метод, происходит ошибка: cacheUserCount.invoke (userMethodKey, processor);более того, когда я удаляю эту строку, кеш работает правильно (правильно печатает его размер).

...