gpt4 book ai didi

java - 无法创建 PoolableConnectionFactory(用户 'root' @'localhost' 的访问被拒绝(使用密码 : YES))

转载 作者:行者123 更新时间:2023-11-29 01:00:55 25 4
gpt4 key购买 nike

我最近在我的本地主机上部署了一个工作网络应用程序到亚马逊网络服务。我遇到的问题是 - 尽管 context.xml 的用户名是“james”,但异常堆栈跟踪另有说明。

org.apache.jasper.JasperException: org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

它正在尝试使用用户名“root”连接到数据库。是因为文件(context.xml)的缓存吗?我该如何解决?我也重新启动了网络服务器,但它没有生效。

提前致谢。

编辑:

这是 context.xml 的内容:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiResourceLocking="false" privileged="true" >
<Resource
name="jdbc/NetmarketDB"
auth="Container"
type="javax.sql.DataSource"
removeAbandoned="true"
removeAbandonedTimeout="30"
maxActive="100"
maxIdle="30"
maxWait="1000"
username="james"
password="xxxxxxxxxx"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/ams"/>
</Context>

您可以通过单击页面上的LoginRegister 来查看它的发生: http://184.73.118.76/Links.jsp

我需要做些什么才能使 context.xml 更改生效吗?我执行了两个操作:
1. touch web.xml在WEB-INF
2.重启tomcat服务器。

在这里迫切需要帮助。

再次感谢。詹姆斯。

最佳答案

检查你的 $CATALINA_BASE/conf/[enginename]/[hostname]/[webapp].xml,在默认的 Tomcat 上这应该是 $CATALINA_BASE/conf/Catalina/localhost/[webapp].xml,tomcat 创建一个副本你的 context.xml 并且这可能在你更新你的 context.xml 时没有更新

Tomcat Context Container Reference

$CATALINA_BASE/conf/[enginename]/[hostname]/, in an individual file at /META-INF/context.xml inside the application files. If the web application is packaged as a WAR then /META-INF/context.xml will be copied to $CATALINA_BASE/conf/[enginename]/[hostname]/ and renamed to match the application's context path. Once this file exists, it will not be replaced if a new WAR with a newer /META-INF/context.xml is placed in the host's appBase.

关于java - 无法创建 PoolableConnectionFactory(用户 'root' @'localhost' 的访问被拒绝(使用密码 : YES)),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3299317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com