5 Replies Latest reply on Feb 4, 2016 9:00 AM by Adrian Nistor

    Problem using continous query in infinispan 8.1

    Udit Mishra Novice

      My client is java hotrod and I have followed tutorials but have not been able to use continous queries. I get java.lang.IllegalStateException: Unknown entity name dbo.Person as exception.

      1. My Person class is in src/dbo package
      2. person.proto file is inside src
      3. PersonMarshaller class is inside src/marshaller package.
      4. my testing class is in src/com/highq/continousquery package.

       

      Hers is the content of person.proto file -

       

      package dbo;


      message Person {

        required string name = 1;

        required int32 age = 2; // no native Date type available in Protobuf

      }

       

      the methods of person.proto file looks something like this -

       

      @Override

      public Class<? extends Person> getJavaClass()

      {

                return Person.class;

      }

       

      @Override

      public String getTypeName()

      {

                return "dbo.Person";

      }


      @Override

      public Person readFrom(org.infinispan.protostream.MessageMarshaller.ProtoStreamReader reader) throws IOException

      {

                String name = reader.readString("name");

                int age = reader.readInt("age");

                return new Person(name, age);

      }

       

      @Override

      public void writeTo(org.infinispan.protostream.MessageMarshaller.ProtoStreamWriter writer, Person person) throws IOException

      {

                writer.writeString("name", person.getName());

        writer.writeInt("age", person.getAge());

      }

       

      and also the snippet from the Test class is -

       

      ConfigurationBuilder cb = new ConfigurationBuilder();

      cb.addServer().host("udit.local.com").port(11222).marshaller(new ProtoStreamMarshaller());

       

      RemoteCacheManager rmc = new RemoteCacheManager(cb.build());

       

      SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(rmc);

      serCtx.registerProtoFiles(FileDescriptorSource.fromResources("person.proto"));

      PersonMarshaller marshaller = new PersonMarshaller();

      serCtx.registerMarshaller(marshaller);

       

      RemoteCache<Object, Object> remoteCache = rmc.getCache("CollaborateDistributedCache1");

      remoteCache.put(1, new Person("Udit Mishra", 23));

       

      I don't understand what I am doing wrong. Kindly guide me.