4 Replies Latest reply on Sep 3, 2012 6:03 AM by hchiorean

    Reading and writing to Amazon S3 buckets using Modeshape


      I am having trouble reading and writing to amazon S3 buckets.


      I can see that it is connecing ok because it says soin the logs

      but i can't seem to be able to upload content or read the

      workspace foldr structure.


      Any help will be most appreciated, as i am working to a very tight

      deadline(i have been troubleshooting this issue for 2 weeks now).


      Many Thanks

        • 1. Re: Reading and writing to Amazon S3 buckets using Modeshape

          Can you please provide some information we can use to help you? Which version of ModeShape are you using? Is it deployed in AS7 (if so, which version)? What does your configuration look like? Can you share a repeatable but simple test case that demonstrates the problem? Did you configure S3 any particular way? (It's been a long time since I used S3, so please describe how you did it as if we're all S3 novices and reference S3 documentation where appropriate.)


          Best regards,




          P.S. Several of us are on vacation most of the rest of the week, so response times may be slower this week.

          • 2. Re: Reading and writing to Amazon S3 buckets using Modeshape

            Hi Randall,


            thanks for the prompt response here i have tried to answer your questions as best as i can below (please let me know if any thing else is required....)



            Currently i am using modeshape version 2.8.2.Final (although i also tried with the latest 3.0.0.Beta2 without luck)

            It is not deployed in a JEE container.



            Below is  summary of how modeshape and S3 were configured:

                      -- repository configuration in stated below;

                                mode:source jcr:name="s3-cloud"










                      -- the inifinispan was configured with the following;

                                <?xml version="1.0" encoding="UTF-8"?>

                                <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:infinispan:config:4.0">


                                                    <globalJmxStatistics />

                                                    <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport"



                                                              <!-- properties>

                                                                        <property name="configurationFile" value="s3-jgroups-configuration-test.xml" />

                                                              </properties -->


                                                    <shutdown hookBehavior="DONT_REGISTER" />



                                                    <jmxStatistics enabled="true" />

                                                    <clustering mode="replication">

                                                              <sync replTimeout="20000" />



                                          <namedCache name="S3-Cloud">

                                                    <eviction strategy="LIRS" maxEntries="10" />

                                                    <loaders passivation="false" shared="false" preload="true">

                                                              <loader class="org.infinispan.loaders.cloud.CloudCacheStore" fetchPersistentState="false" ignoreModifications="false"  purgeOnStartup="false">


                                                                                  <property name="identity" value="********************" />

                                                                                  <property name="password" value="********************" />

                                                                                  <property name="bucketPrefix" value="*****-static-content" />

                                                                                  <property name="requestTimeout" value="20000" />

                                                                                  <property name="cloudService" value="s3" />


                                                                        <async enabled="true" flushLockTimeout="15000" threadPoolSize="10" />






                      -- and here is a basic test i am trying to run to add content;

                                try {

                                          Node rootNode = null;

                                          rootNode = session.getRootNode();

                                          assert rootNode != null;


                                          Node folderNode = null;

                                          folderNode = rootNode.getNode("assets");

                                          assert folderNode != null;


                                          Node fileNode = null;

                                          fileNode = folderNode.addNode("sample-image.gif");              



                                          Node contentNode = null;

                                          contentNode = fileNode.addNode("jcr:content","nt:resource");                     

                                          contentNode.setProperty("jcr:data", session.getValueFactory().createBinary(new FileInpuStream(new File("sample-image.gif"));

                                          contentNode.setProperty("jcr:mimeType", "image/gif);

                                          contentNode.setProperty("jcr:lastModified", Calendar.getInstance());  

                                          contentNode.setProperty("jcr:lastModifiedBy", "username");                               








            many thanks

            Jide Esan

            • 3. Re: Reading and writing to Amazon S3 buckets using Modeshape

              I can suggest two things.


              First, ModeShape 2.x provides two different connectors to Infinispan: one for Infinispan 4.x and the second is for Infinispan 5.x (the latter changed the public API and requires different code). Configuration and usage is basically identical, but they are in different Maven artifacts - modeshape-connector-infinispan for Infinispan 4.x, and modeshape-connector-infinispan-5 for Infinispan 5.x. (If you're using JARs, the JAR names follow the same naming pattern). Be sure your application uses the right one for the version of Infinispan you're using.) For details, see our 2.8 documentation. Where possible, use Infinispan 5.x and ModeShape's 5.x connector.


              If you are still having trouble after having sorted out your connector and classpath, I'd try writing a simple test case (or application) that creates the Infinispan cache using your Infinispan configuration above and puts a simple key-value pair into the cache. That needs to work to verify your Infinispan configuration is correct before adding ModeShape to the equation.

              • 4. Re: Reading and writing to Amazon S3 buckets using Modeshape

                It may be obvious, but I also suggest making sure that the classpath has all the needed ISPN libraries which allow it to run in the cloud (infinispan-cachestore-s3 if running ISPN4 or infinispan-cachestore-cloud if running ISPN5). Also, having a "small" test case which validates the Infinispan configuration only (by using the cache loaders directly) should help.