springBoot 绘制验证码出错!

1、springBoot版本 1.5.9
2、jdk 版本 1.8
问题描述:

http://localhost:35620/api/admin/login
2018-06-02 00:04:31.739 |-INFO  [XNIO-2 task-1] org.thymeleaf.TemplateEngine [825] -| [THYMELEAF] INITIALIZING TEMPLATE ENGINE
2018-06-02 00:04:31.849 |-INFO  [XNIO-2 task-1] org.thymeleaf.templateresolver.AbstractTemplateResolver [99] -| [THYMELEAF] INITIALIZING TEMPLATE RESOLVER: org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver
2018-06-02 00:04:31.850 |-INFO  [XNIO-2 task-1] org.thymeleaf.templateresolver.AbstractTemplateResolver [110] -| [THYMELEAF] TEMPLATE RESOLVER INITIALIZED OK
2018-06-02 00:04:31.851 |-INFO  [XNIO-2 task-1] org.thymeleaf.messageresolver.AbstractMessageResolver [72] -| [THYMELEAF] INITIALIZING MESSAGE RESOLVER: org.thymeleaf.spring4.messageresolver.SpringMessageResolver
2018-06-02 00:04:31.851 |-INFO  [XNIO-2 task-1] org.thymeleaf.messageresolver.AbstractMessageResolver [78] -| [THYMELEAF] MESSAGE RESOLVER INITIALIZED OK
2018-06-02 00:04:31.862 |-INFO  [XNIO-2 task-1] org.thymeleaf.TemplateEngine.CONFIG [123] -| [THYMELEAF] TEMPLATE ENGINE CONFIGURATION:
[THYMELEAF] * Cache Factory implementation: org.thymeleaf.cache.StandardCacheManager
[THYMELEAF] * Template modes:
[THYMELEAF]     * XHTML
[THYMELEAF]     * HTML5
[THYMELEAF]     * VALIDXML
[THYMELEAF]     * VALIDXHTML
[THYMELEAF]     * LEGACYHTML5
[THYMELEAF]     * XML
[THYMELEAF] * Template resolvers (in order):
[THYMELEAF]     * org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver
[THYMELEAF] * Message resolvers (in order):
[THYMELEAF]     * org.thymeleaf.spring4.messageresolver.SpringMessageResolver
[THYMELEAF] * Dialect [1 of 2]: org.thymeleaf.spring4.dialect.SpringStandardDialect
[THYMELEAF]     * Prefix: "th"
[THYMELEAF] * Dialect [2 of 2]: nz.net.ultraq.thymeleaf.LayoutDialect
[THYMELEAF]     * Prefix: "layout"
[THYMELEAF] TEMPLATE ENGINE CONFIGURED OK
2018-06-02 00:04:31.863 |-INFO  [XNIO-2 task-1] org.thymeleaf.TemplateEngine [838] -| [THYMELEAF] TEMPLATE ENGINE INITIALIZED
http://localhost:35620/api/admin/verify-code
http://localhost:35620/api/error

访问首页, 会请求绘制验证码,但是在绘制的时候,输出了 http://localhost:35620/api/error 这个。在windows 下面不会跳转到error页面,能成功登入,部署到linux上面,立马跳转到error页面。

我debug的时候,发现在执行完

 BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

这条语句时,就会出错,但是出错的原因完全不清楚。

备注: 嵌入式的服务器用的是 undertow, 不是用tomcat

波斯汪
浏览 509回答 1
1回答

繁星淼淼

有点恶心 我配置了 错误页面。 发布到线上环境时, 因为在跳转至首页的时候,用了绝对路径。 例如 modelAndView.setViewName("/login")。线上环境应该使用相对路径,例如 modelAndView.setViewName("login")。这个才是正确的。然后今天我重新启动,发现竟然控制台没有打印 localhost/api/error 了。。。。 无语啊~
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java