将应用程序升级到Grails 2后JBoss部署错误

时间:2012-11-08 17:24:53

标签: tomcat grails jboss catalina

我已将Grails应用从1.3.6升级到2.1.1。经过一些修复和整理后,run-app可以运行(在大多数情况下,还有一些已弃用的问题需要处理)。 grails war也会毫无错误地构建。

然而,当我部署到JBoss(4.2.2)时,与grails 1.3.6战争相同,我得到了这个错误:

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])

所以我认为这是战争中lib的catalina类和jboss中的catalina类之间的冲突?因为它在1.3.6时运行正常,是否已经添加到2.1.1 grails tomcat插件中,是否可以从grails插件中排除子依赖项?

感谢。

1 个答案:

答案 0 :(得分:0)

找到'解决方案',万一其他人正在寻找。

如果我将插件的声明从application.properties移动到BuildConfig.groovy,则错误消失。我不确定它是否真的“修复”了它,或者它是否导致清理/重新安装可能已经清除它的tomcat插件,但它在部署时删除了错误。

在此之后我遇到了另一个错误,JBoss hibernate libs比Grails 2.1.1依赖项中的更旧:

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)

通过遵循说明here来修复,告诉JBoss使用应用程序的库而不是自己的库。