11 Replies Latest reply on Jan 6, 2017 1:38 PM by Seto Kaiba

    Problems with query module on WildFly.

    Seto Kaiba Expert

      META-INF/MANIFEST.MF

      Manifest-Version: 1.0

      Dependencies: org.infinispan services, org.infinispan.commons services

      This exception is thrown. It seems that the org.hibernate.search.backend.impl.batch.DefaultBatchBackend coming with infinispan-embedded-query is different from the one coming with hibernate-search-engine in WildFly.

      I make infinispan-embedded-query compile. And it is already packaged in WEB-INF/lib. But it seems that it still uses the one from hibernate-search-engine in WildFly.

      Caused by: java.lang.NoSuchMethodError: org.hibernate.search.backend.impl.batch.DefaultBatchBackend.<init>(Lorg/hibernate/search/engine/integration/impl/ExtendedSearchIntegrator;Lorg/hibernate/search/batchindexing/MassIndexerProgressMonitor;)V

      And also how is the WildFly/EAP Module used? Deploy it or extract it to a specific folder?

        • 1. Re: Problems with query module on WildFly.
          Seto Kaiba Expert

          I extracted the WildFly/EAP Module to modules/system/layers/base.

          Is the correct method to install the module? I try to deploy it in 9990 console. And it doesn't work.

           

          And change the META-INF/MANIFEST.MF to below.

          Manifest-Version: 1.0

          Dependencies: org.infinispan:ispn-8.2 services, org.infinispan.commons:ispn-8.2 services, org.infinispan.cdi:ispn-8.2 services, org.infinispan.query:ispn-8.2 services

          It's successfully deployed.

          • 2. Re: Problems with query module on WildFly.
            Seto Kaiba Expert

            But a new problem occurs.

            org.jboss.resteasy.spi.UnhandledException: javax.ejb.EJBException: org.hibernate.search.exception.SearchException: HSEARCH000278: Can't build query for type 'co.kaiba.blueeyes.model.AdfMetadata' which is neither indexed nor has any indexed sub-types.

            But of course AdfMetadata is indexed. Because it's also used by Hibernate Search with JPA. I'm trying to compare the performance for Infinispan or JPA.

            @Entity
            @Table(name = "adfmetadata", indexes = {
                    @Index(columnList = "latitude,longitude")
            })
            @Indexed
            @Spatial(spatialMode = SpatialMode.HASH)
            public class AdfMetadata {
                @Id
                public String uuid;
                public String name;
                public Date dateTime;
                @Latitude
                @Field
                @NumericField
                public double latitude;
                @Longitude
                @Field
                @NumericField
                public double longitude;
                public double altitude;
                public float bearing;
            }
            

            When I force it to add AdfMetadata to indexedEntity. It reports exception.

            Caused by: org.infinispan.commons.CacheConfigurationException: ISPN000404: The configured entity class co.kaiba.blueeyes.model.AdfMetadata is not indexable. Please remove it from the indexing configuration.

            • 3. Re: Problems with query module on WildFly.
              Seto Kaiba Expert

              If I remove the persistence.xml. Then the AdfMetadata will be able to be indexed.

              But with persistence.xml, the AdfMetadata will be unable to be indexed even I remove the Entity, Table & Id annotations.

               

              GitHub - SetoKaiba/InfinispanQueryTest

              Here's a simple project. You will find that it can be run without exception if you remove the persistence.xml, or just remove the persistence-unit node.

              But it will be with exception if you keep the persistence.xml or keep the persistence-unit node.

               

              I don't think Infinispan should conflict with JPA.

              And also I didn't do anything to the JPA yet.

              • 4. Re: Problems with query module on WildFly.
                Seto Kaiba Expert
                <property name="wildfly.jpa.hibernate.search.module" value="none" />
                

                Add this property. Then the indexing for infinispan query is working.

                But the one for jpa orm is not working anymore.

                Caused by: java.lang.ClassNotFoundException: org.hibernate.search.jpa.Search from [Module "deployment.blueeyes-war-1.0-SNAPSHOT.war:main" from Service Module Loader]

                • 5. Re: Problems with query module on WildFly.
                  Seto Kaiba Expert
                  <property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.6.0.Beta1" />
                  

                  Use this instead of none. Make it use the same version as the infinispan query one. Then it works for both.

                  • 6. Re: Problems with query module on WildFly.
                    Seto Kaiba Expert

                    A small question maybe shouldn't be asked here.

                    org.hibernate:5.2 services

                    I copied the hibernate module to WildFly. And I add this to the dependency. Why does it still use the hibernate core from WildFly?

                    12:03:10,041 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 65) HHH000412: Hibernate Core {5.0.10.Final}

                    • 7. Re: Problems with query module on WildFly.
                      Seto Kaiba Expert

                      I want to use the updated hibernate. So I add this line.

                      <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2" />
                      

                      But it will report exception below.

                      Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype

                      After a test, I found it conflict with the line below. But if I don't add this line. Then JPA won't work with infinispan query. Just take a look at the posts above.

                      <property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.6.0.Beta1" />  
                      

                      Is there a way to make infinispan query work with jpa with latest hibernate?

                      • 8. Re: Problems with query module on WildFly.
                        Seto Kaiba Expert
                        <module name="org.hibernate" slot="5.2" />
                        

                        If I change the modules\system\layers\base\org\hibernate\search\orm\5.6.0.Beta1\modules.xml to add the slot 5.2. Then a new exception is reported.

                        Caused by: org.hibernate.cache.CacheException: HHH025011: Infinispan custom cache command factory not installed (possibly because the classloader where Infinispan lives couldn't find the Hibernate Infinispan cache provider)

                        • 9. Re: Problems with query module on WildFly.
                          Seto Kaiba Expert

                          Hibernate Community • View topic - WildFly and Hibernate module problem.

                          The problem is finally resolved by unify the dependency of Hibernater Search to 5.7 for Infinispan Query and JPA/Hibernate ORM 5.2.

                          And also a small change to standalone.xml of WildFly is required if I use second level cache for JPA/Hibernate ORM 5.2.

                          • 10. Re: Problems with query module on WildFly.
                            Sebastian Łaskawiec Apprentice

                            Hi Seto!

                             

                            I strongly recommend you to use WildFly modules (you should download and unzip them in your WildFly directory). Then add proper dependencies to your MANIFEST.MF (please have a look at this guide how to do it). I'm pretty sure you will need at least org.infinispan.query:ispn-8.2 services (but possibly other modules as well).

                             

                            Thanks,

                            Sebastian

                            • 11. Re: Problems with query module on WildFly.
                              Seto Kaiba Expert

                              Of course. I used the modules. But there're problem with other modules, JPA/Hibernate ORM, Hibernate Search. The version of dependency Hibernate Search is different.

                              Yet, finally fix by the solution I post. Unify the version between Infinispan query and Hibernate ORM for the dependency Hibernate Search. And also set the Hibernate vesion of the second level cache container.

                              And now both the infinispan query and Hibernate Search for JPA are working.