部署在JBoss上的grails app会找不到404状态资源

时间:2013-02-19 19:47:07

标签: grails jboss web.xml

成功地在JBoss 4.2上部署grails war(遵循所有hack以使其工作)

INFO  [org.jboss.web.tomcat.service.TomcatDeployer] deploy, ctxPath=/hello-0.1, warUrl=.../tmp/deploy/tmp2535731769294056658hello-0.1-exp.war/
WARN  [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context '/hello-0.1'

但是

http://myhostname:8080/hello-0.1/

给出404错误。我尝试了许多不同的路径来获取资源,但无济于事

message /hello-0.1/
description The requested resource (/hello-0.1/) is not available.

使用grails run-app在本地运行正常:

http://localhost:8080/hello/hello/index

我觉得我需要在web.xml或jboss-web.xml

中设置它
<jboss-web>
        <context-root>hello-0.1</context-root>  
        <loader-repository>
            com.hello:archive=hello-0.1.war
            <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
        </loader-repository>
</jboss-web>

日志

2013-02-25 06:09:26,179 INFO  [org.jboss.web.tomcat.service.TomcatDeployer] deploy, ctxPath=/hello, warUrl=.../tmp/deploy/tmp8355669251173232249hello-exp.war/
2013-02-25 06:09:26,179 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] AbstractWebContainer.parseWebAppDescriptors, Begin
2013-02-25 06:09:26,180 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] Creating ENC using ClassLoader: java.net.FactoryURLClassLoader@1731334
2013-02-25 06:09:26,180 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] ..org.jboss.mx.loading.UnifiedClassLoader3@b98fe1{ url=file:../jboss-4.2.3.GA/server/default/tmp/deploy/tmp8355669251173232249hello-exp.war/ ,addedOrder=31}
2013-02-25 06:09:26,180 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] ..org.jboss.system.server.NoAnnotationURLClassLoader@1dd7056
2013-02-25 06:09:26,180 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] ..sun.misc.Launcher$AppClassLoader@cac268
2013-02-25 06:09:26,180 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] ..sun.misc.Launcher$ExtClassLoader@1a16869
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] Unable to retrieve orbjavax.management.InstanceNotFoundException: jboss:service=CorbaORB is not registered.
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] Linked java:comp/UserTransaction to JNDI name: UserTransaction
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] addEnvEntries
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkResourceEnvRefs
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkResourceRefs
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkMessageDestinationRefs
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkEjbRefs
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkEjbLocalRefs
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkServiceRefs
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] linkSecurityDomain
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] No security-domain given, using default: java:/jaas/other
2013-02-25 06:09:26,181 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] Linking security/securityMgr to JNDI name: java:/jaas/other
2013-02-25 06:09:26,182 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] AbstractWebContainer.parseWebAppDescriptors, End
2013-02-25 06:09:26,193 DEBUG [org.jboss.web.tomcat.service.TomcatDeployer] Using session cookies default setting
2013-02-25 06:09:26,453 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] ConfigureListener.contextInitialized(/hello)
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.displayConfiguration' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.validateXml' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.verifyObjects' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.forceLoadConfiguration' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enableHtmlTagLibValidator' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.preferXHTML' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.compressViewState' - ENABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.compressJavaScript' - ENABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.externalizeJavaScript' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.sendPoweredByHeader' - ENABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enableJSStyleHiding' - DISABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enableScriptsInAttributeValues' - ENABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.writeStateAtFormEnd' - ENABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enableLazyBeanValidation' - ENABLED
2013-02-25 06:09:26,454 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enabledLoadBundle11Compatibility' - DISABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enableRestoreView11Compatibility' - DISABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.serializeServerState' - DISABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.enableViewStateIdRendering' - ENABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.registerConverterPropertyEditors' - DISABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.disableUnicodeEscaping' - DISABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/hello] Configuration option 'com.sun.faces.developmentMode' - DISABLED
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'javax.faces.STATE_SAVING_METHOD' set to 'server'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'javax.faces.DEFAULT_SUFFIX' set to '.jsp'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'com.sun.faces.numberOfViewsInSession' set to '15'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'com.sun.faces.numberOfLogicalViews' set to '15'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'com.sun.faces.injectionProvider' set to 'org.jboss.web.jsf.integration.injection.JBossInjectionProvider'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'com.sun.faces.responseBufferSize' set to '1024'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'com.sun.faces.clientStateWriteBufferSize' set to '8192'
2013-02-25 06:09:26,455 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/hello] Configuration option 'com.sun.faces.expressionFactory' set to 'com.sun.el.ExpressionFactoryImpl'
2013-02-25 06:09:26,461 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] No FacesServlet found in deployment descriptor - bypassing configuration

2 个答案:

答案 0 :(得分:1)

在本地,您似乎将上下文根配置为/hello。当您部署到JBoss时,您的jboss-web.xml告诉JBoss将hello-0.1用于context-root

您需要在Config.groovy中设置上下文根匹配,grails.app.context(或app.context中的application.properties)和context-root中的jboss-web.xml 1}}。

答案 1 :(得分:1)

您是否构建了战争并将其放入部署目录中?不需要黑客。来自文档:

JBoss 4.2

部署到JBoss 4.2是微不足道的,只需启动JBoss然后将WAR文件放入JBOSS_HOME / server / default / deploy目录(或您要部署到的相关配置文件)。 JBoss将自动部署Grails应用程序,然后可以通过以下方式访问:

http://localhost:8080/myapp-0.1

http://grails.org/Deployment#JBoss%204.2