4 Replies Latest reply on Sep 28, 2017 1:43 AM by valsaraj viswanathan

    java.lang.ClassCastException: org.infinispan.context.impl.NonTxInvocationContext cannot be cast to org.infinispan.context.impl.TxInvocationContext

    valsaraj viswanathan Master

      Caused by: java.lang.ClassCastException: org.infinispan.context.impl.NonTxInvocationContext cannot be cast to org.infinispan.context.impl.TxInvocationContext

      I got this exception in wildfly-8.2 domain with JPA - hibernate L2C enabled. Please help if anyone know the solution.

        • 1. Re: java.lang.ClassCastException: org.infinispan.context.impl.NonTxInvocationContext cannot be cast to org.infinispan.context.impl.TxInvocationContext
          Paul Ferraro Master

          I need more context.  Please post full stack traces.  Is this a single server or a cluster?  What does your infinispan configuration look like?  If a cluster, is your configuration consistent on each server?

          • 2. Re: java.lang.ClassCastException: org.infinispan.context.impl.NonTxInvocationContext cannot be cast to org.infinispan.context.impl.TxInvocationContext
            valsaraj viswanathan Master

            It is a cluster with 3 nodes. One master and 2 salves. Transaction is XA. Here is infinispan settings:

            <subsystem xmlns="urn:jboss:domain:infinispan:2.0">

                            <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server" aliases="singleton cluster">

                                <transport lock-timeout="120000"/>

                                <replicated-cache name="default" batching="true" mode="SYNC">

                                    <locking isolation="REPEATABLE_READ"/>

                                </replicated-cache>

                            </cache-container>

                            <cache-container name="web" default-cache="dist" module="org.wildfly.clustering.web.infinispan">

                                <transport lock-timeout="120000"/>

                                <distributed-cache name="dist" batching="true" mode="ASYNC" owners="2" l1-lifespan="0">

                                    <locking isolation="REPEATABLE_READ" acquire-timeout="300000" concurrency-level="1000"/>

                                    <file-store/>

                                </distributed-cache>

                            </cache-container>

                            <cache-container name="ejb" default-cache="dist" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb">

                                <transport lock-timeout="120000"/>

                                <distributed-cache name="dist" batching="true" mode="ASYNC" owners="2" l1-lifespan="0">

                                    <file-store passivation="true"/>

                                </distributed-cache>

                            </cache-container>

                            <cache-container name="hibernate" default-cache="local-query" module="org.hibernate">

                                <transport lock-timeout="120000"/>

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

                                    <transaction mode="NONE"/>

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

                                    <expiration max-idle="100000"/>

                                </local-cache>

                                <invalidation-cache name="entity" mode="SYNC">

                                    <transaction mode="NON_XA"/>

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

                                    <expiration max-idle="100000"/>

                                </invalidation-cache>

                                <replicated-cache name="timestamps" mode="ASYNC">

                                    <transaction mode="NONE"/>

                                    <eviction strategy="NONE"/>

                                </replicated-cache>

                            </cache-container>

                        </subsystem>

            • 3. Re: java.lang.ClassCastException: org.infinispan.context.impl.NonTxInvocationContext cannot be cast to org.infinispan.context.impl.TxInvocationContext
              Paul Ferraro Master

              This was addressed in a later Infinispan/Hibernate release combination.

              [ISPN-4778] PessimisticLockingInterceptor throws when handling remote clear command - JBoss Issue Tracker

               

              I suggest upgrading to the latest 10.1 release of WildFly.  Neither the WF 8.x nor Infinispan 6.0.x branches are active.

              1 of 1 people found this helpful
              • 4. Re: java.lang.ClassCastException: org.infinispan.context.impl.NonTxInvocationContext cannot be cast to org.infinispan.context.impl.TxInvocationContext
                valsaraj viswanathan Master

                java - Wildfly - Infinispan Transactions configuration - Stack Overflow

                Settings changed to optimistic locking and READ_COMMITTED instead of REPEATABLE_READ.

                <cache-container name="hibernate" default-cache="local-query" module="org.hibernate">

                                    <transport lock-timeout="120000"/>

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

                <locking isolation="READ_COMMITTED"/>

                                        <transaction mode="NONE" locking="OPTIMISTIC"/>

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

                                        <expiration max-idle="100000"/>

                                    </local-cache>

                                    <invalidation-cache name="entity" mode="SYNC">

                <locking isolation="READ_COMMITTED"/>

                                        <transaction mode="NON_XA" locking="OPTIMISTIC"/>

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

                                        <expiration max-idle="100000"/>

                                    </invalidation-cache>

                                    <replicated-cache name="timestamps" mode="ASYNC">

                <locking isolation="READ_COMMITTED"/>

                                        <transaction mode="NONE" locking="OPTIMISTIC"/>

                                        <eviction strategy="NONE"/>

                                    </replicated-cache>

                                </cache-container>

                Is this fine?