2016-02-04 30 views
1

我創建了一個Grails 3(.1.0)應用程序。Grails3 with application.groovy在Tomcat中顯示損壞的頁面

當我做以下步驟:

  • 具有同等application.groovy
  • 替換默認application.yaml生成戰爭文件
  • 部署WAR文件在Tomcat中8(.0.30)
  • 打開應用程序頁面(http://localhost:8080

然後,我得到一個頁面,米是所有樣式和JavaScript。 Blank Grails page

我在做什麼錯? 我的application.groovy有問題嗎?

grails { 
    profile = "web" 
    codegen { 
     defaultPackage = "empty31" 
    } 
} 

info { 
    app { 
     name = 'empt31' 
     version = '0.1' 
     grailsVersion = '3.1.0' 
    } 
} 

spring { 
    groovy { 
     template['check-template-location'] = false 
    } 
} 

server { 
    contextPath = '/empty31' 
} 

grails { 
    mime { 
     disable { 
      accept { 
       header { 
        userAgents = ['Gecko', 'WebKit', 'Presto', 'Trident'] 
       } 
      } 
     } 

     types { 
      all = '*/*' 
      atom = 'application/atom+xml' 
      css = 'text/css' 
      csv = 'text/csv' 
      form = 'application/x-www-form-urlencoded' 
      html = ['text/html', 'application/xhtml+xml'] 
      js = 'text/javascript' 
      json = ['application/json', 'text/json'] 
      multipartForm = 'multipart/form-data' 
      rss = 'application/rss+xml' 
      text = 'text/plain' 
      hal = ['application/hal+json', 'application/hal+xml'] 
      xml = ['text/xml', 'application/xml'] 
     } 
    } 
    urlmapping { 
     cache { 
      maxsize = 1000 
     } 
    } 
    controllers { 
     defaultScope = 'singleton' 
    } 
    converters { 
     encoding = 'UTF-8' 
    } 
    views { 
     'default' { codec = 'html' } 
     gsp { 
      encoding = 'UTF-8' 
      htmlcodec = 'xml' 
      codecs { 
       expression = 'html' 
       scriptlets = 'html' 
       taglib = 'none' 
       staticparts = 'none' 
      } 
     } 
    } 
} 

endpoints { 
    jmx['unique-names'] = true 
} 

hibernate { 
    cache { 
     queries = false 
     use_second_level_cache = true 
     use_query_cache = false 
     region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' 
    } 
} 

dataSource { 
    pooled = true 
    jmxExport = true 
    driverClassName = "org.h2.Driver" 
    username = 'sa' 
    password = '' 
} 

environments { 
    development { 
     dataSource { 
      dbCreate = 'create-drop' 
      url = 'jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE' 
     } 
    } 
    test { 
     dataSource { 
      dbCreate = 'update' 
      url = 'jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE' 
     } 
    } 
    production { 
     dataSource { 
      dbCreate = 'update' 
      url = 'jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE' 
      properties { 
       jmxEnabled = true 
       initialSize = 5 
       maxActive = 50 
       minIdle = 5 
       maxIdle = 25 
       maxWait = 10000 
       maxAge = 600000 
       timeBetweenEvictionRunsMillis = 5000 
       minEvictableIdleTimeMillis = 60000 
       validationQuery = 'SELECT 1' 
       validationQueryTimeout = 3 
       validationInterval = 15000 
       testOnBorrow = true 
       testWhileIdle = true 
       testOnReturn = false 
       jdbcInterceptors = 'ConnectionState' 
       defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED 
      } 
     } 
    } 
} 

回答

0

如果您還原爲application.yml,會發生什麼情況?

+0

工作資產版本今天測試兩個版本(.groovy作爲和.yml),並用鍍鉻DevTools面板打開添加截圖我的方法是。但是我們支持的其他軟件的問題一直佔用我的時間。將在週一進一步測試。 –

0

看起來有些事情與您的資產管道有關。嘗試grails run-app或直接運行戰爭 - 如果這可能是我們曾經通過跳過grails版本(類似於3.0.3到3.0.7)避免的資產管道錯誤。

您也可以嘗試禁用與grails.assets.bundle =假捆綁,並看看是否有幫助的時刻;)

檢查您的

apply plugin: "asset-pipeline" 

assets { 
    minifyJs = true 
    minifyCss = true 
} 

dependencies { 
    ... 
    runtime "org.grails.plugins:asset-pipeline" 
    ... 
} 

gradle.build它也將如果恢復到application.yml,請注意這個問題,因爲這個錯誤可能發生在我們引入彈出安全核心插件的時候,該插件會帶來application.groovy開箱即用...

EDIT1: 在這裏,我們目前正與

buildscript { 
    dependencies { 
     classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.0.20' 
    } 
} 

plugins { 
    id 'com.bertramlabs.asset-pipeline' version '2.5.0' 
} 
+0

grails run-app工作正常。我也嘗試回到資產插件3.0.1,作爲解決grails問題的建議,但這並沒有幫助。將嘗試grails.assets.bundle = false –

+0

我添加了grails.assets.bundle = false到application.groovy,但仍然是相同的結果 –

+0

恢復到application.yml不是一個真正的選擇,因爲我們想要使用joda-time插件作爲sprint-security-core插件。至少對於喬達時間插件,我不知道如何使用.yml映射'用戶類型'映射(因爲它默認爲閉合) –