Announcement Announcement Module
Collapse
No announcement yet.
Grails 2.0.1 & Tomcat 7 Error listenerStart problem but works fine in Tomcat 5.5 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Grails 2.0.1 & Tomcat 7 Error listenerStart problem but works fine in Tomcat 5.5

    I've run into a small problem when deploying any sort of grails war file to both tomcat 6 and tomcat 7 environments. It runs fine within the built in STS IDE as well as Tomcat 5.5. I've been able to isolate it down to a potential issue with something to do with the Hibernate plugin and/or its associated classes as if I comment out the "HibernateResourcesPlugin" in grails.xml I can get the war to deploy.

    It should be known I'm using both mysql and sqljdbc drivers in support of multiple databases so I'm wondering if it has something to do with how these resources are being referenced. Unfortunately even with logging all the way turned up in Tomcat as well as stacktrace from the grails app writing out to file I'm unable to get any closer to the exact culprit. Anyone run across something like this before?

    Here's a couple things I can provide:

    grails.xml
    Code:
    <grails>
      <resources>
        <resource>grails.plugins.springsecurity.SecurityTagLib</resource>
        <resource>JQueryService</resource>
        <resource>JQueryConfig</resource>
        <resource>JQueryResourceTagLib</resource>
        <resource>JQueryTagLib</resource>
        <resource>grails.plugins.springsecurity.SpringSecurityService</resource>
        <resource>ResourcesBootStrap</resource>
        <resource>org.grails.plugin.resource.ResourceTagLib</resource>
        <resource>org.grails.plugin.resource.CSSPreprocessorResourceMapper</resource>
        <resource>DefaultSecurityConfig</resource>
        <resource>org.grails.plugin.resource.BundleResourceMapper</resource>
        <resource>org.grails.plugin.resource.CSSRewriterResourceMapper</resource>
        <resource>JQueryPluginResources</resource>
        <resource>DefaultLdapSecurityConfig</resource>
        <resource>ApplicationResources</resource>
        <resource>BootStrap</resource>
        <resource>BuildConfig</resource>
        <resource>Config</resource>
        <resource>DataSource</resource>
        <resource>resources</resource>
        <resource>UrlMappings</resource>
        <resource>com.mgti.clarisonic.continuitymanager.AccPacCustomerController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.CreditCardController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.CustomerController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.HistoryController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.LoginController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.LogoutController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.OrderLineItemController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.OrderSubscriptionController</resource>
        <resource>com.mgti.clarisonic.continuitymanager.AccPacCreditCard</resource>
        <resource>com.mgti.clarisonic.continuitymanager.AccPacCustomer</resource>
        <resource>com.mgti.clarisonic.continuitymanager.AccPacCustomerSp</resource>
        <resource>com.mgti.clarisonic.continuitymanager.CreditCard</resource>
        <resource>com.mgti.clarisonic.continuitymanager.Customer</resource>
        <resource>com.mgti.clarisonic.continuitymanager.History</resource>
        <resource>com.mgti.clarisonic.continuitymanager.OrderLineItem</resource>
        <resource>com.mgti.clarisonic.continuitymanager.OrderSubscription</resource>
        <resource>com.mgti.clarisonic.continuitymanager.PseudoSku</resource>
        <resource>com.mgti.clarisonic.continuitymanager.SecRole</resource>
        <resource>com.mgti.clarisonic.continuitymanager.SecUser</resource>
        <resource>com.mgti.clarisonic.continuitymanager.SecUserSecRole</resource>
        <resource>com.mgti.clarisonic.continuitymanager.AccPacCreditCardService</resource>
        <resource>com.mgti.clarisonic.continuitymanager.CreditCardService</resource>
        <resource>com.mgti.clarisonic.continuitymanager.CustomerService</resource>
        <resource>com.mgti.clarisonic.continuitymanager.HistoryService</resource>
        <resource>com.mgti.clarisonic.continuitymanager.OrderLineItemService</resource>
      </resources>
      <plugins>
        <plugin>SpringSecurityLdapGrailsPlugin</plugin>
        <plugin>JqueryGrailsPlugin</plugin>
        <plugin>SpringSecurityCoreGrailsPlugin</plugin>
        <plugin>HibernateGrailsPlugin</plugin>
        <plugin>ResourcesGrailsPlugin</plugin>
      </plugins>
    </grails>
    BuildConfig.groovy

    Code:
    grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
    grails.project.class.dir = "target/classes"
    grails.project.test.class.dir = "target/test-classes"
    grails.project.test.reports.dir = "target/test-reports"
    grails.project.target.level = 1.7
    grails.project.source.level = 1.7
    //grails.project.war.file = "target/${appName}-${appVersion}.war"
    
    grails.project.dependency.resolution = {
        // inherit Grails' default dependencies
        inherits("global") {
            // uncomment to disable ehcache
            // excludes 'ehcache'
        }
        log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
        checksums true // Whether to verify checksums on resolve
    
        repositories {
            inherits true // Whether to inherit repository definitions from plugins
            grailsPlugins()
            grailsHome()
            grailsCentral()
            mavenCentral()
    
            // uncomment these to enable remote dependency resolution from public Maven repositories
            mavenCentral()
            mavenLocal()
            //mavenRepo "http://snapshots.repository.codehaus.org"
            //mavenRepo "http://repository.codehaus.org"
            //mavenRepo "http://download.java.net/maven/2/"
            //mavenRepo "http://repository.jboss.com/maven2/"
        }
        dependencies {
            // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
    
             runtime 'mysql:mysql-connector-java:5.1.16'
        }
    
        plugins {
            runtime ":hibernate:$grailsVersion"
            runtime ":jquery:1.7.1"
            runtime ":resources:1.1.6"
    
            // Uncomment these (or add new ones) to enable additional resources capabilities
            //runtime ":zipped-resources:1.0"
            //runtime ":cached-resources:1.0"
            //runtime ":yui-minify-resources:0.1.4"
    
            build ":tomcat:$grailsVersion"
        }
    }

  • #2
    Hard to diagnose without any error messages. Is there anything useful in stacktrace.log? catalina.out will usually just have the generic "SEVERE: Error listenerStart" message. Is there anything interesting in one of the other log files in tomcat's logs directory?

    Comment


    • #3
      Originally posted by burtbeckwith View Post
      Hard to diagnose without any error messages. Is there anything useful in stacktrace.log? catalina.out will usually just have the generic "SEVERE: Error listenerStart" message. Is there anything interesting in one of the other log files in tomcat's logs directory?
      Right that's my understanding as well. My hope would have been increasing logging across tomcat to 'FINEST' as well as dumping the Grails stacktrace into a log might have provided something interesting but I have yet to find anything really of interest occurring around the time of the Error listenerStart aside from " org.apache.catalina.core.StandardContext start" for the application. In fact the application isn't even getting to the point where it can write to stacktrace leading me to believe tomcat doesn't like something its seeing.

      Since the logs have been miserably useless the only thing I have to go off of at this point is how commenting out the '<plugin>HibernateGrailsPlugin</plugin>' line in grails.xml allows the app to load successfully granted without db support. Maybe there's something to that I'm not sure.. I'm more baffled how I can't seem to get anything else out of the logs. Real helpful right?

      Comment


      • #4
        Does creating a logging.properties in the exploded war's WEB-INF/classes directory as described at https://mythinkpond.wordpress.com/20...ug-this-error/ help?

        Comment


        • #5
          Originally posted by burtbeckwith View Post
          Does creating a logging.properties in the exploded war's WEB-INF/classes directory as described at https://mythinkpond.wordpress.com/20...ug-this-error/ help?
          The default logging suggestion wasn't initially very helpful but after tweaking things to something like this:

          Code:
          org.apache.juli.FileHandler.level = ALL
          org.apache.juli.FileHandler.directory = ${catalina.base}/logs
          org.apache.juli.FileHandler.prefix = conty-servlet.
          
          org.apache.catalina.core.ContainerBase.[Catalina].level = ALL
          org.apache.catalina.core.ContainerBase.[Catalina].directory = ${catalina.base}/logs
          org.apache.catalina.core.ContainerBase.[Catalina].prefix = conty-servlet.

          I was able to find out something a little more interesting in regards to hibernate cache:

          Code:
          Mar 07, 2012 2:35:27 PM org.apache.catalina.core.StandardContext listenerStart
          SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
          org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': 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.cache.NoCachingEnabledException: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]

          Comment


          • #6
            ***Solved***

            I was finally able to trace it down to the driverClassName definition for my MSSQL server driver in DataSource.groovy. For whatever reason changing it to "com.microsoft.sqlserver.jdbc.SQLServerDriver" from "com.microsoft.sqlserver.jdbc.SQLDataSource" did the trick. Now it works in both Tomcat 6 and 7.

            Comment


            • #7
              I had a similar problem [Grails 2.0.1 Web app not loading & no meaningful failure logs], but I'm using MySql as the data source.

              The solution was to manually create the database prior to Tomcat deployment.

              # mysql> create database <dbname>;

              Grails won't create the database for you; you must do it yourself.

              Comment

              Working...
              X