4 Replies Latest reply on Nov 26, 2012 10:37 AM by Kent Watsen

    InfiniSpan REST interface on JBoss AS 7.1.3?

    Kent Watsen Newbie

      Right now I'm using 7.1.3.  Searching for InfiniSpan Jars, I find these:

       

      jboss-as-7.1.3.Final # find . -name "infinispan*.jar"

      ./modules/org/infinispan/cachestore/jdbc/main/infinispan-cachestore-jdbc-5.1.7.Final.jar

      ./modules/org/infinispan/cachestore/remote/main/infinispan-cachestore-remote-5.1.7.Final.jar

      ./modules/org/infinispan/client/hotrod/main/infinispan-client-hotrod-5.1.7.Final.jar

      ./modules/org/infinispan/main/infinispan-core-5.1.7.Final.jar

       

      I'm I right to assume the REST interface isn't included by default?

       

      Assuming that is the case, I checked-out and compiled the InfiniSpan 5.1.7.Final tag.  But searching for the needed Jar, it isn't clear which is needed:

       

      infinispan # find . -name "infinispan*.jar" | grep rest

      ./server/rest/target/infinispan/WEB-INF/lib/infinispan-core-5.1.7.Final.jar

      ./server/rest/target/infinispan/WEB-INF/lib/infinispan-server-core-5.1.7.Final.jar

      ./server/rest/target/infinispan-classes.jar

      ./server/rest/target/infinispan-sources.jar

      ./server/rest/target/infinispan-tests.jar

       

      Searching for Wars, I find this one:

       

      infinispan # find . -name "infinispan*.war" | grep rest

      ./server/rest/target/infinispan.war

       

      But it packages up many Jars that are provided by JBoss already...

       

       

      Pointers would be greatly appreciated!

        • 1. Re: InfiniSpan REST interface on JBoss AS 7.1.3?
          Tristan Tarrant Master

          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/

          • 2. Re: InfiniSpan REST interface on JBoss AS 7.1.3?
            Kent Watsen Newbie

            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

             

            I get:

             

                 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?

            • 3. Re: InfiniSpan REST interface on JBoss AS 7.1.3?
              Tristan Tarrant Master

              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" />

               

              with

               

              <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.

              1 of 1 people found this helpful
              • 4. Re: InfiniSpan REST interface on JBoss AS 7.1.3?
                Kent Watsen Newbie

                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

                TEST DATA

                 

                Cheers,

                Kent