The Infinispan libraries included in AS7 are there because they form the foundation of the AS's clustering layer (web sessions, ejb stateful beans, etc) and JPA 2nd level caching. They are not exported by default to user deployments which should in fact package their own versions of the libraries. The REST war file provided in the distribution is only an example of how to use the infinispan-server-rest module to build an application which exposes caches via REST. For a proper implementation of REST within the scope of the AS (i.e. using the Infinispan subsystem, using the AS security layer, etc), look at our server project https://github.com/infinispan/jdg/
Really? The InfiniSpan Getting Started Guide - JBoss AS 7 doesn't say anything about needing to install another instance of InfiniSpan...
Regardless, I downloaded and compiled "jdg" (PITA: I had to manually install 3 packages in my local maven repo). Following the README instructions, I run standalone.sh and point my browser to http://127.0.0.1:8080 and am greeted with a nice page about the REST interface. Note, the startup produces the following message:
WARNING: Security role name REST used in an <auth-constraint> without being defined in a <security-role>
But I haven't been able to PUT or GET any data yet. I've tried many URL variations and always get 403 with no server log, but when trying:
curl -X PUT -d "DATA" -u testUser:testPasswd http://localhost:8080/rest/___defaultcache/foobar
WARN [org.jboss.as.security.RealmUsersRolesLoginModule] (http-/127.0.0.1:8080-1) Invalid or misspelled option: realm
I added a user via add-user.sh. What else could this be?
1 of 1 people found this helpful
You should modify standalone.xml by replacing the following line
<rest-connector virtual-server="default-host" cache-container="local" security-domain="other" auth-method="BASIC" />
<rest-connector virtual-server="default-host" cache-container="local" />
or create the "other" security domain and add users there.
However my suggestion to look at JDG was not intended as "you should use this" , but rather as: JDG provides an implementation of an Infinispan REST endpoint in the context of an AS module.
But what I wanted to stress in particular was: cache containers and caches created by the AS Infinispan subsystem are not really meant to be used by user-deployments directly, but are only there to provide services to other AS subsystems. Although the AS documentation tells you how to access these caches from your apps (by tweaking the MANIFEST.MF file), the recommended way to use Infinispan in your applications is to include the JAR files in your WAR/EAR, so you can use whichever version you want, use all the features that are not distributed as AS modules and provide more detailed configuration.
I was able to access the Jboss Data Grid (jdg) project's Infinispan cache via it's RESTful interface using `curl`:
# curl -X PUT -d "TEST DATA" -u testUser:testPasswd http://localhost:8080/rest/___defaultcache/foobar
# curl -X GET -H "Accept-Type: application/xml" -u testUser:testPasswd http://localhost:8080/rest/___defaultcache/foobar