开发者

Problem related to spring/resources.xml while deploying Grails applicatoin war in tomcat

I have developed an application (named CBR) in Grails 1.3.7. When i run it with "grails run-app" or "grails run-app prod" it works fine. However when i create a war using "grails war" command and then deploy this war in Tomcat 6.0.32 i see following exception:

            Sep 22, 2011 1:55:57 PM org.apache.catalina.startup.HostConfig deployWAR
            INFO: Deploying web application archive CBR.war
            context.ContextLoader Context initialization failed
            org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 1 in
             XML document from ServletContext resource [/WEB-INF/spring/resources.xml] is in
            valid; nested exception is org.xml.sax.SAXParseException: Premature end of file.

                    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:723)
                    at grails.spring.BeanBuilder.beans(BeanBuilder.java:573)
                    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:519)
            Caused by: org.xml.sax.SAXParseException: Premature end of file.
                    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
                    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
                    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
                    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
                    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1059)
                    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
                    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
                    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
                    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
                    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
                    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
                    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
                    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
                    ... 3 more
            Sep 22, 2011 1:57:48 PM o开发者_开发知识库rg.apache.catalina.core.StandardContext start
            SEVERE: Error listenerStart
            Sep 22, 2011 1:57:48 PM org.apache.catalina.core.StandardContext start
            SEVERE: Context [/CBR] startup failed due to previous errors

Although the project was fully unpacked. I have checked conf/spring/resources.xml ... its empty.

I have ready all the threads similar to war deployment problem in Tomcat, but was unable to sort it out.

Following is the code from my config.groovy file:

environments {
  production {
    grails.serverURL = "http://localhost:8080/${appName}"
  }
  development {
    grails.serverURL = "http://localhost:8080/${appName}/auth"
  }
  test {
    grails.serverURL = "http://localhost:8080/${appName}"
  }
}

And, from Datasource.groovy file:

environments {
  development {
    dataSource {
      dbCreate = "create-drop" // one of 'create', 'create-drop','update'
      url = "jdbc:mysql://localhost:3306/cbr?autoreconnect=true"
    }
  }
  test {
    dataSource {
      dbCreate = "update"
      url = "jdbc:mysql://localhost:3306/cbr?autoreconnect=true"
    }
  }
  production {
    dataSource {
      dbCreate = "update"
      url = "jdbc:mysql://localhost:3306/cbr_prod?autoreconnect=true"
    }
  }
}

And some more detail from application.properties file:

app.grails.version=1.3.7
app.name=CBR
app.servlet.version=2.4
app.version=0.1
plugins.autotranslate=0.3
plugins.hibernate=1.3.7
plugins.message-reports=0.1
plugins.navigation=1.2
plugins.richui=0.8
plugins.shiro=1.1.3
plugins.tomcat=1.3.7
plugins.xfire=0.8.3

I have spent last 2 days to sort out the issue. Please help me, it took me 1 month to develop this application.


This may not be much of an answer, but something you should definitely try before you tie yourself in a knot...

The first things I mistrust when I run into issues where something should obviously work, are the state of my build and the state of my machine's configuration.

Since you haven't gone through the complete build-deploy cycle yet, you might make sure that it would work at all with your configuration.

Build a simple Hello World grails app, generate the war file and deploy it. If that works, I'd start adding plugins and config changes to see if any of these break anything. Shouldn't take you more than 20 minutes.

Good Luck

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜