0 Replies Latest reply on Jul 29, 2013 4:05 AM by akiortagem

    need help on using Infinispan

    akiortagem

      I am completely new to web development using JBoss AS 7.x and I need help on using Infinispan for caching.

       

      What I need is a step-by-step tutorial on using Infinispan in JBoss AS 7.x and I also need a detailed example. All the other example I found hasn't been helpful so far, so can anyone please help me?

       

      Oh and I use Eclipse Juno for development, and I don't use Maven. The development currently uses JBoss AS standalone mode.

       

      I'm sorry if I sound too demanding, any help will be greatly appreciated

       

      I've managed to create this bean by studying examples on the internet.

       

      import java.util.Date;

      import java.util.Map;

       

      import javax.annotation.PostConstruct;

      import javax.annotation.Resource;

      import javax.faces.application.FacesMessage;

      import javax.faces.context.FacesContext;

      import javax.inject.Named;

      import org.infinispan.Cache;

      import org.infinispan.manager.DefaultCacheManager;

       

      import org.springframework.context.annotation.Scope;

      @Named

      @Scope(value="session")

       

      public class CacheinputBean {

        private String data;

        private String data2;

        DefaultCacheManager m = new DefaultCacheManager();

        Cache<String,String> cache = m.getCache();

       

        public String getData(){

            return(data);

        }

       

        public void setData(){

            this.data=data;

        }

       

        public String inputCache(){

            cache.put("data",data);

            return("show-message");

        }

       

        public String getData2(){

            data2 = cache.get("name");

            return(data2);

        }

      }

       

      But it yields these errors

       

      javax.servlet.ServletException: Error creating bean with name 'cacheinputBean' defined in "/C:/jboss-as-7.1.1.Final/standalone/deployments/agciJobPrime.war/WEB-INF/classes/com/agci/testarea/CacheinputBean.class": Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class : Constructor threw exception; nested exception is java.lang.Error: Unresolved compilation problems:

      The import org.infinispan cannot be resolved

      The import org.infinispan cannot be resolved

      DefaultCacheManager cannot be resolved to a type

      DefaultCacheManager cannot be resolved to a type

      Cache cannot be resolved to a type

      DefaultCacheManager cannot be resolved to a type

      Cache cannot be resolved to a type

      Cache cannot be resolved to a type

       

      javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

      I assumed it's because the org.infinispan class cannot be loaded, referring to this

       

      I added an entry to the MANIFEST.IMF file

       

      like so

       

      Dependencies: org.infinispan export

       

      but it still resulted in the same error, can anyone please help me?