我无法在春季MVC JDBC项目上连接到我的DB
我有一个Spring MVC项目,当他们输入所需的用户名和密码时,应该注册一些项目,但是每当用户输入其用户名和密码时,我都会收到错误“从类Path Resources加载XML BEAN定义[beans.xml]
org.springframework.jdbc.cannotgetjdbcconnectionexception:无法获得JDBC连接; com.mysql.jdbc.exceptions.jdbc4.mysqlnontransientConnectionException:无法创建与数据库服务器的连接。”
这是处理寄存器并具有寄存器控制器的Java文件
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<form action="register">
<div class="imgcontainer">
<img src="img_avatar2.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="userName" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" required>
<button type="submit">Register</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</html>
这是处理寄存器的Java文件,并在此处具有寄存器控制器,
package com.springmvctim.controller;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.springmvctim.dao.LoginService;
import com.springmvctim.model.UserAuto;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
//import com.springmvctim.dao.LoginService;
//import com.springmvctim.model.UserAuto;
@Controller
public class LoginController {
private LoginService login_service;
@RequestMapping(value="/register", method=RequestMethod.GET)
public String register(HttpServletRequest request, HttpServletResponse response
) {
ApplicationContext ap = new ClassPathXmlApplicationContext("beans.xml");
login_service = (LoginService)ap.getBean("ldao");
String user_name = request.getParameter("userName");
String password = request.getParameter("password");
UserAuto user = new UserAuto();
user.setUserName(user_name);
user.setPassword(password);
//LoginService login_service = new LoginService();
try {
login_service.InsertUser(user,true);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "display.jsp";
}
}
这是处理本应实际输入用户到DB的DAO类,此处创建了insteruser方法,
package com.springmvctim.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Base64;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
//import org.eclipse.jdt.internal.compiler.ast.ThisReference;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.mysql.jdbc.ResultSetMetaData;
import com.springmvctim.dbservice.DBConnection;
import com.springmvctim.model.UserAuto;
@Repository
public class LoginService {
private DataSource dataSource;
private JdbcTemplate jdbcTemplate;
public void setjdbcTemplate(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public void InsertUser(UserAuto user, boolean isEncrypted) throws SQLException {
Connection con = null;
try {
//con= DBConnection.getConnection();
Base64.Encoder encoder = Base64.getUrlEncoder();
String password = (isEncrypted) ? encoder.encodeToString(user.getPassword().getBytes()) : user.getPassword();
String insert = "INSERT INTO `user`(user_name,password) VALUE('"+user.getUserName()+"','"+password+"') " ;
//jdbcTemplateObject = new JdbcTemplate();
// con.prepareStatement(insert).executeQuery();
jdbcTemplate.update(insert);
}catch(Exception e) {
System.out.print(e);
}
}
}
此处是我放入的bean.xml 这里的资源文件夹
<?xml version = "1.0" encoding = "UTF-8"?>
<beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">
<!-- Initialization for data source -->
<bean id="jdbcTemplate"
class = "org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name = "driverClassName" value = "com.mysql.jdbc.Driver"/>
<property name = "url" value = "jdbc:mysql://localhost:3306/Automation"/>
<property name = "username" value = "root"/>
<property name = "password" value = "Password"/>
</bean>
<!-- Definition for studentJDBCTemplate bean -->
<bean id = "ldao"
class = "com.springmvctim.dao.LoginService">
<property name = "jdbcTemplate" ref = "jdbcTemplate" />
</bean>
</beans>
是连接到dispathcher servlet的web.xml
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springtest-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
,这是web.xml调用的调度程序,
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:ctx="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd ">
<ctx:component-scan base-package="com.springmvctim.controller"></ctx:component-scan>
<ctx:annotation-config></ctx:annotation-config>
</beans>
我还确保我在pom.xml
我能够干净并安装。我尝试清洁项目和Tomcat服务器。我曾尝试针对所有Maven依赖项的部署组件,但这无效。
这是日志
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.63
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 11 2022 07:52:11 UTC
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.63.0
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.15.7
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 17.0.1+12-LTS-39
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /Users/tismith/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /Users/tismith/Downloads/apache-tomcat-9.0.63
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/tismith/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/Users/tismith/Downloads/apache-tomcat-9.0.63
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/tismith/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -XX:+ShowCodeDetailsInExceptionMessages
Jun 29, 2022 9:25:01 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/Users/tismith/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
Jun 29, 2022 9:25:01 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [582] milliseconds
Jun 29, 2022 9:25:01 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Jun 29, 2022 9:25:01 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.63]
Jun 29, 2022 9:25:02 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jun 29, 2022 9:25:02 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jun 29, 2022 9:25:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Jun 29, 2022 9:25:02 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization started
Jun 29, 2022 9:25:02 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Wed Jun 29 21:25:02 EDT 2022]; root of context hierarchy
Jun 29, 2022 9:25:02 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/springtest-servlet.xml]
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/register] onto handler 'loginController'
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/register.*] onto handler 'loginController'
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/register/] onto handler 'loginController'
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 539 ms
Jun 29, 2022 9:25:03 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Jun 29, 2022 9:25:03 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [1895] milliseconds
Jun 29, 2022 9:25:04 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/SpringMVC/img_avatar2.png] in DispatcherServlet with name 'dispatcher'
Jun 29, 2022 9:25:17 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4efcd47c: startup date [Wed Jun 29 21:25:17 EDT 2022]; root of context hierarchy
Jun 29, 2022 9:25:17 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [beans.xml]
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
I have a spring mvc project that is supposed to register some one when they enter their desired username and password, but when ever the user enters their username and password i get the error "Loading XML bean definitions from class path resource [beans.xml]
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server."
here is the java file that handles the register for and has a register controller
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<form action="register">
<div class="imgcontainer">
<img src="img_avatar2.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="userName" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="password" required>
<button type="submit">Register</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</html>
here is the java file that handles the register for and has a register controller
package com.springmvctim.controller;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.springmvctim.dao.LoginService;
import com.springmvctim.model.UserAuto;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
//import com.springmvctim.dao.LoginService;
//import com.springmvctim.model.UserAuto;
@Controller
public class LoginController {
private LoginService login_service;
@RequestMapping(value="/register", method=RequestMethod.GET)
public String register(HttpServletRequest request, HttpServletResponse response
) {
ApplicationContext ap = new ClassPathXmlApplicationContext("beans.xml");
login_service = (LoginService)ap.getBean("ldao");
String user_name = request.getParameter("userName");
String password = request.getParameter("password");
UserAuto user = new UserAuto();
user.setUserName(user_name);
user.setPassword(password);
//LoginService login_service = new LoginService();
try {
login_service.InsertUser(user,true);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "display.jsp";
}
}
here is the dao class that handles that is supposed to actually enter the user into the db where the InsertUser method is created
package com.springmvctim.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Base64;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
//import org.eclipse.jdt.internal.compiler.ast.ThisReference;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.mysql.jdbc.ResultSetMetaData;
import com.springmvctim.dbservice.DBConnection;
import com.springmvctim.model.UserAuto;
@Repository
public class LoginService {
private DataSource dataSource;
private JdbcTemplate jdbcTemplate;
public void setjdbcTemplate(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
public void InsertUser(UserAuto user, boolean isEncrypted) throws SQLException {
Connection con = null;
try {
//con= DBConnection.getConnection();
Base64.Encoder encoder = Base64.getUrlEncoder();
String password = (isEncrypted) ? encoder.encodeToString(user.getPassword().getBytes()) : user.getPassword();
String insert = "INSERT INTO `user`(user_name,password) VALUE('"+user.getUserName()+"','"+password+"') " ;
//jdbcTemplateObject = new JdbcTemplate();
// con.prepareStatement(insert).executeQuery();
jdbcTemplate.update(insert);
}catch(Exception e) {
System.out.print(e);
}
}
}
Here is the bean.xml that I put in the resources folder
<?xml version = "1.0" encoding = "UTF-8"?>
<beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation = "http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd ">
<!-- Initialization for data source -->
<bean id="jdbcTemplate"
class = "org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name = "driverClassName" value = "com.mysql.jdbc.Driver"/>
<property name = "url" value = "jdbc:mysql://localhost:3306/Automation"/>
<property name = "username" value = "root"/>
<property name = "password" value = "Password"/>
</bean>
<!-- Definition for studentJDBCTemplate bean -->
<bean id = "ldao"
class = "com.springmvctim.dao.LoginService">
<property name = "jdbcTemplate" ref = "jdbcTemplate" />
</bean>
</beans>
Here is the web.xml that connects to the dispathcher servlet
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/springtest-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
and here is the dispatcher that is being called by the web.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:ctx="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd ">
<ctx:component-scan base-package="com.springmvctim.controller"></ctx:component-scan>
<ctx:annotation-config></ctx:annotation-config>
</beans>
I also made sure that I have mysql connector in pom.xml
I am able to maven clean and install. I have tried cleaning the project and the tomcat server. I have tried Deployment assembly for all the maven dependencies but this did not work.
Here are the logs
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name: Apache Tomcat/9.0.63
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: May 11 2022 07:52:11 UTC
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 9.0.63.0
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Mac OS X
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 10.15.7
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: x86_64
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 17.0.1+12-LTS-39
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /Users/tismith/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /Users/tismith/Downloads/apache-tomcat-9.0.63
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=/Users/tismith/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=/Users/tismith/Downloads/apache-tomcat-9.0.63
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=/Users/tismith/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.lang=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.io=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.base/java.util.concurrent=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=UTF-8
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -XX:+ShowCodeDetailsInExceptionMessages
Jun 29, 2022 9:25:01 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows using OpenSSL was not found on the java.library.path: [/Users/tismith/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
Jun 29, 2022 9:25:01 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Jun 29, 2022 9:25:01 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [582] milliseconds
Jun 29, 2022 9:25:01 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Jun 29, 2022 9:25:01 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/9.0.63]
Jun 29, 2022 9:25:02 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jun 29, 2022 9:25:02 PM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jun 29, 2022 9:25:02 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Jun 29, 2022 9:25:02 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization started
Jun 29, 2022 9:25:02 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Wed Jun 29 21:25:02 EDT 2022]; root of context hierarchy
Jun 29, 2022 9:25:02 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/springtest-servlet.xml]
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/register] onto handler 'loginController'
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/register.*] onto handler 'loginController'
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping registerHandler
INFO: Mapped URL path [/register/] onto handler 'loginController'
Jun 29, 2022 9:25:03 PM org.springframework.web.servlet.DispatcherServlet initServletBean
INFO: FrameworkServlet 'dispatcher': initialization completed in 539 ms
Jun 29, 2022 9:25:03 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
Jun 29, 2022 9:25:03 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in [1895] milliseconds
Jun 29, 2022 9:25:04 PM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/SpringMVC/img_avatar2.png] in DispatcherServlet with name 'dispatcher'
Jun 29, 2022 9:25:17 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4efcd47c: startup date [Wed Jun 29 21:25:17 EDT 2022]; root of context hierarchy
Jun 29, 2022 9:25:17 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [beans.xml]
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论