正在回答 回答被采纳积分+1
F:\Download\apache-tomcat-8.5.42\bin\catalina.bat run
[2019-07-13 01:14:14,771] Artifact PicShop:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE: "C:\Users\Administrator\.IntelliJIdea2018.1\system\tomcat\Tomcat_8_5_42_Shop"
Using CATALINA_HOME: "F:\Download\apache-tomcat-8.5.42"
Using CATALINA_TMPDIR: "F:\Download\apache-tomcat-8.5.42\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.8.0_121"
Using CLASSPATH: "F:\Download\apache-tomcat-8.5.42\bin\bootstrap.jar;F:\Download\apache-tomcat-8.5.42\bin\tomcat-juli.jar"
13-Jul-2019 13:14:15.794 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.5.42
13-Jul-2019 13:14:15.801 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Jun 4 2019 20:29:04 UTC
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.5.42.0
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Windows 10
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 10.0
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home: C:\Program Files\Java\jdk1.8.0_121\jre
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.8.0_121-b13
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: C:\Users\Administrator\.IntelliJIdea2018.1\system\tomcat\Tomcat_8_5_42_Shop
13-Jul-2019 13:14:15.802 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: F:\Download\apache-tomcat-8.5.42
13-Jul-2019 13:14:15.803 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\Administrator\.IntelliJIdea2018.1\system\tomcat\Tomcat_8_5_42_Shop\conf\logging.properties
13-Jul-2019 13:14:15.803 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
13-Jul-2019 13:14:15.803 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
13-Jul-2019 13:14:15.803 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
13-Jul-2019 13:14:15.803 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\Administrator\.IntelliJIdea2018.1\system\tomcat\Tomcat_8_5_42_Shop
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=F:\Download\apache-tomcat-8.5.42
13-Jul-2019 13:14:15.804 淇℃伅 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=F:\Download\apache-tomcat-8.5.42\temp
13-Jul-2019 13:14:15.805 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5].
13-Jul-2019 13:14:15.805 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
13-Jul-2019 13:14:15.805 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
13-Jul-2019 13:14:15.811 淇℃伅 [main] org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018]
13-Jul-2019 13:14:15.968 淇℃伅 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
13-Jul-2019 13:14:15.986 淇℃伅 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Jul-2019 13:14:16.021 淇℃伅 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
13-Jul-2019 13:14:16.024 淇℃伅 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Jul-2019 13:14:16.025 淇℃伅 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 599 ms
13-Jul-2019 13:14:16.063 淇℃伅 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
13-Jul-2019 13:14:16.064 淇℃伅 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.42
13-Jul-2019 13:14:16.095 淇℃伅 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
13-Jul-2019 13:14:16.109 淇℃伅 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
13-Jul-2019 13:14:16.112 淇℃伅 [main] org.apache.catalina.startup.Catalina.start Server startup in 86 ms
Connected to server
[2019-07-13 01:14:16,350] Artifact PicShop:war exploded: Artifact is being deployed, please wait...
13-Jul-2019 13:14:16.599 璀﹀憡 [RMI TCP Connection(3)-127.0.0.1] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [4.0]. Default version will be used.
[2019-07-13 01:14:16,794] Artifact PicShop:war exploded: Artifact is deployed successfully
[2019-07-13 01:14:16,794] Artifact PicShop:war exploded: Deploy took 444 milliseconds
13-Jul-2019 13:14:26.101 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [F:\Download\apache-tomcat-8.5.42\webapps\manager]
13-Jul-2019 13:14:26.149 淇℃伅 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [F:\Download\apache-tomcat-8.5.42\webapps\manager] has finished in [47] ms
aaa 12
//谢谢老师,老师辛苦了,刚刚我查了资料和调试了还是不行,
package com.imooc.utils; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.sql.DataSource; import com.mchange.v2.c3p0.ComboPooledDataSource; /** * JDBC的工具类 * */ public class JDBCUtils { public static final ComboPooledDataSource dataSource = new ComboPooledDataSource(); /** * 获得连接 * @throws Exception */ public static Connection getConnection() throws Exception{ return dataSource.getConnection(); } /** * 获得连接池 */ public static DataSource getDataSource(){ return dataSource; } /** * 释放资源 */ public static void release(ResultSet rs,Statement stmt,Connection conn){ if(rs != null){ try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } rs = null; } if(stmt != null){ try { stmt.close(); } catch (SQLException e) { e.printStackTrace(); } stmt = null; } if(conn != null){ try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } conn = null; } } public static void release(Statement stmt,Connection conn){ if(stmt != null){ try { stmt.close(); } catch (SQLException e) { e.printStackTrace(); } stmt = null; } if(conn != null){ try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } conn = null; } } } package com.imooc.dao.impl; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import com.imooc.dao.UserDao; import com.imooc.domain.User; import com.imooc.utils.JDBCUtils; public class UserDaoImpl implements UserDao { @Override public User login(User user) { Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; try{ // 获得连接 conn = JDBCUtils.getConnection(); // 编写SQL String sql = "select * from user where username = ? and password = ?"; // 预编译SQL pstmt = conn.prepareStatement( sql); // 设置参数 pstmt.setString(1, user.getUsername()); pstmt.setString(2, user.getPassword()); // 执行 rs = pstmt.executeQuery(); if(rs.next()){ User existUser = new User(); existUser.setUid(rs.getInt("uid")); existUser.setUsername(rs.getString("username")); existUser.setPassword(rs.getString("password")); return existUser; } }catch(Exception e){ e.printStackTrace(); }finally{ // 释放资源 JDBCUtils.release(rs, pstmt, conn); } return null; } }
- 参与学习 人
- 提交作业 357 份
- 解答问题 8016 个
本阶段将带你学习MySQL数据库,JDBC接口,MyBatis框架等,带你掌握的数据的存放和管理。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星