开发者

Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))

开发者 https://www.devze.com 2023-01-08 10:25 出处:网络
I recently deployed a working webapp on my localhost to amazon web services. The problem i\'m encountering is - though context.xml has username as \'james\', the exception stacktrace mentions otherwis

I recently deployed a working webapp on my localhost to amazon web services. The problem i'm encountering is - though context.xml has username as 'james', the exception stacktrace mentions otherwise.

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)

It is trying to connect to database with username 'root'. It it be because of caching of the file(context.xml)? How do I tackle that? I have restarted the web server as well, but it's not coming to effect.

Thanks in Advance.

EDIT:

Here's the content of 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"/>
<开发者_Go百科;/Context>

You can see it happening by clicking on Login or Register on the page: http://184.73.118.76/Links.jsp

Is there anything I need to do to bring context.xml changes to effect? I have carried out two actions:

1. touch web.xml in WEB-INF

2. Restart tomcat server.

Desperately need help here.

Thanks again. James.


Check your $CATALINA_BASE/conf/[enginename]/[hostname]/[webapp].xml, on default Tomcat this should be $CATALINA_BASE/conf/Catalina/localhost/[webapp].xml, tomcat create a copy of your context.xml and this probably was not updated when you update your 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.


Make sure there isn't a file named $CATALINA_BASE/conf/Catalina/localhost/yourapp.xml or that it doesn't contain another datasource definition to the same database with the username 'james'.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号