-
1. Re: InvalidResponseException "Invalid magic number" while using hotrod client
sellhorn Sep 12, 2010 6:49 PM (in response to sellhorn)So I've been trying to get this to work for quite a bit of time and still no luck. One thing that I did do, was to make sure the hotrod server and the other process using infinispan were using the tcp jgroups configuration instead of udp, I was getting some problems with those 2 communicating once in a while (worked when I was connected to a network in VPN, didn't if I was in my local wireless network).
Anyways, the magic number error I get changes everytime I do a put, that is, it always says it expects a1, but the "received 2e" part of the error is different all the time. I notice the A1 magic number comes from HotrodConstants;
I wonder if the problem is that all the nodes I have must have the same marshaller? It seems whatever it is I'm putting on the process using infinispan screws up the hotrod client.
-
2. Re: InvalidResponseException "Invalid magic number" while using hotrod client
sellhorn Sep 13, 2010 9:18 AM (in response to sellhorn)OK, in my RemoteClient, I tried to force the marshaller to be the JBoss marshaller. This didn't change anything at all :-(
Attached is the log I get on the hotrod server. The scenario is; the hotrod server and another infinispan process are happily connected. The infinispan process is putting data in a cache with no problems, and then RemoteClient starts getting and putting and that's when that stack trace in the log appears.
-
hotrod-error.txt.zip 1.9 KB
-
-
3. Re: InvalidResponseException "Invalid magic number" while using hotrod client
mircea.markus Sep 13, 2010 10:21 AM (in response to sellhorn)Is the hotrod client reading a value that was written directly to the cluster (i.e. not via hotrod)? This thing is not supported.
-
4. Re: InvalidResponseException "Invalid magic number" while using hotrod client
mircea.markus Sep 13, 2010 10:22 AM (in response to mircea.markus)ah, nice diagrams BTW - what have you used for it?
-
5. Re: InvalidResponseException "Invalid magic number" while using hotrod client
sellhorn Sep 13, 2010 10:53 AM (in response to mircea.markus)Mircea;
Yes, the hotrod client is trying to read a value that was not put in by a hotrod client. I thought that'd be supported. However, what I really want is for the hotrod clients to just do puts, but be able to access those values in the replicated infinispan cluster.
The diagram was done in MS Office Powerpoint 2010, which finally has decent styles for this type of thing ;-)
UPDATE: Yeah, just doing a put via hotrod blows up too. See I was under the impression that you could have your regular infinispan cluster in place, and use hotrod for lighter weight remote clients, I thought I saw some diagrams from some presentations you had that showed this. So if that's not the case, you can only use RemoteClients if everybody (that puts and gets) is a RemoteClient? That seems a bit limiting no?
-
6. Re: InvalidResponseException "Invalid magic number" while using hotrod client
manik Sep 13, 2010 12:41 PM (in response to sellhorn)Not sure I entirely understand your use case. You have a back-end data grid which is accessible by Hot Rod, correct? If this is the case any test app or load generator should be using one of the Hot Rod endpoints to store values.
-
7. Re: InvalidResponseException "Invalid magic number" while using hotrod client
sellhorn Sep 13, 2010 1:51 PM (in response to sellhorn)All the green nodes work better with regular infinispan clustering capabilities, additionally, the UI node needs to know about updates via listeners.
The remote nodes just need to put data, and the reason I don't want them to join the cluster is that they're very lightweight processes that I don't want participating in the cache cluster (plus they won't be able to multicast, i know i can use tcp though).
I guess my main question is, is it possible to have a regular infinispan cluster, with all of it's capabilities being updated via the main infinispan cache API, while there are other contributing nodes using things like hotrod or the REST server? Is that not possible?
-
8. Re: InvalidResponseException "Invalid magic number" while using hotrod client
sellhorn Sep 14, 2010 5:00 PM (in response to sellhorn)Well, it seems like that to achieve what I have in the diagram I'm going to have to use HTTP/REST clients instead of hotrod. I can have a cluster in infinispan setup and have a REST server and they get along well. When I put data in the cluster I can read that data from my REST client, and when I put data via the REST client I can read that data from the cluster. I also get event notifications on the cluster of REST client puts, which is one of the key features I needed for this.
I'm having some issues reading serialized objects back from the cache via REST, but puts seem to work fine (and in this use case, I really only need to do puts remotely).
I guess my question is, I was thinking RemoteCache was sort of a more optimized and Java based methods of doing what I'm trying to do with the REST API, but I'm getting the impression that's not how you guys meant for it to work? Be nice to hear what your main goals are with hotrod and how it's supposed to interact (if at all) with data in the cluster that is being put by other endpoints that may not be using hotrod at all.
-
9. Re: InvalidResponseException "Invalid magic number" while using hotrod client
mircea.markus Sep 15, 2010 8:07 AM (in response to sellhorn)Right now it isn't. The reason is that HR needs to wrap added entries (at lest) for supporting versioned operations. I think it would be possible to keep all the entries internally in HRs format, and supply a CacheAdapter that knows how to wrap/unwrap them. Or, if the versioned values are not used, to keep everything in the simple format (i.e. not HotRod wrapped values).
Re:listeners, we have plans to add them over HotRod as well.
-
10. Re: InvalidResponseException "Invalid magic number" while using hotrod client
sellhorn Sep 15, 2010 5:53 PM (in response to sellhorn)Mircea;
Basically, why does the REST API not care about the version information and the hotrod one does? They're both remote cache APIs to the cluster, no? It almost seems like they should functional similarly at the conceptual level.
-
11. Re: InvalidResponseException "Invalid magic number" while using hotrod client
galder.zamarreno Sep 23, 2010 12:50 PM (in response to sellhorn)Basically, the REST server takes whatever the REST client passes and puts it in the cache as is, unless it's a application/x-java-serialized-object. This means that you can retrieve it as is by just calling cache.get().
Now, the Hot Rod client, if u talk via RemoteCache, takes whatever you pass and marshalls it to a byte[] unless it's already a byte[]. So, there's a transformation going on there and the resulting byte[] is what gets stored in the cache. Now, for you to call cache.get() and retrieve what you stored, the opposite process needs to happen. So, you need to deserialize that byte[] into an object and then you'll have the equivalent.
The opposite happens if you want to put something via cache.put() and then retrieve it via RemoteCache.get(). Right now, as is, whatever goes into cache.put() needs to be marshalled first so that RemoteCache.get() can retrieve it properly.
Now, what is it that marshall's things here? It's not plain Java Serialization, but instead it's JBoss Marshalling based marshaller, more precisely http://anonsvn.jboss.org/repos/infinispan/trunk/core/src/main/java/org/infinispan/marshall/jboss/GenericJBossMarshaller.java
So, if you can instantiate that and before doing a cache.put(), marshall stuff with that, you'll be able to do RemoteCache.get() without probs. Same viceversa. I know it might be a bit hacky right now but I'm building a demo where I'll have to do something along these lines, so expect to have a more proper solution soon.
-
12. Re: InvalidResponseException "Invalid magic number" while using hotrod client
galder.zamarreno Oct 18, 2010 9:00 AM (in response to galder.zamarreno)FYI, I've created https://jira.jboss.org/browse/ISPN-706 to track this
-
13. Re: InvalidResponseException "Invalid magic number" while using hotrod client
galder.zamarreno Oct 20, 2010 12:02 PM (in response to galder.zamarreno)I have created a wiki explaining what code a client needs to write to access data in Hot Rod server directly. A wrapper for this is what 706 should deliver, but for those that cannot wait, I hope the wiki gives enough pointers to get going: http://community.jboss.org/docs/DOC-15985