JBoss Community

WebApps sharing JPA entities in one cache

created by Björn See in JBoss AS 7 Development - View the full discussion

Hi,

 

i´ve been playing around a while now with trying to deploy several (spring+jpa) web applications in one jboss 7 instance and getting them to share their entities in one infinispan cache.

Each web application ships some jars with it which contain several (maybe the same) POJO entity classes. Every app has its own persistence and application context.

 

I read and learned that in such an environment it is not possible to use one single cache instance. Infinispan creates an instance for each web application which makes the cache mechanism useless for my case.

Now I read about the possibility to use a standalone infinispan cache server and connect it to the JBoss instance as remote cache server. So I tried this configured the JBoss to use a remote-store, started infinispan server and JBoss server but the entities are not cached on the remote server. I also do not see anything from my entities in the jmx console of infinispan.

Here is my configuration:

 

{code:xml}

        <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">

            <cache-container name="hibernate" default-cache="entity" start="EAGER">

                <local-cache name="entity" start="EAGER">

                    <transaction mode="NON_XA"/>

                    <eviction strategy="LRU" max-entries="1000000"/>

                    <expiration max-idle="100000"/>

                    <remote-store socket-timeout="60000">

                        <remote-server outbound-socket-binding="remote-store-hotrod-server"/>

                    </remote-store>

                </local-cache>

                <local-cache name="local-query">

                    <transaction mode="NONE"/>

                    <eviction strategy="LRU" max-entries="1000000"/>

                    <expiration max-idle="100000"/>

                </local-cache>

                <local-cache name="timestamps">

                    <transaction mode="NONE"/>

                    <eviction strategy="NONE"/>

                </local-cache>

            </cache-container>

        </subsystem>

...

    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

        ...

        <outbound-socket-binding name="remote-store-hotrod-server">

            <remote-destination host="127.0.0.1" port="11222"/>

        </outbound-socket-binding>

    </socket-binding-group>

{code}

 

I´m feeling very uncertain with all this cause I did not find any working example for such a scenario. I even did not find an example or description of the configuration for using remote store, infinispan server and JPA.

Maybe someone could give me a hint or link to some documentation or could just tell me, that this is not the right way to solve the problem?!?

 

Thanks in advance,

Ernie

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community