Announcement Announcement Module
Collapse
No announcement yet.
Problems deploying Grails 2.1.1 application to JBoss 4.2.3 GA Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems deploying Grails 2.1.1 application to JBoss 4.2.3 GA

    I recently upgraded my app from Grails 1.2.2 to Grails 2.1.1.

    Running my code from within the GGTS works very well.

    However I'm having problems deploying it to JBoss 4.2.3 GA.

    I get:
    java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.log4j.web.util. Log4jConfigListener.

    Note that this is not the class org.codehaus.groovy.grails.web.util.Log4jConfigLis tener.

    I followed all the instructions I could find, including installing the new templates and updating web.xml.

    2012-12-06 10:23:38,096 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/ems]] Error configuring application listener of class org.codehaus.groovy.grails.plugins.log4j.web.util. Log4jConfigListener
    java.lang.ClassNotFoundException: org.codehaus.groovy.grails.plugins.log4j.web.util. Log4jConfigListener
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1204)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3799)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4361)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:790)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:770)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:553)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invo ke(BaseModelMBean.java:296)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:164)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:659)
    at org.apache.catalina.core.StandardContext.init(Stan dardContext.java:5312)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invo ke(BaseModelMBean.java:296)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:164)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:659)
    at org.jboss.web.tomcat.service.TomcatDeployer.perfor mDeployInternal(TomcatDeployer.java:301)
    at org.jboss.web.tomcat.service.TomcatDeployer.perfor mDeploy(TomcatDeployer.java:104)
    at org.jboss.web.AbstractWebDeployer.start(AbstractWe bDeployer.java:375)
    at org.jboss.web.WebModule.startModule(WebModule.java :83)
    at org.jboss.web.WebModule.startService(WebModule.jav a:61)
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Start(ServiceMBeanSupport.java:289)
    at org.jboss.system.ServiceMBeanSupport.jbossInternal Lifecycle(ServiceMBeanSupport.java:245)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:155)


    I also tried to disable the Log4J plugin as explained in the following link:
    http://stackoverflow.com/questions/1...ugin-in-grails

    Then I got even a stranger exception:

    2012-12-06 10:52:50,963 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/ems]] Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsConte xtLoaderListener
    java.lang.NoClassDefFoundError: groovy/lang/ExpandoMetaClass
    at org.codehaus.groovy.grails.web.context.GrailsConte xtLoader.initWebApplicationContext(GrailsContextLo ader.java:52)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3856)
    at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4361)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:790)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:770)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:553)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invo ke(BaseModelMBean.java:296)
    at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDy namicInvoker.java:164)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:659)
    ...
    at org.jboss.Main.boot(Main.java:200)
    at org.jboss.Main$1.run(Main.java:508)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.ClassNotFoundException: groovy.lang.ExpandoMetaClass
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1358)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1204)
    ... 134 more

    Now, it seems that something is wrong with groovy.

    Does anyone have any idea what could be the problem?
    Am I missing a plugin (grails-plugin-log4j-2.1.1.jar)?
    Do I need to upgrade the groovy libraries somehow?

    Thanks,
    Shai
    Last edited by shaiw; Dec 6th, 2012, 05:22 AM.

  • #2
    To solve this I had to disable the log4J plugin.

    Technically it means removing the following from the generated web.xml:
    Code:
    <listener>
           <listener-class>org.codehaus.groovy.grails.plugins.log4j.web.util. Log4jConfigListener</listener-class>
    </listener>
    For that I added the following code to _Events.groovy:

    Code:
    import groovy.xml.StreamingMarkupBuilder
    
    eventWebXmlEnd = {String tmpfile ->
    
        def root = new XmlSlurper().parse(webXmlFile)
    
        def log4j = root.listener.findAll {node ->
            node.'listener-class'.text() == 'org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener'
        }
        log4j.replaceNode {}
        
        webXmlFile.text = new StreamingMarkupBuilder().bind {
            mkp.declareNamespace("": "http://java.sun.com/xml/ns/javaee")
            mkp.yield(root)
        }
    }
    Cheers,
    Shai

    Comment

    Working...
    X