I've upgraded a Grails app from 1.3.6 to 2.1.1. After some fixing and tidying up, run-app works (for the most part, still some deprecated issues to deal with). grails war also builds without error.

When I deploy into JBoss (4.2.2) however, the same as has been done for the grails 1.3.6 war, I get this error:

Caused by: javax.management.ReflectionException: Cannot find setter method setLoader StandardContext[null]
        at org.apache.tomcat.util.modeler.ManagedBean.getSetter(ManagedBean.java:560)
        at org.apache.tomcat.util.modeler.BaseModelMBean.setAttribute(BaseModelMBean.java:407)
        at org.jboss.mx.server.RawDynamicInvoker.setAttribute(RawDynamicInvoker.java:70)
        at org.jboss.mx.server.MBeanServerImpl.setAttribute(MBeanServerImpl.java:608)
        at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:212)
        at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
        at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
        ... 112 more
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.core.StandardContext.setLoader(org.apache.catalina.Loader)
        at java.lang.Class.getMethod(Class.java:1605)
        at org.apache.tomcat.util.modeler.ManagedBean.getSetter(ManagedBean.java:553)
        ... 118 more
2012-11-08 16:09:51,604 INFO  [org.jboss.web.tomcat.service.TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
2012-11-08 16:09:51,664 ERROR [org.jboss.deployment.scanner.URLDeploymentScanner] Incomplete Deployment listing:

--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@5cc18807 { url=file:/usr/local/JBoss/jboss-4.2.2.GA/server/default/deploy/xxxxx-1.0.war }
  deployer: MBeanProxyExt[jboss.web:service=WebServer]
  status: Deployment FAILED reason: Error during deploy; - nested throwable: (javax.management.ReflectionException: Cannot find setter method setLoader StandardContext[null])
  state: FAILED
  watch: file:/usr/local/JBoss/jboss-4.2.2.GA/server/default/deploy/xxxxx-1.0.war
  altDD: null
  lastDeployed: 1352390987263
  lastModified: 1352390987000
  mbeans:

--- MBeans waiting for other MBeans ---
ObjectName: jboss.web.deployment:war=xxxxx-1.0.war,id=1556187143
  State: FAILED
  Reason: org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.management.ReflectionException: Cannot find setter method setLoader StandardContext[null])

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.web.deployment:war=xxxxx-1.0.war,id=1556187143
  State: FAILED
  Reason: org.jboss.deployment.DeploymentException: Error during deploy; - nested throwable: (javax.management.ReflectionException: Cannot find setter method setLoader StandardContext[null])

So am thinking it's a collision between a catalina class in a lib in the war, and one already in jboss? As it worked ok when it was 1.3.6, is it something that's been added to the 2.1.1 grails tomcat plugin and is it possible to exclude a sub-dependency from a grails plugin?

Thanks.

有帮助吗?

解决方案

Found the 'solution', in case anyone else is looking.

The error disappears if I move the declaration of the plugins from application.properties to BuildConfig.groovy. I'm not sure if it's actually "fixed" it or if it caused a clean/reinstall of the tomcat plugin that might have cleared it up, but it removed the error on deploy.

After this I hit another error, with JBoss hibernate libs being older than the ones in Grails 2.1.1 dependencies:

Caused by: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator.   
(java.lang.Class, java.util.ResourceBundle, org.hibernate.validator.MessageInterpolator, 
java.util.Map, org.hibernate.annotations.common.reflection.ReflectionManager)

that was fixed by following the instructions here to tell JBoss to use the app's libs instead of its own.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top