500 error on the first request deploying in production an an



我在生产enter code here中部署了Angular/springboot应用程序

当我启动java后端部分(以jar运行(时,似乎一切都正常,因为加载了sql脚本,并且有一个计划任务在6:30运行因此,我还使用nginx部署了Angular前端部分。

当我点击url时,会显示index.html,并且与该文件相关的css和js加载请求会运行而不会出现任何错误。但第一次身份验证的角度要求http://myrequest/api/principal返回500错误。该url命中以下方法

@GetMapping("/principal")
public CustomUserDetails getUserPrincipal(HttpServletRequest request) {
return (CustomUserDetails) ((UsernamePasswordAuthenticationToken) request.getUserPrincipal()).getPrincipal();
}

该错误没有记录在springboot的日志中(后端部分(。相反,在前端部分,消息是

ERROR Error: Uncaught (in promise): Dw: {"headers":{"normalizedNames":{},"lazyUpdate":null},"status":500,"statusText":"Internal Server Error","url":"http://myrequest/api/principal","ok":false,"name":"HttpErrorResponse","message":"Http failure response for http://myrequest/api/principal: 500 Internal Server Error","error":"<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">n<html><head>n<title>500 Internal Server Error</title>n</head><body>n<h1>Internal Server Error</h1>n<p>The server encountered an internal error ornmisconfiguration and was unable to completenyour request.</p>n<p>Please contact the server administrator at n department@mycompany.eu to inform them of the time this error occurred,n and the actions you performed just before this error.</p>n<p>More information about this error may be availablenin the server error log.</p>n</body></html>n"}
at T (polyfills-es2015.8937eca6b008719608f2.js:1)
at T (polyfills-es2015.8937eca6b008719608f2.js:1)
at polyfills-es2015.8937eca6b008719608f2.js:1
at l.invokeTask (polyfills-es2015.8937eca6b008719608f2.js:1)

如何调试此错误?

我找到了解决方案,当我部署在端口为80的nginx服务器上时,解决方案是部署在端口8080上。感谢您的帮助

相关内容

最新更新