Hibernate & Spring Boot on WildFly

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Hibernate & Spring Boot on WildFly

Sanne Grinovero
Hi all,

today trying to help some Hibernate users on SO I stumbled on a
question regarding an application being developed with Spring - and
apparently Spring Boot (?) - and deployed on WildFly.

Clearly the poster is having duplicate Hibernate classes, or possibly
mismatches with the version he's expecting vs the app server's
expectations, or more likely a mismatch between the Hibernate ORM and
Hibernate Search versions being loaded.

I'm familiar with JipiJapa, but while this automates some things -
like adding a module dependency to Hibernate ORM and/or Hibernate
Search automatically - this logic is usually controlled by application
settings in the `persistence.xml` and is aimed at standard JEE
deployments - so I guess it might actually be interfering in this
case.

Beyond helping the specific question, do we have a general set of
tests or recommendations - maybe some example template - for Spring
Boot users on WildFly?

Anyone maybe interested in contributing some Spring related examples?

I've never used Spring myself but I guess I'd like to have a look to
better understand what kind of issues such users might bump into, and
what we could do to make it easier.

Thanks,
Sanne
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Ken Finnigan
Sanne,

Is he creating a Spring Boot war?


Ken


On Mon, Jun 20, 2016 at 12:37 PM, Sanne Grinovero <[hidden email]> wrote:
Hi all,

today trying to help some Hibernate users on SO I stumbled on a
question regarding an application being developed with Spring - and
apparently Spring Boot (?) - and deployed on WildFly.

Clearly the poster is having duplicate Hibernate classes, or possibly
mismatches with the version he's expecting vs the app server's
expectations, or more likely a mismatch between the Hibernate ORM and
Hibernate Search versions being loaded.

I'm familiar with JipiJapa, but while this automates some things -
like adding a module dependency to Hibernate ORM and/or Hibernate
Search automatically - this logic is usually controlled by application
settings in the `persistence.xml` and is aimed at standard JEE
deployments - so I guess it might actually be interfering in this
case.

Beyond helping the specific question, do we have a general set of
tests or recommendations - maybe some example template - for Spring
Boot users on WildFly?

Anyone maybe interested in contributing some Spring related examples?

I've never used Spring myself but I guess I'd like to have a look to
better understand what kind of issues such users might bump into, and
what we could do to make it easier.

Thanks,
Sanne
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Tomaž Cerar-2
In reply to this post by Sanne Grinovero

On Mon, Jun 20, 2016 at 6:37 PM, Sanne Grinovero <[hidden email]> wrote:
Beyond helping the specific question, do we have a general set of
tests or recommendations - maybe some example template - for Spring
Boot users on WildFly?


I would say that if users want to go spring full way, aka make spring mange hibernate/jpa stuff
they should disable jpa subsystem all together as it will make it easier for them.

Problem only occurs when they want to use "hybrid" aproach and use some spring & some EE
in combination that can cause issues and is harder to get right wrt deps & configuration.


_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Sanne Grinovero
In reply to this post by Ken Finnigan
On 20 June 2016 at 17:44, Ken Finnigan <[hidden email]> wrote:
> Sanne,
>
> Is he creating a Spring Boot war?
>
> I know that Spring Boot is used here ->
> https://github.com/jboss-developer/jboss-eap-quickstarts/tree/7.1.x-develop/spring-petclinic

Thanks Ken, I'll experiment with that!

I don't know if he's creating a WAR; I'd assume so as otherwise I
don't understand how this would run on WildFly :)

-- Sanne

>
> Ken
>
>
> On Mon, Jun 20, 2016 at 12:37 PM, Sanne Grinovero <[hidden email]>
> wrote:
>>
>> Hi all,
>>
>> today trying to help some Hibernate users on SO I stumbled on a
>> question regarding an application being developed with Spring - and
>> apparently Spring Boot (?) - and deployed on WildFly.
>>
>> Clearly the poster is having duplicate Hibernate classes, or possibly
>> mismatches with the version he's expecting vs the app server's
>> expectations, or more likely a mismatch between the Hibernate ORM and
>> Hibernate Search versions being loaded.
>>
>> I'm familiar with JipiJapa, but while this automates some things -
>> like adding a module dependency to Hibernate ORM and/or Hibernate
>> Search automatically - this logic is usually controlled by application
>> settings in the `persistence.xml` and is aimed at standard JEE
>> deployments - so I guess it might actually be interfering in this
>> case.
>>
>> Beyond helping the specific question, do we have a general set of
>> tests or recommendations - maybe some example template - for Spring
>> Boot users on WildFly?
>>
>> Anyone maybe interested in contributing some Spring related examples?
>>
>> I've never used Spring myself but I guess I'd like to have a look to
>> better understand what kind of issues such users might bump into, and
>> what we could do to make it easier.
>>
>> Thanks,
>> Sanne
>> _______________________________________________
>> wildfly-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
>
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Sanne Grinovero
In reply to this post by Tomaž Cerar-2
On 20 June 2016 at 17:44, Tomaž Cerar <[hidden email]> wrote:

>
> On Mon, Jun 20, 2016 at 6:37 PM, Sanne Grinovero <[hidden email]>
> wrote:
>>
>> Beyond helping the specific question, do we have a general set of
>> tests or recommendations - maybe some example template - for Spring
>> Boot users on WildFly?
>
>
>
> I would say that if users want to go spring full way, aka make spring mange
> hibernate/jpa stuff
> they should disable jpa subsystem all together as it will make it easier for
> them.

Right I would suggest the same, but how can one disable it?
The only options I know of to control Jipijapa are read from the
`persistence.xml` resource file, which is missing in these cases as
the Persistence Unit will typically be configured via some alternative
strategy. The irony ;)

> Problem only occurs when they want to use "hybrid" approach and use some
> spring & some EE
> in combination that can cause issues and is harder to get right wrt deps &
> configuration.

Spot on. This is why I'm interested, I think we could improve some things..
For example, as previously suggested on this list: one step would be
for us to inspect the deployment and avoid injecting dependencies for
things which are already included in the archives.. people will never
master all the exclusion rules on Maven correctly, especially if the
app server does some undocumented magic with dependencies.

A very simple thing I'd like to do, is to not automatically add the
module dependency for Hibernate when clearly an Hibernate
implementation is included in the user's deployment. [This is just a
wish though, as I doubt I'll have time soon to actually work on this].

BTW exploring more on SO today, I found there's actually quite a
population of people trying to get Spring Boot working on Wildfly.

Thanks,
Sanne

_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Tomaž Cerar-2

On Tue, Jun 21, 2016 at 12:45 AM, Sanne Grinovero <[hidden email]> wrote:
Right I would suggest the same, but how can one disable it?
The only options I know of to control Jipijapa are read from the
`persistence.xml` resource file, which is missing in these cases as
the Persistence Unit will typically be configured via some alternative
strategy. The irony ;)


Nah, completely disable it, reading persistence.xml is already part of jpa subsystem :)
you can do that by either removing it from standalone.xml (/subsystem=jpa:remove;reload)
or by adding jboss-deployment-structure.xml to deployment with content

<jboss-deployment-structure>
<deployment>
<exclude-subsystems>
<subsystem name="jpa"/>
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>
which disabled jpa subsystem completely for deployment.




_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Scott Marlow
In reply to this post by Sanne Grinovero


On 06/20/2016 06:45 PM, Sanne Grinovero wrote:

> On 20 June 2016 at 17:44, Tomaž Cerar <[hidden email]> wrote:
>>
>> On Mon, Jun 20, 2016 at 6:37 PM, Sanne Grinovero <[hidden email]>
>> wrote:
>>>
>>> Beyond helping the specific question, do we have a general set of
>>> tests or recommendations - maybe some example template - for Spring
>>> Boot users on WildFly?
>>
>>
>>
>> I would say that if users want to go spring full way, aka make spring mange
>> hibernate/jpa stuff
>> they should disable jpa subsystem all together as it will make it easier for
>> them.
>
> Right I would suggest the same, but how can one disable it?
> The only options I know of to control Jipijapa are read from the
> `persistence.xml` resource file, which is missing in these cases as
> the Persistence Unit will typically be configured via some alternative
> strategy. The irony ;)

You can also set jboss.as.jpa.managed=false in the persistence unit,
which avoids the EE bootstrapping of the persistence unit.

I'm not sure if
https://docs.jboss.org/author/display/WFLY10/Spring+applications+development+and+migration+guide 
is up to date but that mentions using jpa-persistence.xml instead of
persistence.xml (via Spring LocalContainerEntityManagerFactoryBean
settings).

>
>> Problem only occurs when they want to use "hybrid" approach and use some
>> spring & some EE
>> in combination that can cause issues and is harder to get right wrt deps &
>> configuration.
>
> Spot on. This is why I'm interested, I think we could improve some things..
> For example, as previously suggested on this list: one step would be
> for us to inspect the deployment and avoid injecting dependencies for
> things which are already included in the archives.. people will never
> master all the exclusion rules on Maven correctly, especially if the
> app server does some undocumented magic with dependencies.
>
> A very simple thing I'd like to do, is to not automatically add the
> module dependency for Hibernate when clearly an Hibernate
> implementation is included in the user's deployment. [This is just a
> wish though, as I doubt I'll have time soon to actually work on this].
>
> BTW exploring more on SO today, I found there's actually quite a
> population of people trying to get Spring Boot working on Wildfly.
>
> Thanks,
> Sanne
>
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Emmanuel Bernard
I'd recommend a quick blog post with Tomas and Scott options and the
caveat on why it's better to let us run the show instead of taking over
dependency puzzle management.


On Mon 2016-06-20 21:49, Scott Marlow wrote:

>
>
> On 06/20/2016 06:45 PM, Sanne Grinovero wrote:
> > On 20 June 2016 at 17:44, Tomaž Cerar <[hidden email]> wrote:
> >>
> >> On Mon, Jun 20, 2016 at 6:37 PM, Sanne Grinovero <[hidden email]>
> >> wrote:
> >>>
> >>> Beyond helping the specific question, do we have a general set of
> >>> tests or recommendations - maybe some example template - for Spring
> >>> Boot users on WildFly?
> >>
> >>
> >>
> >> I would say that if users want to go spring full way, aka make spring mange
> >> hibernate/jpa stuff
> >> they should disable jpa subsystem all together as it will make it easier for
> >> them.
> >
> > Right I would suggest the same, but how can one disable it?
> > The only options I know of to control Jipijapa are read from the
> > `persistence.xml` resource file, which is missing in these cases as
> > the Persistence Unit will typically be configured via some alternative
> > strategy. The irony ;)
>
> You can also set jboss.as.jpa.managed=false in the persistence unit,
> which avoids the EE bootstrapping of the persistence unit.
>
> I'm not sure if
> https://docs.jboss.org/author/display/WFLY10/Spring+applications+development+and+migration+guide 
> is up to date but that mentions using jpa-persistence.xml instead of
> persistence.xml (via Spring LocalContainerEntityManagerFactoryBean
> settings).
>
> >
> >> Problem only occurs when they want to use "hybrid" approach and use some
> >> spring & some EE
> >> in combination that can cause issues and is harder to get right wrt deps &
> >> configuration.
> >
> > Spot on. This is why I'm interested, I think we could improve some things..
> > For example, as previously suggested on this list: one step would be
> > for us to inspect the deployment and avoid injecting dependencies for
> > things which are already included in the archives.. people will never
> > master all the exclusion rules on Maven correctly, especially if the
> > app server does some undocumented magic with dependencies.
> >
> > A very simple thing I'd like to do, is to not automatically add the
> > module dependency for Hibernate when clearly an Hibernate
> > implementation is included in the user's deployment. [This is just a
> > wish though, as I doubt I'll have time soon to actually work on this].
> >
> > BTW exploring more on SO today, I found there's actually quite a
> > population of people trying to get Spring Boot working on Wildfly.
> >
> > Thanks,
> > Sanne
> >
> > _______________________________________________
> > wildfly-dev mailing list
> > [hidden email]
> > https://lists.jboss.org/mailman/listinfo/wildfly-dev
> >
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate & Spring Boot on WildFly

Scott Marlow
In reply to this post by Tomaž Cerar-2


On 06/20/2016 12:44 PM, Tomaž Cerar wrote:

>
> On Mon, Jun 20, 2016 at 6:37 PM, Sanne Grinovero <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Beyond helping the specific question, do we have a general set of
>     tests or recommendations - maybe some example template - for Spring
>     Boot users on WildFly?
>
>
>
> I would say that if users want to go spring full way, aka make spring
> mange hibernate/jpa stuff
> they should disable jpa subsystem all together as it will make it easier
> for them.

+1.

They have more than one way to deal with this but yeah, disabling the EE
JPA container could be right for them.

>
> Problem only occurs when they want to use "hybrid" aproach and use some
> spring & some EE
> in combination that can cause issues and is harder to get right wrt deps
> & configuration.
>
>
>
> _______________________________________________
> wildfly-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/wildfly-dev
>
_______________________________________________
wildfly-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/wildfly-dev