13 Replies Latest reply on Aug 31, 2016 5:41 AM by Prameela Podigiri

    How can I lookup infinispan which is embedded in JBoss AS 7?

    Insuk Cho Newbie

      Hi, guys.

       

      I'm really new for using JBoass AS 7 and Infinispan..

       

      Let me explain what I want to do and what I did for this..

       

      I use QuickStart sample project form here ( http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/helloworld-jdg/)

       

      and I want to use embedded Infinispan which is configured in  standalone-ha.xml  file rather than using defaultCache which is written in sample programmatically.

       

      So, I decided to use "JNDI" for lookup embedded infinispan, and refer serverl lins, and I change below things..

       

      1. standalone-ha.xml file in JBoss AS 7 : add start="EAGER" in container and cache setting and put jndi name, refer

       

      <cache-container name="cluster" aliases="ha-partition" default-cache="default" jndi-name="infinispan/container" start="EAGER">

           <transport lock-timeout="60000"/>

           <replicated-cache name="default" mode="SYNC" start="EAGER" batching="true" jndi-name="MyCache">

                <locking isolation="REPEATABLE_READ"/>

           </replicated-cache>

      </cache-container>

       

       

      2. remove create cache with sample's "jgroups-udp.xml" programmatically, and use @Resource(lookup="~~") to lookup embedded Infinspan

       

       

          @Resource(lookup="java:jboss/infinispan/container")

          private DefaultCacheManager manager;

       

      ##>> But, after that, when I call sample page, I meet IllegalArgumentException log.. like this..

       

       

      15:37:28,676 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/jboss-as-helloworld-jdg].[FacesServlet]] (http--10.240.173.80-

      8080-2) Servlet.service() for servlet FacesServlet threw exception: java.lang.IllegalArgumentException: Can not set org.jboss.as.clustering.infinispan

      .DefaultEmbeddedCacheManager field org.jboss.as.quickstarts.datagrid.MyCacheManagerProvider.manager to org.jboss.as.clustering.infinispan.DefaultEmbed

      dedCacheManager

              at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164) [rt.jar:1.7.0_21]

              at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168) [rt.jar:1.7.0_21]

              at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81) [rt.jar:1.7.0_21]

              at java.lang.reflect.Field.set(Field.java:680) [rt.jar:1.7.0_21]

              at org.jboss.weld.introspector.jlr.WeldFieldImpl.set(WeldFieldImpl.java:88) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:136) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.util.Beans.injectEEFields(Beans.java:639) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:160) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.as.quickstarts.datagrid.MyCacheManagerProvider$Proxy$_$$_WeldClientProxy.getCacheManager(MyCacheManagerProvider$Proxy$_$$_WeldClientProxy.java) [classes:]

              at org.jboss.as.quickstarts.datagrid.Resources.getDefaultCacheManager(Resources.java:46) [classes:]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]

              at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]

              at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:133) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:299) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.jboss.as.quickstarts.datagrid.PutController$Proxy$_$$_WeldClientProxy.getKey(PutController$Proxy$_$$_WeldClientProxy.java) [classes:]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]

              at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]

              at javax.el.BeanELResolver.getValue(BeanELResolver.java:302) [jboss-el-api_2.2_spec-1.0.0.Final.jar:1.0.0.Final]

              at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at org.apache.el.parser.AstValue.getValue(AstValue.java:169) [jbossweb-7.0.13.Final.jar:]

              at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.component.UIOutput.getValue(UIOutput.java:169) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.render.Renderer.encodeChildren(Renderer.java:168) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.event(JBossWebContext.java:67)

              at org.jboss.modcluster.container.jbossweb.JBossWebContext$RequestListenerValve.invoke(JBossWebContext.java:48)

              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

              at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]

       

       

       

       

      I think I don't understand how does it work exactly, I tried a lot of thing but I cannot find solution..

       

      After that, I will add my own listener to handle data evantually..

       

      I think you guys can help me right away..

       

      If you have any question, please let me know..

       

      Thank you very much!!

        • 1. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
          Martin Gencur Novice

          Hello Insuk,

          I believe you need to inject EmbeddedCacheManager, not DefaultCacheManager. Look at this example: https://github.com/infinispan/infinispan-quickstart/blob/master/jboss-as7

           

          Martin

          • 2. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
            Insuk Cho Newbie

            Hi, Martin.

             

            I just tried to change DefaultCacheManager to EmbeddedCacheManager like this..

             

             

                @Resource(lookup="java:jboss/infinispan/container")

            //    private DefaultCacheManager manager;

                private EmbeddedCacheManager manager;

             

             

             

            but still got same exception.

             

            java.lang.IllegalArgumentException: Can not set org.infinispan.manager.EmbeddedCacheManager field org.jboss.as.quickstarts.datagrid.MyCacheManagerProvider.manager to org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager

            sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)

            sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)

            sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)

            java.lang.reflect.Field.set(Field.java:680)

            org.jboss.weld.introspector.jlr.WeldFieldImpl.set(WeldFieldImpl.java:88)

            org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:136)

            org.jboss.weld.util.Beans.injectEEFields(Beans.java:639)

            org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:160)

            org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)

            org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157)

            org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131)

            org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153)

            org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290)

            org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)

            org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)

            org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)

            org.jboss.as.quickstarts.datagrid.MyCacheManagerProvider$Proxy$_$$_WeldClientProxy.getCacheManager(MyCacheManagerProvider$Proxy$_$$_WeldClientProxy.java)

            org.jboss.as.quickstarts.datagrid.Resources.getDefaultCacheManager(Resources.java:46)

            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            java.lang.reflect.Method.invoke(Method.java:601)

            org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

            org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

            org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

            org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

            org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

            org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137)

            org.jboss.weld.bean.ProducerMethod$1.produce(ProducerMethod.java:133)

            org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:299)

            org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:61)

            org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:616)

            org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:681)

            org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:118)

            org.jboss.weld.util.Beans.injectBoundFields(Beans.java:703)

            org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:712)

            org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:161)

            org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)

            org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157)

            org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131)

            org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153)

            org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:290)

            org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)

            org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)

            org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79)

            org.jboss.as.quickstarts.datagrid.PutController$Proxy$_$$_WeldClientProxy.getKey(PutController$Proxy$_$$_WeldClientProxy.java)

            sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

            sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

            sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

            java.lang.reflect.Method.invoke(Method.java:601)

            javax.el.BeanELResolver.getValue(BeanELResolver.java:302)

            com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)

            com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)

            org.apache.el.parser.AstValue.getValue(AstValue.java:169)

            org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)

            org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)

            com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)

            javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)

            javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)

            javax.faces.component.UIOutput.getValue(UIOutput.java:169)

            com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)

            com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)

            com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)

            javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)

            com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)

            com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)

            com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)

            javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)

            javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)

            javax.faces.render.Renderer.encodeChildren(Renderer.java:168)

            javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)

            javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)

            javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)

            com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)

            com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)

            javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)

            com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)

            com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

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

            org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)

             

             

            I think I don't konw how "DefaultEmbeddedCacheManager" is worikng with injection..:<

             

            Anyway, thanks. If you have any other opinion, just let me know..

             

            See you~

            • 3. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
              Insuk Cho Newbie

              Martin.. I have question for your comment.

              Martin Gencur wrote:

               

              Hello Insuk,

              I believe you need to inject EmbeddedCacheManager, not DefaultCacheManager. Look at this example: https://github.com/infinispan/infinispan-quickstart/blob/master/jboss-as7

               

              Martin

               

              Refer that link, I can see Controller.java  and I see below code..

               

                 @Inject

                 transient AdvancedCache<Object, Object> cache;

               

              But I cannot find where this AdvancedCache was prodcued.. it is not inside Resources.java code..

               

              Actually, I'm really new for CDI also, but I know Spring's DI correctly..

               

              Can you explain this for me?

               

              Regards,

              Insuk Cho.

              • 4. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                Martin Gencur Novice

                Hi,

                have you tried to use the default jndi path? According to the example? It's strange that it does not work. Another option could be to try to inject org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager instead of org.infinispan.manager.EmbeddedCacheManager

                 

                Re: your last question....this is done behind the scenes by the infinispan-cdi module's functionality which is a dependency of the project :

                <dependency>

                     <groupId>org.infinispan</groupId>

                     <artifactId>infinispan-cdi</artifactId>

                     <version>${infinispan.version}</version>

                </dependency>

                 

                You can read more about it in Infinispan's online documentation (CDI section)

                1 of 1 people found this helpful
                • 5. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                  Tristan Tarrant Master

                  Hmm, how are you packaging your application ? You are attempting to use the infinispan cache manager created by the AS subsystem, so you cannot package the infinispan jars in your application, but import them using the following lines in your MANIFEST.MF:

                   

                   

                  Manifest-Version: 1.0

                  Dependencies: org.infinispan:main services

                  • 6. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                    Insuk Cho Newbie

                    Hi, Martin.. I already tried to do below direction..

                    Another option could be to try to inject org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager instead of org.infinispan.manager.EmbeddedCacheManager

                     

                    But exception was same !!

                     

                    java.lang.IllegalArgumentException: Can not set org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager field org.jboss.as.quickstarts.datagrid.MyCacheManagerProvider.manager to org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager

                     

                    I think when I tried to inject embedded cache, CDI put embedded cache as a field of DefaultEmbeddedCacheManager's creator method..

                     

                    But interest thing is.. DefaultEmbeddedCacheManager's object was created when JBoss AS 7 initializing..

                    This mean.. I don't need to make same object again.. and my sample project tried to create DefaultEmbeddedCacheManager's object again and again.

                     

                    I will try to figure out and let you know the result..

                     

                    Thank you a lot!!

                    • 7. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                      Insuk Cho Newbie

                      Hi, Tristan.

                       

                      Thanks for advice. I fixed my issues!!!

                       

                      I didn't care about MANIFEST.MF file, and this contents are mentioned in this link..

                       

                      https://docs.jboss.org/author/display/ISPN/Getting+Started+Guide+-+JBoss+AS+7

                       

                      So, I just add maifestEntries configuration in maven-war-plugin and it is working correctly as I want..

                       

                          <plugin>

                            <artifactId>maven-war-plugin</artifactId>

                            <version>2.1.1</version>

                            <configuration>

                              <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->

                              <failOnMissingWebXml>false</failOnMissingWebXml>

                              <archive>

                                <manifestEntries>

                                  <Dependencies>org.infinispan export</Dependencies>

                                </manifestEntries>

                              </archive>

                            </configuration>

                          </plugin>

                       

                       

                      Thank you very much!! This time, I learned about CDI and how infinispan is loaded in JBoss AS 7.

                       

                      Best Regards,

                      Insuk Cho


                      • 8. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                        Jithendra reddy Newbie

                        Hi Insuk,

                         

                        I am also trying the same thing that you did. Facing the same exception as you did. But have the manifest entry that you gave above in my pom too. Still getting that error.

                         

                        Do you have the infinispan-cdi dependency in your pom.xml?? I have it in mine.

                         

                        Please respond.

                         

                        Regards

                        Jithendra

                        • 9. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                          Insuk Cho Newbie

                          Hi, Jithendra.

                           

                          Yeh, I have that configuration in my pom.xml.

                           

                           

                          <!-- Import the CDI API, we use provided scope as the API is included in JBoss AS 7 -->
                          <dependency>
                              <groupId>javax.enterprise</groupId>
                              <artifactId>cdi-api</artifactId>
                              <scope>provided</scope>
                          </dependency>

                           

                           

                          I didn't remove any configuration what I got from sample project.

                           

                          I hope you can fix it..

                           

                          Anyway.. I just tried to use configuration in JBoss AS7 configuration, but it was too much effort, and a few reference to find..

                          So, I recommand to use Infinispan configuration file, and call from your source..

                           

                          Most of reference is based on Infinispan pure configuration.. try it.

                           

                          Best Regards,

                          Insuk Cho

                          • 10. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                            Jithendra reddy Newbie

                            Thanks for the response Insuk.

                             

                            The entry that you have above is the javaee cdi dependency and not infinispan-cdi's.

                             

                            My project requirement is to use the infinispan caching as provided by the jboss AS7. I was able to use the infinispan confguration with no issues. But it's the jboss AS7 infinispan that's needed. I need to fix this somehow.

                             

                            I will update this same post if i get to fix it.

                             

                            Thanks again.

                             

                            I agree, way less references for this.

                             

                            Regards

                            Jithendra

                            • 11. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                              Jithendra reddy Newbie

                              Hi Insuk,

                               

                              I could not resolve it on the EAP 6.0.1, but we had plans to move on to EAP 6.1. I thought i will give it a try and it was good try. The same code works great on the EAP 6.1 with no issues.

                               

                              I am now able to use the EmbeddedCacheManager for getting reference to the cache on the EAP 6.1 server and also let Infinispan-cdi use the same cache manager instance. Cool!!

                               

                              For the records, this the producer method i am using and that works.

                               

                              @SuppressWarnings("unused")

                                     @Produces

                                     @Dependent

                                     @Default

                                     @Resource(lookup="java:jboss/infinispan/<container name>")

                                     public EmbeddedCacheManager container;

                               

                              Just wanted to update you.

                               

                              Regards

                              Jithendra

                              • 12. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                                Insuk Cho Newbie

                                Dear Jithendra.

                                 

                                Thank you for reply.

                                 

                                Next tiem, I will try it ^_^

                                 

                                Let's keep in touch~!!

                                 

                                Best Reagrds,

                                Insuk Cho.

                                • 13. Re: How can I lookup infinispan which is embedded in JBoss AS 7?
                                  Prameela Podigiri Newbie

                                  Hi Team,

                                   

                                    Jboss "CacheContainer" is loading on start of jboss server but how to inject or load "CacheContainer" using junit.I am using switchyard juint application.Please find the attached piece of code.

                                  @RunWith(SwitchYardRunner.class)

                                  @SwitchYardTestCaseConfig(config = "META-INF/switchyard.xml",mixins = {CDIMixIn.class,PropertyMixIn.class})

                                  public class FMJobReaderJunit {

                                  //logic

                                  }

                                   

                                  and

                                   

                                  @javax.annotation.Resource(lookup = "java:jboss/infinispan/AORFMMBAActiveAlarmStore")

                                    private org.infinispan.manager.CacheContainer container;

                                   

                                  while running this class as "Run as Junit" - container value becomes null in my class.
                                  Kindly help me to resolve this issue

                                   

                                  Thanks

                                  -Prameela