-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 15 posts ] 
Author Message
 Post subject: WildFly and Hibernate module problem.
PostPosted: Mon Jan 02, 2017 12:46 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
https://repo1.maven.org/maven2/org/hibe ... al-wildfly
I downloaded hibernate module and extracted to modules/system/layers/base.
Code:
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2" /> 

And add this line to persistence-unit to make it use hibernate 5.2 module. Then it reports the exception below.
Quote:
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.search.hcore.impl.HibernateSearchIntegrator not a subtype


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Mon Jan 02, 2017 1:02 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
It seems that it's caused by another line. This line is required for infinispan query. If I don't insert this line. Then the infinispan query and jpa full text search won't work together.
org.hibernate.search.orm:5.6.0.Beta1 is from infinispan wildfly module.
Code:
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.6.0.Beta1" /> 


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Mon Jan 02, 2017 3:15 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
Code:
<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.
Quote:
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)


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Fri Jan 06, 2017 8:33 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
to use Hibernate ORM 5.2.x you need to use Hibernate Search 5.7.x

I'd suggest to follow the news on our blog when experimenting with the very latest versions:
- http://in.relation.to/2016/12/20/hibern ... 7-0-Beta2/

The compatibility of versions is also mentioned on the downloads page:
- http://hibernate.org/search/downloads/

Do you need Infinispan Query AND Hibernate Search ? I'm afraid the two projects depend on the same hibernate-search-engine module, so these will need to be strictly aligned.

HTH

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Fri Jan 06, 2017 10:19 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
sanne.grinovero wrote:
Hi,
to use Hibernate ORM 5.2.x you need to use Hibernate Search 5.7.x

I'd suggest to follow the news on our blog when experimenting with the very latest versions:
- http://in.relation.to/2016/12/20/hibern ... 7-0-Beta2/

The compatibility of versions is also mentioned on the downloads page:
- http://hibernate.org/search/downloads/

Do you need Infinispan Query AND Hibernate Search ? I'm afraid the two projects depend on the same hibernate-search-engine module, so these will need to be strictly aligned.

HTH


Yes. I need them together.

Hi. Then what about the Hibernate Search compatibility with OGM. It seems that it's not mentioned.
From the docs of OGM 5.1, "The Hibernate Search version tested is 5.5.5.Final" is mentioned.
From the docs of OGM 5.0, "The Hibernate Search version tested is 5.5.3.Final" is mentioned.

Can I set the dependency of Hibernate Search to 5.7.x for ORM, OGM and Infinispan modules?


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Fri Jan 06, 2017 12:21 pm 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
sanne.grinovero wrote:
Hi,
to use Hibernate ORM 5.2.x you need to use Hibernate Search 5.7.x

I'd suggest to follow the news on our blog when experimenting with the very latest versions:
- http://in.relation.to/2016/12/20/hibern ... 7-0-Beta2/

The compatibility of versions is also mentioned on the downloads page:
- http://hibernate.org/search/downloads/

Do you need Infinispan Query AND Hibernate Search ? I'm afraid the two projects depend on the same hibernate-search-engine module, so these will need to be strictly aligned.

HTH


Thank you.
Change the Infinispan query dependency of Hibernate Search to 5.7.
Code:
<module name="org.hibernate.search.engine" slot="5.7" export="true"/>

And change the standalone.xml settings of second level cache of WildFly to hibernate 5.2.
Code:
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan:5.2">

And now they all work well.

No matter the native infinispan query and hibernate search for JPA/Hibernate ORM.
But I didn't test OGM yet. I may need OGM as well for some special use.


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Fri Jan 06, 2017 6:56 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Quote:
But I didn't test OGM yet. I may need OGM as well for some special use.


You're right we're not documenting that explicitly; I'll highlight the need to the team so we can think of improving the docs / webpage.

In the meantime, may I suggest to look into the pom.xml files of each project:

- Hibernate Search is built with a specific version of Hibernate ORM, but does not refer to OGM as its integration has tight coupling with ORM only (OGM is the same as ORM from Search point of view).
So you can find here which version of ORM is being used for a specific Search version:
https://github.com/hibernate/hibernate- ... m.xml#L152

- Hibernate OGM on the other hand does include specific integration tests with Hibernate Search, so given a specific version of OGM you can find both the ORM and Search compatible versions:
https://github.com/hibernate/hibernate- ... ml#L29-L42

As you can see in the previous link, when releasing Hibernate OGM we also release a "BOM" file so you can include that in your project the get the right combination of these dependencies.

N.B. since OGM "consumes" the other projects it is typically a bit behind on versions; for example at this time there isn't yet an OGM version compatible with the combination [Hibernate Search 5.7.x] and [Hibernate ORM 5.2.x].

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sat Jan 07, 2017 1:14 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
sanne.grinovero wrote:
Quote:
But I didn't test OGM yet. I may need OGM as well for some special use.


You're right we're not documenting that explicitly; I'll highlight the need to the team so we can think of improving the docs / webpage.

In the meantime, may I suggest to look into the pom.xml files of each project:

- Hibernate Search is built with a specific version of Hibernate ORM, but does not refer to OGM as its integration has tight coupling with ORM only (OGM is the same as ORM from Search point of view).
So you can find here which version of ORM is being used for a specific Search version:
https://github.com/hibernate/hibernate- ... m.xml#L152

- Hibernate OGM on the other hand does include specific integration tests with Hibernate Search, so given a specific version of OGM you can find both the ORM and Search compatible versions:
https://github.com/hibernate/hibernate- ... ml#L29-L42

As you can see in the previous link, when releasing Hibernate OGM we also release a "BOM" file so you can include that in your project the get the right combination of these dependencies.

N.B. since OGM "consumes" the other projects it is typically a bit behind on versions; for example at this time there isn't yet an OGM version compatible with the combination [Hibernate Search 5.7.x] and [Hibernate ORM 5.2.x].


What if I use OGM with Search 5.7.x and ORM 5.2.x, just like I use Infinispan with Search 5.7.x without problems?
Because I found that only the Infinispan 8.2.0.Final will use Search 5.5.x like OGM.
But OGM BOM specify the Infinispan 8.2.5.Final as the dependency. But Infinispan 8.2.5.Final query need Search 5.6.x.


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sat Jan 07, 2017 5:55 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Sorry but latest OGM will not work with ORM 5.2

Your best option for now is to use an older version of Hibernate ORM, like version 5.1.
We'll soon work on an updated OGM version.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sun Jan 08, 2017 2:17 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
sanne.grinovero wrote:
Sorry but latest OGM will not work with ORM 5.2

Your best option for now is to use an older version of Hibernate ORM, like version 5.1.
We'll soon work on an updated OGM version.


I'm trying to follow the BOM of OGM versions.
  • hibernate-ogm-modules-5.1.0.Beta3-wildfly-10-dist.zip
  • hibernate-orm-modules-5.1.2.Final-wildfly-10-dist.zip
  • hibernate-search-modules-5.5.5.Final-wildfly-10-dist.zip
  • infinispan-as-embedded-modules-8.2.5.Final.zip

But I encounter a new problem that I can't resolve myself.
Just as I mention before, I'm working with an integration of legacy projects using Infinispan Query, Hibernate ORM, Hibernate OGM, Hibernate Search together.
Because all the project have parts of code.

OGM has a dependency version as below.
Code:
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.5.5.Final-orm51"/>


Infinispan Query has a dependency version as below.
Code:
<module name="org.hibernate.search.engine" slot="5.6" export="true"/>


They're unable to align.
Either upgrade the version for OGM dependency or downgrade the version for Infinispan Query dependency will break the other.


Last edited by Seto on Sun Jan 08, 2017 3:20 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sun Jan 08, 2017 3:19 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
And also it breaks the ORM JPA as well. The error below is reported.
Quote:
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype


Then I change the JPA settings to use Hibernate ORM 5.1.
Code:
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.1" />


Then the error below is reported.
Quote:
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)


Then I change the cache container module setting to 5.1 and make the 2nd level cache working.
Code:
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan:5.1">


Quote:
Then the error below is reported.
Quote:
Caused by: java.lang.IllegalArgumentException: An SPI class of type org.apache.lucene.codecs.Codec with name 'Lucene54' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classpath supports the following names: [Lucene53, Lucene40, Lucene41, Lucene42, Lucene45, Lucene46, Lucene49, Lucene410, Lucene50]


Then I check the Lucene in WildFly modules.
The module come with infinispan-as-embedded-modules-8.2.5.Final.zip is Lucene 5.5.
The module come with hibernate-search-modules-5.5.5.Final-wildfly-10-dist.zip is Lucene 5.3.
No Lucene54 indeed.


UPDATED:But after a fresh install of WildFly and modules, this problem is gone.
=================================================================================
Now the only problem is Hibernate Search version difference between Infinispan Query and Hibernate OGM.

Hibernate OGM uses Hibernate ORM 5.1.2 which Hibernate Search version is 5.5.5.Final-orm51.
Infinispan Query uses Hibernate Search 5.6.0.Beta1.


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sun Jan 08, 2017 6:42 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
OK now. It seems that Hibernate 5.1 is working well with Hibernate Search 5.6.0.Beta1.
Now the version for Infinispan Query and for Hibernate are aligned as 5.6.0.Beta1.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate Search, full-text search for your domain model
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
  -->
<module xmlns="urn:jboss:module:1.1" name="org.hibernate.search.orm" slot="5.6.0.Beta1">
    <resources>
        <resource-root path="hibernate-search-orm-5.6.0.Beta1.jar" />
    </resources>
    <dependencies>
        <module name="javax.transaction.api" />
        <module name="org.hibernate" slot="5.1" />
        <module name="org.hibernate.commons-annotations" />
        <module name="org.hibernate.search.engine" export="true" services="import" slot="5.6.0.Beta1" />
        <module name="org.jboss.logging" />
        <module name="javax.persistence.api" />
    </dependencies>
</module>


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sun Jan 08, 2017 7:08 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
Finally make it working with the modules below.
  • hibernate-ogm-modules-5.1.0.Beta3-wildfly-10-dist.zip
  • hibernate-orm-modules-5.1.3.Final-wildfly-10-dist.zip
  • infinispan-as-embedded-modules-8.2.5.Final.zip
  • hibernate-search-modules-5.6.0.CR1-wildfly-10-dist.zip

Changes below to make it working.

modules/system/layers/base/org/hibernate/search/orm/5.6.0.CR1/module.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate Search, full-text search for your domain model
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
  -->
<module xmlns="urn:jboss:module:1.1" name="org.hibernate.search.orm" slot="5.6.0.CR1">
    <resources>
        <resource-root path="hibernate-search-orm-5.6.0.CR1.jar" />
    </resources>
    <dependencies>
        <module name="javax.transaction.api" />
        <module name="org.hibernate" slot="5.1" />
        <module name="org.hibernate.commons-annotations" />
        <module name="org.hibernate.search.engine" export="true" services="import" slot="5.6.0.CR1" />
        <module name="org.jboss.logging" />
        <module name="javax.persistence.api" />
    </dependencies>
</module>



modules/system/layers/base/org/hibernate/ogm/5.1/module.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate OGM, Domain model persistence for NoSQL datastores
~
~ License: GNU Lesser General Public License (LGPL), version 2.1 or later
~ See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
  -->
<module xmlns="urn:jboss:module:1.1" name="org.hibernate.ogm" slot="5.1">
    <resources>
        <resource-root path="hibernate-ogm-core-5.1.0.Beta3.jar" />
    </resources>
    <dependencies>
        <module name="org.hibernate" export="true" slot="5.1" />
        <module name="org.hibernate.commons-annotations" />
        <module name="org.hibernate.hql" slot="1.3.0.Final" />
        <module name="org.hibernate.search.orm" slot="5.6" optional="true" />

        <module name="javax.persistence.api" />
        <module name="javax.transaction.api" />
        <module name="org.jboss.logging" />

        <module name="org.hibernate.ogm.jipijapa" slot="5.1.0.Beta3" services="import" />

        <!-- Needed for Iso8601StringDateType -->
        <module name="javax.xml.bind.api"/>
    </dependencies>
</module>


standalone/configuration/standalone.xml
Code:
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan:5.1">

Looking forward to a ORM 5.2 compatible and Infinispan 9.0 compatible version.


Last edited by Seto on Thu Jan 12, 2017 12:22 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Sun Jan 08, 2017 6:50 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Glad you solved it, that looks like correct. You should be able to use Hibernate Search 5.6.0.CR1 instead of the older beta.

Indeed the BOM provides a suggested version, but as you noticed it's not the only combination which will work.

As a general suggestion: you might want to split your application in multiple modules, to take advantage of the classloading isolation of WildFly modules.
You should be able to isolate your code which is requiring Infinispan Query from the code which is directly using Hibernate OGM & Search, so that each component can depend on different versions of such dependencies.

The best aspect of the modules system is that dependencies are never transitive (unless you explicitly re-export them) so it's possible to use various libraries even if they have conflicting dependencies.

There's no need to split it all in very fine-grained modules, but splitting your application in three could help managing dependencies and future evolution:
- Main Application -> depends on DAO modules A and B
- DAO module A, using Infinispan Query -> Depends on Infinispan Query (any version) and the related [Hibernate Search version X]
- DAO module B, using Hibernate OGM and [Hibernate Search version Y]

Just make sure that the API you expose from your DAO modules to the main application doesn't leak any Class from Hibernate, Infinispan or their dependencies.

The WildFly modules system is intentionally designed to allow such level of flexibility.

Of course this won't be needed when we'll have an OGM version compatible with ORM 5.2, but by then you might be interested in upgrading some other component, so it's always good to design for using modules so that you'll have more flexibility in your choices when working with latest versions.

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: WildFly and Hibernate module problem.
PostPosted: Mon Jan 09, 2017 12:15 am 
Beginner
Beginner

Joined: Sun Mar 05, 2006 12:16 am
Posts: 31
Thank you. I'll take a look at the module system provided by WildFly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 15 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.