1 2 Previous Next 16 Replies Latest reply on Dec 29, 2013 9:15 AM by furic

    Remote Query on Hotrod client infinispan 6.0.0.CR1

    rhymes_rhymes

      Hi,

      I'm trying to build sample application using Infinispan 6.0.0 CR1 release using remote query API on  hotrod client.When I tried to execute query on RemoteCacheManager using infinispan query we got below exception.

       

      Can someone kindly help for identifying the cause of below exception.

       

      Below are the steps I have followed for query using hotrod client.

      //Creating RemoteCacheManger instance

          ConfigurationBuilder builder = new ConfigurationBuilder();
         Configuration config = builder.addServer().host("localhost")
         .port(11222).marshaller(new ProtoStreamMarshaller()).build();
         delegate = new RemoteCacheManager(config);

       

      //For registration of ProtoBuff marshaller

         InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("Employee.protobin");
         ProtoStreamMarshaller.getSerializationContext(delegate).registerProtofile(is);
           ProtoStreamMarshaller.getSerializationContext(delegate)
         .registerMarshaller(Employee.class, new EmployeeMessageMarshaller());

       

      //Employee.java

      public class Employee{

       

      private int id;

       

      private String name;

       

      private String lastName;

       

      private String firstName;

      //setter and getter methods.

      }

       

      //Employee.proto file

      package com.example.project.model;

       

      message Employee {

       

         required int32 id = 1;

       

         required string name = 2;

        

         required string firstName = 3;

        

         required string lastName = 4;

      }

       

      //Cache Config

      <local-cache name="com.example.project.model.Employee" start="EAGER">

          <indexing index="LOCAL"/>

          <locking isolation="NONE" acquire-timeout="30000" concurrency-level="1000" striping="false"/>

          <transaction mode="NONE"/>

      </local-cache>

       

      //Client log:

      Exception in thread "main" org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for message id[9003] returned server error (status=0x85): java.lang.IllegalStateException: Unknown entity name com.example.project.model.Employee

          at org.infinispan.client.hotrod.impl.protocol.Codec10.checkForErrorsInResponseStatus(Codec10.java:143)

          at org.infinispan.client.hotrod.impl.protocol.Codec10.readHeader(Codec10.java:99)

          at org.infinispan.client.hotrod.impl.operations.HotRodOperation.readHeaderAndValidate(HotRodOperation.java:56)

          at org.infinispan.client.hotrod.impl.operations.QueryOperation.executeOperation(QueryOperation.java:68)

          at org.infinispan.client.hotrod.impl.operations.QueryOperation.executeOperation(QueryOperation.java:26)

          at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:46)

          at org.infinispan.client.hotrod.impl.query.RemoteQuery.executeQuery(RemoteQuery.java:79)

          at org.infinispan.client.hotrod.impl.query.RemoteQuery.list(RemoteQuery.java:69)

       

      //Server log

      12:53:56,881 ERROR [org.infinispan.server.hotrod.HotRodDecoder] (HotRodServerWor

      ker-298) ISPN005003: Exception reported: java.lang.IllegalStateException: Unknown entity name com.example.project.model.Employee

              at org.hibernate.hql.ast.spi.SingleEntityQueryRendererDelegate.setTargetType(SingleEntityQueryRendererDelegate.java:120)

              at org.hibernate.hql.ast.spi.SingleEntityQueryRendererDelegate.registerPersisterSpace(SingleEntityQueryRendererDelegate.java:103)

              at org.hibernate.hql.ast.render.QueryRenderer.entityName(QueryRenderer.java:12325)

              at org.hibernate.hql.ast.render.QueryRenderer.persisterSpaceRoot(QueryRenderer.java:3063)

              at org.hibernate.hql.ast.render.QueryRenderer.persisterSpace(QueryRenderer.java:2955)

              at org.hibernate.hql.ast.render.QueryRenderer.persisterSpaces(QueryRenderer.java:2892)

              at org.hibernate.hql.ast.render.QueryRenderer.fromClause(QueryRenderer.java:2802)

              at org.hibernate.hql.ast.render.QueryRenderer.selectFrom(QueryRenderer.java:2703)

              at org.hibernate.hql.ast.render.QueryRenderer.querySpec(QueryRenderer.java:2181)

              at org.hibernate.hql.ast.render.QueryRenderer.queryExpression(QueryRenderer.java:2105)

              at org.hibernate.hql.ast.render.QueryRenderer.queryStatement(QueryRenderer.java:1744)

              at org.hibernate.hql.ast.render.QueryRenderer.queryStatementSet(QueryRenderer.java:1657)

              at org.hibernate.hql.ast.render.QueryRenderer.statement(QueryRenderer.java:653)

              at org.hibernate.hql.ast.spi.QueryRendererProcessor.process(QueryRendererProcessor.java:51)

              at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:82)       

              at org.infinispan.query.remote.QueryFacadeImpl.executeQuery(QueryFacadeImpl.java:149)

              at org.infinispan.query.remote.QueryFacadeImpl.query(QueryFacadeImpl.java:64)

              at org.infinispan.server.hotrod.Decoder10$.customReadKey(Decoder10.scala:222) [infinispan-server-hotrod-6.0.0.CR1.jar:6.0.0.CR1]

              at org.infinispan.server.hotrod.HotRodDecoder.customDecodeKey(HotRodDecoder.scala:138) [infinispan-server-hotrod-6.0.0.CR1.jar:6.0.0.CR1]

        • 1. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
          anistor

          I see you registered the protobuf schema and entity marshallers with the client's serialization context but I can't see from this snippet if you also registered it on the server. This is required. Sample code here: https://github.com/infinispan/infinispan/blob/6.0.0.CR1/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/… or via JMX here https://github.com/infinispan/infinispan/blob/6.0.0.CR1/client/hotrod-client/src/test/java/org/infinispan/client/hotrod/…

          1 of 1 people found this helpful
          • 2. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
            rhymes_rhymes

            Thank you for reply.

            All the given two examples/test clients are registering either on global configuartion or MBeans located in same JVM.

            But what in case if we have started infinispan server on different JVM.?

            Is there a way we can register the protobuff in server configuration.?Or we have to invoke remote Mbean.?

            • 3. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
              anistor

              No, this is not handled as a server configuration right now. You'll have to invoke the remote mbean.

               

              But, having a config option for preloading a set of configured protobuf descriptors might be a useful thing. Would you consider opening a Jira for this and voting for it? Thanks!

              • 4. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                rhymes_rhymes

                I have few more questions on protobuf server registration

                1. How the protobuf registration will behave if we register to any one active cluster member.?Will the registration propagates to all other active cluster members and also later members who participated in cluster after protobuf registration.?

                2. In a distributed environment, we may have multiple instances of JVM using hotrod clients connecting to grid server.What precedence or order the grid server will take if multiple clients using different version of messsage descriptors for same entity registering to server.?

                • 5. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                  anistor

                  Hi,

                  1. Registering the descriptor on just one member, any member, will replicate it to all other members. The metadata registry is a replicated cluster-wide repository for these protobuf descriptors.

                  2. Last update wins. Currently we do not have the concept of version. I'm afraid this area is a bit under-baked, we also lack persistence for the metadata registry. Both need to be re-addressed thoughtfully.

                  • 6. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                    rhymes_rhymes

                    Thank you for answer.

                     

                    Now I got stuck with the below issue while executing query on remote server.

                     

                    Exception in thread "main" org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for message id[1003] returned server error (status=0x85): org.hibernate.search.SearchException: Can't build query for type org.infinispan.query.remote.indexing.ProtobufValueWrapper which is neither indexed nor has any indexed sub-types.

                        at org.infinispan.client.hotrod.impl.protocol.Codec10.checkForErrorsInResponseStatus(Codec10.java:143)

                        at org.infinispan.client.hotrod.impl.protocol.Codec10.readHeader(Codec10.java:99)

                        at org.infinispan.client.hotrod.impl.operations.HotRodOperation.readHeaderAndValidate(HotRodOperation.java:56)

                        at org.infinispan.client.hotrod.impl.operations.QueryOperation.executeOperation(QueryOperation.java:68)

                        at org.infinispan.client.hotrod.impl.operations.QueryOperation.executeOperation(QueryOperation.java:26)

                        at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:46)

                        at org.infinispan.client.hotrod.impl.query.RemoteQuery.executeQuery(RemoteQuery.java:79)

                        at org.infinispan.client.hotrod.impl.query.RemoteQuery.list(RemoteQuery.java:69)

                    • 7. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                      fwelland

                      So I think I am trying to do the same thing as you(and started following this thread last Fri):   Stand alone infinispan server with remote clients that put cache entries and get them -- but most importantly -- query them (other than by just the key).

                       

                      I too choose 6.0CR1 and am very close to where you are and I too haven been struggling to string it together.   My whole proto-type is here:   https://github.com/fwelland/ISpanPhun.git

                       

                      After getting thru the protobuf schemea  (the jmx remote connection stuff was bit of a pot hole)  on the server as per links above.   I've gotten to this error too:   

                       

                      org.infinispan.client.hotrod.exceptions.HotRodClientException:Request for message id[3] returned server error (status=0x85): org.hibernate.search.SearchException: Can't build query for type org.infinispan.query.remote.indexing.ProtobufValueWrapper which is neither indexed nor has any indexed sub-types.

                        at org.infinispan.client.hotrod.impl.protocol.Codec10.checkForErrorsInResponseStatus(Codec10.java:143)

                        at org.infinispan.client.hotrod.impl.protocol.Codec10.readHeader(Codec10.java:99)

                        at org.infinispan.client.hotrod.impl.operations.HotRodOperation.readHeaderAndValidate(HotRodOperation.java:56)

                        at org.infinispan.client.hotrod.impl.operations.QueryOperation.executeOperation(QueryOperation.java:68)

                        at org.infinispan.client.hotrod.impl.operations.QueryOperation.executeOperation(QueryOperation.java:26)

                        at org.infinispan.client.hotrod.impl.operations.RetryOnFailureOperation.execute(RetryOnFailureOperation.java:46)

                        at org.infinispan.client.hotrod.impl.query.RemoteQuery.executeQuery(RemoteQuery.java:79)

                        at org.infinispan.client.hotrod.impl.query.RemoteQuery.list(RemoteQuery.java:69)

                        at com.fhw.ISpanPhun.search(ISpanPhun.java:148)

                        at com.fhw.ISpanPhun.go(ISpanPhun.java:127)

                        at com.fhw.ISpanPhun.main(ISpanPhun.java:43)

                       

                       

                      I am kinda stumped on this too!    I did notice that my ISPN server spits out the following during startup:

                       

                      16:10:42,204 WARN  [org.infinispan.configuration.cache.IndexingConfigurationBuilder] (MSC service thread 1-16) Indexing can only be enabled if infinispan-query.jar is available on your classpath, and this jar has not been detected. Intended behavior may not be exhibited.

                       

                      Does yours?     I have attempted to put a few ispn query jars in the ISPN-HOME/standalone/lib  and ISPN-HOME/standalone/lib/ext   (well symlinked in both the following:   ISPN-HOME/modules/system/layers/base/org/infinispan/query/main/infinispan-query-6.0.0.CR1.jar

                       

                      If you did fix this WARN -- how?

                      • 8. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                        anistor

                        You need to have infinispan-query.jar in classpath (plus its transitive maven dependencies) for embedded query to work. I assume that's solved already. For remote query you also need to have infinispan-remote-query-server.jar. The error you received indicates this is missing.

                        • 9. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                          anistor

                          I believe your problem is fixed by ISPN-3583 that is already fixed in the yet unreleased CR2.

                          • 10. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                            fwelland

                            Thanks for your response on this.   To clarify (in my case) I have downloaded both ispn server 6.0cr1 and the 'all' distro for ispn. 

                             

                            Server

                            I just tweaked my standalone.xml slightly (adding a local cache entry) and booted it.  All is well.  The WARN messages about ispn-query jar(s) showed up after I added the <indexing  .../>  element (to standalone.xml).   I tried adding the jar to cpath of standalone by putting in lib and lib/ext directory.   This didn't make the message go away.    So the ispn server distro doesn't have this part correct (yet)? 

                             

                            Client

                            It is just a standalone java program.   I have added all jars from the 'lib' dir of the 6.0cr1 distro.  That has at least 4 ispn-query jars and I think/assume all the bits and pieces.  I don't get any messages to stdout about query jars missing.   That should cover it, correct?

                            • 11. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                              fwelland

                              forecast on 6.0 CR2?

                               

                              Backstory:

                              I am prototyping stuff over next few weeks so I can provide stories for a feature team to implement a searchable cache of stuffs for some sprints we want to do in Jan/Feb/March 20114.    We use some 5.x ispn local cache for some strategic data and I am considering it for distributed session management  as alternative to clustering our app servers.     Along the road a search feature in our app showed slowness and I thought ISPN query may also help solve that.    Since session HA instigated my interest in ispn server; I figured it may also be useful for the query/search stuff too?  DGs and caches seem ideal for session HA;  reasonable and simple query abilities may solve my other issues and it would be great to have a single queryable cache/dg tech instead of having 2 techs; a grid/cache/nv store and then maybe a noSql like thing; in my app. 

                               

                              Am I barking up a wrong tree with ispn? 

                              • 12. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                                rhymes_rhymes

                                1. Adding the infinispan-query.jar and infinispan-remote-query-server to classpath or  importing as module doesn't helped at server to avoid the blow WARN message.

                                 

                                     WARN  [org.infinispan.configuration.cache.IndexingConfigurationBuilder] (MSC service thread 1-16) Indexing can only be enabled if infinispan-query.jar is available on your classpath, and this jar has not been detected. Intended behavior may not be exhibited.

                                 

                                2. I believe indexing is done at server and not at client and do we really require infinispan-remote-query-server.jar at client application.?

                                • 13. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                                  rhymes_rhymes

                                  Basically key,value data stores are designed and implemented on fundamental concept where every record can be identified by hash value /" key " of record + can be distributed/ replicated to multiple servers/hosts/jvms(Scalability)

                                  With the increase in demands and change in usage, many new features has to be incorporated in data grids/cache layers (like query using some Query Language, Indexing,Transactions....etc).

                                  Infinispan before 6.0.CR1 has only supported  query on embeded cache managers and indexing using Lucene (OutOfBox)?

                                  Also you have to note that remote query feature in Infinispan is still in experimental phase and not meant for prod usage.

                                  • 14. Re: Remote Query on Hotrod client infinispan 6.0.0.CR1
                                    fwelland

                                    So I pulled the latest and final 6.0 and re-ran my sample and it seems like it is working just fine now.    

                                     

                                    (thanks infinispan peoples!    now to figure out what to do with this).

                                    1 2 Previous Next