|
Hi, I’m being bitten by a bug in hibernate which is
present in 3.3.1.GA (the version used by Grails 1.3.5), but fixed in later
versions. http://opensource.atlassian.com/projects/hibernate/browse/HHH-2146 I’d like to be able to update to a newer version, but
I’m having problems. The closest version with a fix for that bug is 3.3.2.GA. You
might hope that it would be binary compatible, given that it’s a 0.0.1
increment, but sadly it’s not. They’ve renamed “org.hibernate.dialect.DialectFactory”
to “org.hibernate.dialect.resolve.DialectFactory” as part of http://opensource.atlassian.com/projects/hibernate/browse/HHH-2933
This means that, if I put the following in my build config,
then “run-app” fails with “java.lang.ClassNotFoundException:
org.hibernate.dialect.DialectFactory” dependencies {
compile 'org.hibernate:hibernate-core:3.3.2.GA' What I’ve done in the past in situations like this is
to create a ‘shim’ class with the old name which delegates all
calls to the new class at the new name. I’ve tried to do the same with
Grails, but it seems that classes in “src/java” aren’t placed
on the classpath during Spring bean setup. I’ve put some “println”s in the _GrailsRun
script, and the “server” object’s classloader can find my
shim implementation of “org.hibernate.dialect.DialectFactory” at
_GrailsRun.groovy:165, but I get the following stack trace shortly thereafter: org.springframework.beans.factory.BeanCreationException:
... Error creating bean with name 'dialectDetector': Invocation of init method
failed; nested exception is java.lang.NoClassDefFoundError:
org/hibernate/dialect/DialectFactory
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) java.lang.NoClassDefFoundError:
org/hibernate/dialect/DialectFactory
at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
at grails.web.container.EmbeddableServer$start.call(Unknown Source)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:167)
at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) So: 1.
Is it possible to upgrade Grails 1.3.5 to Hibernate
>= 3.3.2.GA? Does anyone know how? 2.
How can I get my app’s classes on Spring’s
startup classpath? Thanks, Rich softwire Softwire
Technology Limited. Registered in England no. 3824658. Registered Office : 13
Station Road, London N3 2SB |
|
Use the following:
inherits( "global" ) { excludes 'hibernate'
} On Tue, Oct 19, 2010 at 7:16 PM, Richard Bradley <[hidden email]> wrote:
|
|
Thanks. Unfortunately the problem is not excluding the old
version of Hibernate; Ivy manages that just fine, even without an “excludes” directive. The problem is that the newer version, 3.3.2, is binary-incompatible
with the expected version, 3.3.1, so I need to persuade the Grails bootstrap
classloader to look in my “src/java” directory for a rename shim class when constructing
Spring beans on application startup. From: Enrique Medina Montenegro
[mailto:[hidden email]] Use the following: inherits(
"global" ) { excludes
'hibernate' } On Tue, Oct 19, 2010 at 7:16 PM, Richard Bradley <[hidden email]>
wrote: Hi, I’m
being bitten by a bug in hibernate which is present in 3.3.1.GA (the version used by Grails 1.3.5), but fixed in
later versions. http://opensource.atlassian.com/projects/hibernate/browse/HHH-2146 I’d
like to be able to update to a newer version, but I’m having problems. The
closest version with a fix for that bug is 3.3.2.GA. You might hope that it would be binary
compatible, given that it’s a 0.0.1 increment, but sadly it’s not. They’ve
renamed “org.hibernate.dialect.DialectFactory” to
“org.hibernate.dialect.resolve.DialectFactory” as part of http://opensource.atlassian.com/projects/hibernate/browse/HHH-2933
This
means that, if I put the following in my build config, then “run-app” fails
with “java.lang.ClassNotFoundException:
org.hibernate.dialect.DialectFactory” dependencies { compile 'org.hibernate:hibernate-core:3.3.2.GA' What
I’ve done in the past in situations like this is to create a ‘shim’ class with
the old name which delegates all calls to the new class at the new name. I’ve
tried to do the same with Grails, but it seems that classes in “src/java”
aren’t placed on the classpath during Spring bean setup. I’ve
put some “println”s in the _GrailsRun script, and the “server” object’s
classloader can find my shim implementation of “org.hibernate.dialect.DialectFactory”
at _GrailsRun.groovy:165, but I get the following stack trace shortly
thereafter: org.springframework.beans.factory.BeanCreationException:
... Error creating bean with name 'dialectDetector': Invocation of init method
failed; nested exception is java.lang.NoClassDefFoundError:
org/hibernate/dialect/DialectFactory at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) java.lang.NoClassDefFoundError:
org/hibernate/dialect/DialectFactory at
org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212) at
grails.web.container.EmbeddableServer$start.call(Unknown Source) at
_GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:167) at
_GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy) at
_GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280) at
_GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy) So: 1. Is
it possible to upgrade Grails 1.3.5 to Hibernate >= 3.3.2.GA? Does anyone know how? 2. How
can I get my app’s classes on Spring’s startup classpath? Thanks, Rich softwire Softwire Technology Limited.
Registered in England no. 3824658. Registered Office : 13 Station Road, London
N3 2SB softwire Softwire
Technology Limited. Registered in England no. 3824658. Registered Office : 13
Station Road, London N3 2SB |
|
In reply to this post by Richard Bradley
This may be too ad hoc for you, but have you thought of re-compiling Hibernate with your shim in it, and then replacing the Hibernate JAR that comes with Grails?
|
|
I think that could work, but we have a whole team here working on our app, as well as various integration servers etc., so reliably getting my custom Hibernate Jar into all environments would probably entail some kind of local Ivy repository, which sounds like a pain. (Or at least, a bit of fiddling to get Ivy to accept a local checked-in hibernate jar instead of the one specified in its dependencies)
If I'm going to start customising external dependencies, it would be tempting to fork Grails and update it to be compatible with the later Hibernate before trying to fork Hibernate. If I did that, I could even patch some of the the bugs I currently have open in Grails JIRA. ;-) I'd really rather avoid doing either of those though, so I'll probably just live with occasional null-ref errors from within Hibernate, unless anyone has any other ideas? To recap: I think the easiest fix for my problem might be to convince Grails to put my "src/java" dir on the classpath when it loads Hibernate during Spring initialisation. Can that be done? Thanks, Rich -----Original Message----- From: ivan_d [mailto:[hidden email]] Sent: 20 October 2010 00:19 To: [hidden email] Subject: [grails-user] Re: update hibernate version This may be too ad hoc for you, but have you thought of re-compiling Hibernate with your shim in it, and then replacing the Hibernate JAR that comes with Grails? -- View this message in context: http://grails.1312388.n4.nabble.com/update-hibernate-version-tp3002449p3002991.html Sent from the Grails - user mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email softwire Richard Bradley Tel : 020 7485 7500 ext 230 | Fax : 020 7485 7575 Web : www.softwire.com | E-mail : [hidden email] Addr : 325 Highgate Studios, 53-79 Highgate Road, London NW5 1TL Softwire Technology Limited. Registered in England no. 3824658. Registered Office : 13 Station Road, London N3 2SB --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Richard Bradley
I'm having the exact same issue, just discovered hibernate core grails 1.3.6 uses is from 2008, too old for my opinion.
I hope I find a solution to this ASAP, as i'm upgrading a big app here from 1.1 >> 1.3.6, and some new modules depends on a new version of grails. Anyone with a solution to this is welcome to help us! Frederico Galvão - Goiânia GO, Brazil
Fibonacci Soluções Ágeis, PontoGet Inovação Web |
|
Upgrade to latest hibernate is on the roadmap for Grails 1.4, if that is any help.
http://grails.org/Roadmap On Jan 27, 2011, at 1:31 PM, kikoalemao wrote: > > I'm having the exact same issue, just discovered hibernate core grails 1.3.6 > uses is from 2008, too old for my opinion. > I hope I find a solution to this ASAP, as i'm upgrading a big app here from > 1.1 >> 1.3.6, and some new modules depends on a new version of grails. > > Anyone with a solution to this is welcome to help us! > -- > View this message in context: http://grails.1312388.n4.nabble.com/update-hibernate-version-tp3002449p3242100.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
I had the same problem. You don't actually have to use a shim jar. The problem on the grails side is related to the following:
if (ds && ds.dialect) {
if (ds.dialect instanceof Class) {
hibProps."hibernate.dialect" = ds.dialect.name
}
else {
hibProps."hibernate.dialect" = ds.dialect.toString()
}
}
else {
dialectDetector(HibernateDialectDetectorFactoryBean) {
dataSource = ref("dataSource")
vendorNameDialectMappings = vendorToDialect
}
hibProps."hibernate.dialect" = dialectDetector
}
Which you can find in HibernatePluginSupport. Essentially, if there is no dialect detected, it will then instantiate this HibernateDialectDetectFactoryBean. According to the issue from hibernate they are trying to essentially create an api for custom dialects. Which is the same thing Grails is doing. If you set your dialect on your datasource, you should be able to startup your application without issue. |
| Powered by Nabble | See how NAML generates this page |
