Details
Description
1) grails create-app test
2) grails war
3) copy test-0.1.war to jboss deploy directory
4) run jboss
JBoss Startup with lots of error message
ERROR [ContextLoader] Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework. beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
......
trying to fix with jboss-web.xml as described in http://www.grails.org/FAQ but no luck
in grails 1.2-M4 it works!
Issue Links
- is related to
-
GRAILS-5563
Deployment error on both jboss-4.2.3.GA and jboss-5.1.0.GA
-
Activity
- All
- Comments
- Work Log
- History
- Activity
- Git Commits
There's a possible workaround for the problem: http://markmail.org/message/7byy6kx5ljx5kwve
Issue appears to be in Spring. Relevant Spring issue: http://jira.springframework.org/browse/SPR-6783
Graeme, the link you have to SPR-6783 is one that's resolved as unreproducible. But this one is, quite definitely, reproduceable. Right now, I'm using JBoss 5.1.0GA, with Grails 1.2.1, and getting the same issue.
Could I impose on you to clarify what's happening with this issue? I've seen commentary by you, that it may be fixed in Spring 3.0.1, but Grails 1.2.1 doesn't readily allow a user to update the ivy file to use 3.0.1 instead of 3.0.0. If nothing else, can you describe if you've gotten it to work, if so, what steps you took, and if the steps are not obvious, what libraries for Grails & Spring you're using?
Thanks for your help.
The issue is not with Spring, we have yet to identify the cause of the issue although have isolated the changesets that may be causing the problem
I've investigated the issue, as we deploy into Jboss 5.1.0 here, and the version of hibernate validator bundled in grails which clash with the one inside jboss. It seems to me that the classloading configuration is broken in Jboss, but again I could be wrong, I tried to insert some jboss-web.xml with classloading instruction to load first the one inside grails, but that didn't work.
so, I found 2 workarounds:
- replace the JBOSS_HOME/common/lib/hibernate-validator.jar and its dependencies
- comment out the WarClassLoaderDeployer bean inside JBOSS_HOME/server/default/deployers/jbossweb.deployer/META-INF/war-deployers-jboss-beans.xml
we use in production the second one, because we had another issue with the quartz plugin, which conflicted with the one bundled in Jboss
Fixed in latest hibernate plugin 1.3.0.BUILD-SNAPSHOT
It seems in order to use the latest version of Hibernate on JBoss you must include Hibernate validator otherwise you run into this classloading error. This means the hibernate plugin is forced to include hibernate-validator as a dependency even if we don't use it which is a pretty annoying.
Anyway you can fix this yourselves in 1.2.x by adding the following dependency to BuildConfig.groovy:
runtime('org.hibernate:hibernate-validator:3.1.0.GA') {
excludes 'sl4j-api', 'hibernate.core', 'hibernate-commons-annotations', 'hibernate-entitymanager'
}
Be sure to uncomment the jboss maven repository so the dependency resolvers
I am working in Grails 1.3 GA, and I think this bug has reared it's head again in JBoss 5.1. I was able to fix it using the 1.2 workaround posted here. I was having this issue when deploying a Grails 1.3 app in JBoss 5.1, but fixed it by adding hibernate-validator.jar from JBoss's commons/lib directory to my war, as described as the fix for Grails 1.2. I am not sure, but I'm guessing this fix didn't get included in Grails 1.3 somehow?
This was the stack trace:
14:43:35,906 INFO [[/CONTEXTROOT]] Initializing Spring root WebApplicationContext
14:44:05,250 INFO [STDOUT] 14:44:05,234 ERROR [ContextLoader] Context initializ
ation failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'messageSource': Initialization of bean failed; nested exception is org.s
pringframework.beans.factory.BeanCreationException: Error creating bean with nam
e 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while
setting bean property 'sessionFactory'; nested exception is org.springframework.
beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
ry': Invocation of init method failed; nested exception is org.hibernate.Annotat
ionException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassVali
dator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.
MessageInterpolator, java.util.Map, org.hibernate.annotations.common.reflection.
ReflectionManager)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy
Internal(TomcatDeployment.java:310)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy
(TomcatDeployment.java:142)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeploy
ment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch
er.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.
java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java
:206)
at $Proxy38.start(Unknown Source)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installActio
n(StartStopLifecycleAction.java:42)
at org.jboss.system.microcontainer.StartStopLifecycleAction.installActio
n(StartStopLifecycleAction.java:37)
at org.jboss.dependency.plugins.action.SimpleControllerContextAction.sim
pleInstallAction(SimpleControllerContextAction.java:62)
at org.jboss.dependency.plugins.action.AccessControllerContextAction.ins
tall(AccessControllerContextAction.java:71)
at org.jboss.dependency.plugins.AbstractControllerContextActions.install
(AbstractControllerContextActions.java:51)
at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
at org.jboss.system.microcontainer.ServiceControllerContext.install(Serv
iceControllerContext.java:286)
at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
at org.jboss.system.ServiceController.doChange(ServiceController.java:68
8)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java
:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.jav
a:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.jav
a:46)
at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.i
nternalDeploy(AbstractSimpleRealDeployer.java:62)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(
AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(Deployer
Wrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(Deployer
sImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFi
rst(DeployersImpl.java:1178)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(Deployers
Impl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(Deployers
Impl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeploye
rImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter
.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.repository.ProfileDeployAction
.install(ProfileDeployAction.java:70)
at org.jboss.system.server.profileservice.repository.AbstractProfileActi
on.install(AbstractProfileAction.java:53)
at org.jboss.system.server.profileservice.repository.AbstractProfileServ
ice.install(AbstractProfileService.java:361)
at org.jboss.dependency.plugins.AbstractControllerContext.install(Abstra
ctControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractContr
oller.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(Abstra
ctController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(Abstr
actController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractContro
ller.java:553)
at org.jboss.system.server.profileservice.repository.AbstractProfileServ
ice.activateProfile(AbstractProfileService.java:306)
at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(
ProfileServiceBootstrap.java:271)
at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:
461)
at org.jboss.Main.boot(Main.java:221)
at org.jboss.Main$1.run(Main.java:556)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'transactionManager': Cannot resolve reference to bean 'sessio
nFactory' while setting bean property 'sessionFactory'; nested exception is org.
springframework.beans.factory.BeanCreationException: Error creating bean with na
me 'sessionFactory': Invocation of init method failed; nested exception is org.h
ibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.val
idator.ClassValidator.<init>(java.lang.Class, java.util.ResourceBundle, org.hibe
rnate.validator.MessageInterpolator, java.util.Map, org.hibernate.annotations.co
mmon.reflection.ReflectionManager)
... 63 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'sessionFactory': Invocation of init method failed; nested exc
eption is org.hibernate.AnnotationException: java.lang.NoSuchMethodException: or
g.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.ResourceB
undle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernate
.annotations.common.reflection.ReflectionManager)
... 63 more
Caused by: org.hibernate.AnnotationException: java.lang.NoSuchMethodException: o
rg.hibernate.validator.ClassValidator.<init>(java.lang.Class, java.util.Resource
Bundle, org.hibernate.validator.MessageInterpolator, java.util.Map, org.hibernat
e.annotations.common.reflection.ReflectionManager)
... 63 more
Caused by: java.lang.NoSuchMethodException: org.hibern
14:44:05,250 INFO [STDOUT] ate.validator.ClassValidator.<init>(java.lang.Class,
java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, java.uti
l.Map, org.hibernate.annotations.common.reflection.ReflectionManager)
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
... 63 more
This is also present in 1.3.4 had to use the fix from Graeme Rocher.
This is also present in 1.3.5. I also had to use the fix from Graeme Rocher.
what is the error on JBoss 6 + Grails 1.3.7? This issue relates to JBoss 5 so if you're having problems raise a separate JIRA
You're right. I'm also having trouble with the Grails 1.2 final version. This issue same as http://jira.codehaus.org/browse/GRAILS-5563 .
What really weird was, it works in Grails 1.2 M4. I think Grails developer should do something about this issue. I love Grails because it simplicity, elegant and robustness.
I'm, myself, hate to configure xml file. It kill my great joy developing application using Grails.