问题标签 [grails-3.1]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
526 浏览

tomcat - 如何使用 grails 3.1 为嵌入式 tomcat 设置 maxPostSize

我正在尝试将一个 JSON 中的 Base64 编码图像发布到grails 3.1.4后端。当 JSON 达到大于 2 MB 的大小时,POST操作将失败。由于连接管道损坏,不会调用控制器。

我假设这种行为是maxPostSize嵌入式 tomcat 的默认约束的结果。

由于之前上传大文件的问题,我已经设置了maxFileSizeand参数。maxRequestSize但这些值不会影响大型 JSON 的处理。

如何设置maxPostSizegrails 使用的嵌入式 tomcat 的值?我知道如何在独立的 tomcat 上进行设置 - 但我也想为我的开发环境配置它

0 投票
2 回答
478 浏览

grails - 如何使用 Intellij Idea 让 OpenCv 与 Grails 3 一起工作?

我无法让 OpenCV 与 Grails 一起工作。我有以下错误:

我在 "C:\opencv" 中安装了最新的 OpenCV (2.4.13),并添加了以下 Gradle 依赖项:

并编辑了运行配置: 在此处输入图像描述 但我仍然得到同样的错误(试图清理,重建......)

0 投票
1 回答
663 浏览

grails - Grails 3 - 检查命令对象值是否全部为空

我有一堂课:

我有一个我需要验证的 PersonCommand 类型的列表。我想遍历每个元素并检查 firstName 和 lastName 是否都为空。有没有办法在不明确检查这些属性的情况下做到这一点?我想做类似的事情:

但是 person.properties 添加了其他属性,而不仅仅是 firstName 和 lastName,因为它是 Validateable。我不是在寻求有关 areAllMapValuesNull() 函数的帮助,只是在获取值 firstName 和 lastName 而不对检查进行硬编码。

0 投票
1 回答
898 浏览

grails - Grails 3 Taglib:无法解析 IntelliJ IDEA 中的符号

我将 Grails 3.1.7 与 IntelliJ IDEA Ultimate 2016.1 一起使用。项目中有几个自定义标记库。标签按预期工作,但视图编辑器在每个标签使用时显示错误:

IntelliJ IDEA 截图

有没有办法配置正确显示的 IntelliJ 和/或 Grails?Grails 标签中的构建正确显示,并且跳转到源代码也可以正常工作。

编辑1:在某些标签上有一条消息,这里不允许,但跳转到源代码也不起作用

在此处输入图像描述

0 投票
1 回答
199 浏览

tomcat - 对使用 java -jar 部署的 Grails 3 webapp (Springboot) 应用程序使用 Logback 访问

如何配置使用 logback 作为默认日志框架来记录HTTP嵌入式 tomcat 的请求的 grails 3,就像 tomcat 应用程序服务器在创建日志访问日志文件时所做的那样?

我知道我必须使用logback 访问模块,但据说它适用于部署容器,例如 tomcat 和 jetty

0 投票
1 回答
742 浏览

grails - ElasticSearch 插件导致服务器在 Grails 3.1.6 中停止

我正在尝试在我的 Grails 3.1.6 项目中添加 ElasticSearch 插件。我将插件安装为:

并将 application.yml 配置为

但是当我尝试运行应用程序时,我收到如下错误:

我使用 IntellijIdea v2016 作为 IDE。

请有人帮我找出错误点。

谢谢。

0 投票
1 回答
423 浏览

grails - Grails 控制器/集成测试成功但永远挂起

绝对难倒这一点。

我有两个成功通过的控制器集成测试。但是,在 Intellij 或 via 中运行时gradle check,JVM 永远不会退出。如果我注释掉整个集成测试,JVM 就会干净地退出。

在调试任何集成测试时,我可以暂停并看到有几个线程处于不同的状态:WAITING、RUNNING、SLEEPING。

中使用的数据库application.yml纯粹是内存中的:

将此更改为基于文件并不能解决问题。改变DB_CLOSE_ON_EXIT=TRUE也无济于事。

我试过删除@Rollback甚至使用@Transactional超时,但这并不能解决它。

在新项目上创建集成测试不会出现死锁/挂起/等待。

我已经通过修订返回以找到此行为开始的变更集,但这些更改纯粹是在 GSP、控制器以及其中一个集成测试中的附加断言和测试方法中。

日志中的最后几行是:

我尝试将集成测试方法缩减为一种方法,但问题仍然存在。

我正在使用的版本是:

Windows 10 64 位。

这是一个线程转储。

我不知道如何进一步调试。有任何想法吗?

0 投票
1 回答
310 浏览

grails - 在弹性搜索 Grails 中解组域类错误

我正在尝试在 Grails 3.1.6 中使用 ElasticSearch 1.0.0.2。

域类是:

我在我的 SearchController 中注入了 ElasticSearchService 并尝试获取搜索结果:

但是得到这样的错误:

有人可以告诉我我犯了什么错误。谢谢。

0 投票
1 回答
1762 浏览

spring - How to configure SSL in Grails 3.1.6+?

We recently changed from using standalone Tomcat 8 containers to using the embedded Tomcat 8 container. We are having some trouble getting SSL to work on Grails 3.1.6 with the embedded container. We had been using the certificateFile approach with APR Native Libraries with the standalone container. We would like to keep this approach with the embedded Tomcat instead of changing to the keystore approach. I tried the Grails documentation, went deep into the Spring Boot embedded container documentation, but haven't found a working solution yet.

I tried many different configuration approaches in the application.yml. Based on several different pieces of documentation, sources, etc. my latest attempt was:

I also tried adding this to the end of the application.yml:

but this gave me a 'resource location may not be null' error. Most examples and questions I see are quite dated at this point. Time to ask a fresh question on stackoverflow. Thanks in advance!

0 投票
2 回答
3686 浏览

spring - Grails 3 - Spring Rest Docs 使用放心在使用 JSON 视图时给出 SnippetException

我正在尝试将 Spring REST 文档与 Grails 3.1.4 应用程序放心集成。我正在使用 JSON 视图。

完整代码在https://github.com/rohitpal99/rest-docs

在我使用 NoteController 时

文档生成效果很好。

但我想使用 JSON 视图,如

我在 /views 目录中有 _notes.gson 和 index.gson 文件。我得到一个 SnippetException。通常的 /notes GET 请求响应是正确的。

没有消息。无法追踪它发生的原因。请建议。

完整的堆栈跟踪