[英]GlassFish HTTP Status 500 - Internal Server Error(JSTL)
當我嘗試使用 JSP 運行我的 Web 應用程序時,GlassFish 服務器返回以下消息:
HTTP Status 500 - Internal Server Error
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
root cause
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
note The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 5.1.0 logs.
GlassFish Server Open Source Edition 5.1.0
我不知道該怎么辦。 我認為錯誤與Can't find javax.servlet.jsp.jstl.jar library in glassfish server 有關
您需要將 MySQL JDBC jar 文件提供給 Glassfish。
https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-usagenotes-glassfish-config.html
所以我想通了,我所要做的就是將數據源類名設置為
com.mysql.cj.jdbc.MysqlDataSource
因為我使用的是 MySql 連接器 J 版本 8。
最初我將數據源類名設置為
com.mysql.jdbc.jdbc2.optional.MySqlDataSource
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.