JDBC连接数据库 A Java Exception has occurred

图片说明图片说明
同样的jdbcUtil文件为什么放到两个不同的工程里,一个没问题,一个就读取数据库配置文件异常呢

Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.RuntimeException: 读取数据库配置文件异常!
at com.imooc.page.util.JdbcUtil.loadConfig(JdbcUtil.java:46)
at com.imooc.page.util.JdbcUtil.(JdbcUtil.java:27)
Caused by: java.lang.NullPointerException
at java.util.Properties$LineReader.readLine(Properties.java:434)
at java.util.Properties.load0(Properties.java:353)
at java.util.Properties.load(Properties.java:341)
at com.imooc.page.util.JdbcUtil.loadConfig(JdbcUtil.java:36)
... 1 more

3个回答

查看是什么原因导致那个空指针异常

看一下数据库配置文件,命名和路径对不对

后面发现,是我设置的过滤器路径少了根目录/符号

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java连接sqlserver数据库库出错,不知如何解决,求大神

我按网上给的一些解决办法尝试都没成功 TCP/IP已经启用,并且ip1和10的地址被设定为127.0.0.1,all端口设定为1433 ms-dos中输入telnet 127.0.0.1 1433,则出现了一个名为telnet 127.0.0.1 新的控制台,运行后错错误如下:另外,因为工作方面的原因最近经常要用java连接sql server,中间出现错误但是却不理解,有没有那本书是专门讲解这些错误的意义的 com.microsoft.sqlserver.jdbc.SQLServerException: 用户 'sa' 登录失败。 ClientConnectionId:cd23a148-7cb6-4bc9-86de-e10675fe5d1b at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254) at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at zidingyi.GetConnectionSqlServer.getConnectionSqlServer(GetConnectionSqlServer.java:24) at zidingyi.Try.main(Try.java:8) 我的代码如下 ``` public class GetConnectionSqlServer { public void getConnectionSqlServer() { String driverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String dbURL = "jdbc:sqlserver://MIAO-PC\\MIAO\\\\SQLEXPRESS:1433;databasename=stmodel"; // 1433是端口,"USCSecondhandMarketDB"是数据库名称 String userName = "sa"; // 用户名 String userPwd = "sa"; // 密码 Connection dbConn = null; try { Class.forName(driverName).newInstance(); System.out.println("驱动加载成功"); } catch (Exception ex) { System.out.println("驱动加载失败"); ex.printStackTrace(); } try { dbConn = DriverManager.getConnection(dbURL, userName, userPwd); System.out.println("成功连接数据库!"); } catch (Exception e) { System.out.println("地址端口数据库用户名密码出错"); e.printStackTrace(); } finally { try { if (dbConn != null) dbConn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } ```

SpringBoot 热部署 重启后 一只不停的包JDBC连接 问题

``` ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (test) has been closed. ### The error may exist in file [D:\Eclipse\reports-platform\DC-Relay\target\classes\mapping\loginMapper.xml] ### The error may involve com.dao.DCDao.select ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (test) has been closed. at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at sun.reflect.GeneratedMethodAccessor87.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ... 8 more Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: HikariDataSource HikariDataSource (test) has been closed. at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82) at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68) at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ... 13 more Caused by: java.sql.SQLException: HikariDataSource HikariDataSource (test) has been closed. at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:96) at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:151) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ... 23 more ```

运行esclipse的Java程序向Oracel数据库更新数据,运行后报错

就是这个用那个Oracle数据库插入数据 以下代码: package jdbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class ojdbc { public static final String URL="jdbc:oracle:thin:@localhost:1521:ORCL"; public static final String USERNAME="system"; public static final String PASSWORD="a123"; public static void update() {// 数据库连接要抛出异常 Statement stmt = null; Connection con = null; try { Class.forName("oracle.jdbc.OracleDriver"); con = DriverManager.getConnection(URL, USERNAME, PASSWORD); stmt = con.createStatement(); String sql = "insert into student values('55 ','66666')"; int count = stmt.executeUpdate(sql); if (count > 0) { System.out.print("successful"); } }catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); }catch (Exception e) { e.printStackTrace(); } finally { try { if(stmt!=null)stmt.close(); if(stmt!=null)con.close(); }catch(SQLException e) { e.printStackTrace(); } } } public static void main(String[] args) throws ClassNotFoundException, SQLException { update(); } } 运行后报ERROR:A JNI error has occurred,please check your installation and try again. 正常应该没错啊,我又不是java开头的命名,Oracle11g安装没问题,账号密码也没问题,Oracle11g也已经跟Oracle Developer建立连接,但是为什么?

mybatis连接数据库失败是什么原因,百度了半天没找到有用的办法

下面的Communications link failure如何解决,检查过IUserMapper的xml问句和IUserDao的findAll是按照视频敲的 ``` Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. ### The error may exist in com/HSY/Mapper/IUserMapper.xml ### The error may involve com.HSY.dao.IUserDao.findAll ### The error occurred while executing a query ### Cause: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure ``` 这个是Mybatis配置 ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <!--mybatis主配置文件 --> <configuration> <!--default和id相同 --> <environments default="mysql"> <environment id="mysql"> <!--配置事务类型为JDBC --> <transactionManager type="JDBC"></transactionManager> <!--配置连接池,即要连接的数据库信息 --> <dataSource type="POOLED"> <property name="driver" value="com.mysql.cj.jdbc.Driver"/> <property name="url" value="jdbc:mysql://loacalhost:3306/mybatistest"/> <property name="username" value="root"/> <property name="password" value="123456"/> </dataSource> </environment> </environments> <!--指定映射配置文件的位置 --> <mappers> <mapper resource="com/HSY/Mapper/IUserMapper.xml"/> </mappers> </configuration> ``` 这个是程序入口 ``` package com.HSY.test; import com.HSY.dao.IUserDao; import com.HSY.domain.User; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import java.io.IOException; import java.io.InputStream; import java.util.List; public class MybatisTest { public static void main(String[] args) throws IOException { //读取配置文件 InputStream inputStream= Resources.getResourceAsStream("SqlMapConfig.xml"); //创建SqlSessionFactory工厂 SqlSessionFactoryBuilder builder=new SqlSessionFactoryBuilder(); SqlSessionFactory factory = builder.build(inputStream); //实用工厂生成SqlSession对象 SqlSession session=factory.openSession(); //使用SqlSession创建Dao接口的代理对象 IUserDao userDao = session.getMapper(IUserDao.class); //使用代理对象执行方法 List<User> userList=userDao.findAll(); for(User user:userList) { System.out.println(user.toString()); } //释放资源 session.close(); inputStream.close(); } } ``` 这是IUserMapper.xml ``` <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!-- 必须是Dao接口的全限定类名 --> <mapper namespace="com.HSY.dao.IUserDao"> <!-- SQL语句 --> <!-- 下面的id指方法的名称id而不是数据库里的人员id--> <select id="findAll" resultType="com.HSY.domain.User"> select * from user </select> </mapper> ``` 这是IUserDo ``` import com.HSY.domain.User; import java.util.List; public interface IUserDao { List<User> findAll(); } ``` 还有User类 ``` package com.HSY.domain; public class User { private Integer id; private String username; private String bitrthday; private String sex; private String address; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getBitrthday() { return bitrthday; } public void setBitrthday(String bitrthday) { this.bitrthday = bitrthday; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", bitrthday='" + bitrthday + '\'' + ", sex='" + sex + '\'' + ", address='" + address + '\'' + '}'; } } ```

初学java web 关于JDBC连接对象关闭问题?

package myweb2; import java.io.IOException; import java.io.PrintWriter; import java.sql.ResultSet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; //import com.mysql.jdbc.Connection; import java.sql.Connection; import com.mysql.jdbc.PreparedStatement; public class LoginServlet extends HttpServlet { /** * Constructor of the object. */ public LoginServlet() { super(); } /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username=request.getParameter("username"); String password=request.getParameter("password"); if(username==null||username.equals("")||password==null||password.equals("")){ System.out.println("您输入的用户名和密码有误"); return; } DBManager dbmanager=null; try { Connection conn = dbmanager.getConn(); PreparedStatement pst=(PreparedStatement) conn.prepareStatement("select * from mytable where username=? AND password=?"); pst.setString(1,username); pst.setString(2,password); ResultSet rs=pst.executeQuery(); if (rs.next()){ System.out.println("访问成功"); } else { System.out.println("访问失败 ");} } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally{ conn.close(); }; if(username=="woniu"&&password=="123456"){ } } ``` 问题: conn.close(); 老是报错,提示有问题,关不不来,是怎么回事啊,那个大神给看看啊 ```

为什么我用springboot连接mysql始终不成功?

之前按照教程写不能成功,现在直接复制别人完整的代码还是不行 一些配置 application.properties ``` spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.suffix=.jsp spring.datasource.url=jdbc:mysql://localhost:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8 spring.datasource.username=root spring.datasource.password=123456 spring.datasource.driver-class-name=com.mysql.jdbc.Driver ``` UserMapper.java ``` @Mapper public interface UserMapper { @Select("select * from user") List<User> findAll(); @Insert("insert into user(username,password)values(#{username},#{password}") public int add(User user); } ``` UserSrevice.java ``` @Service public class UserService { @Autowired private UserMapper userMapper; public List<User> findAll(){ return userMapper.findAll(); } public int add(User user){ return userMapper.add(user); } } ``` 每次刷新页面 ![图片说明](https://img-ask.csdn.net/upload/201901/14/1547439161_726361.jpg) 错误提示 ``` 2019-01-14 11:51:15.363 ERROR 752 --- [nio-8080-exec-1] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool. java.sql.SQLException: Unknown character set index for field '255' received from server. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910) ~[mysql-connector-java-5.0.3.jar:na] at com.mysql.jdbc.Connection.getCharsetNameForIndex(Connection.java:3396) ~[mysql-connector-java-5.0.3.jar:na] at com.mysql.jdbc.Field.<init>(Field.java:191) ~[mysql-connector-java-5.0.3.jar:na] ERROR 752 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown character set index for field '255' received from server. ### The error may exist in com/polaris/springboot_mybatis_jsp/mapper/UserMapper.java (best guess) ### The error may involve com.polaris.springboot_mybatis_jsp.mapper.UserMapper.findAll ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown character set index for field '255' received from server.] with root cause ``` 其中会指向这两行 ``` (UserService.java:18) return userMapper.findAll(); (UserController.java:24) List<User> list = userService.findAll(); ``` 求大神解答

springnvc+mybatis+C3P0连接池,一段时间数据库就崩溃了,求援~

云服务上有三个tomcat服务器,都启动一段时间后报异常,mysql数据库崩溃,求帮助,怎么配置都配置不行 applicationcontext中连接池配置 ``` <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driver}" /> <property name="jdbcUrl" value="${jdbc.url}" /> <property name="user" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> <!--连接池中保留的最小连接数。 --> <property name="minPoolSize" value="${minPoolSize}" /> <!--连接池中保留的最大连接数。Default: 15 --> <property name="maxPoolSize" value="${maxPoolSize}" /> <!--最大空闲时间,1800秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> <property name="maxIdleTime" value="${maxIdleTime}" /> <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> <property name="acquireIncrement" value="${acquireIncrement}" /> <!--c3p0全局的PreparedStatements缓存的大小。如果maxStatements与maxStatementsPerConnection均为0,则缓存不生效,只要有一个不为0,则语句的缓存就能生效。如果默认值:0 --> <property name="maxStatements" value="${maxStatements}" /> <property name="initialPoolSize" value="${initialPoolSize}" /> <!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,如设为0则无限期等待。单位毫秒。Default: 0 --> <property name="checkoutTimeout" value="${checkoutTimeout}" /> <!--每60秒检查所有连接池中的空闲连接。Default: 0 --> <property name="idleConnectionTestPeriod" value="${idleConnectionTestPeriod}" /> <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> <property name="acquireRetryAttempts" value="${acquireRetryAttempts}" /> <property name="breakAfterAcquireFailure" value="${breakAfterAcquireFailure}" /> <property name="testConnectionOnCheckout" value="${testConnectionOnCheckout}" /> <property name="connectionCustomizerClassName" value="com.tanwuapp.util.handler.UTF8MB4ConnectionCustomizer" /> </bean> ``` ``` minPoolSize=10 <!--连接池中保留的最大连接数。Default: 15 --> maxPoolSize=40 <!--最大空闲时间,30秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 --> maxIdleTime=30 <!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 --> acquireIncrement=3 <!--c3p0全局的PreparedStatements缓存的大小。如果maxStatements与maxStatementsPerConnection均为0,则缓存不生效,只要有一个不为0,则语句的缓存就能生效。如果默认值: 0--> maxStatements=50 <!--maxStatementsPerConnection定义了连接池内单个连接所拥有的最大缓存statements数。默认值: 0 --> maxStatementsPerConnection=0 initialPoolSize=10 <!--当连接池用完时客户端调用getConnection()后等待获取新连接的时间,如设为0则无限期等待。单位毫秒。Default: 0 --> checkoutTimeout=10000 <!--每30秒检查所有连接池中的空闲连接。Default: 0 --> idleConnectionTestPeriod=30 <!--定义在从数据库获取新连接失败后重复尝试的次数。Default: 30 --> acquireRetryAttempts=30 breakAfterAcquireFailure=true testConnectionOnCheckout=false ``` 异常信息: ``` org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.) ### The error may exist in file [/home/webapps/tomcat-1.2.1/tanwuapps/TanWuAppAPI_v1.2.1/WEB-INF/classes/com/tanwuapp/dao/mapper/BasBannerMapper.xml] ### The error may involve com.tanwuapp.dao.BasBannerDao.findAllInfo ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371) at com.sun.proxy.$Proxy9.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:119) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52) at com.sun.proxy.$Proxy42.findAllInfo(Unknown Source) at com.tanwuapp.service.impl.HomePageServiceImpl.getBannerList(HomePageServiceImpl.java:55) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198) at com.sun.proxy.$Proxy46.getBannerList(Unknown Source) at com.tanwuapp.controller.ProductSearchController.searchHomeBannerData(ProductSearchController.java:78) at com.tanwuapp.controller.ProductSearchController$$FastClassBySpringCGLIB$$1b828f00.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.cache.interceptor.CacheInterceptor$1.invoke(CacheInterceptor.java:58) at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:211) at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633) at com.tanwuapp.controller.ProductSearchController$$EnhancerBySpringCGLIB$$f6dc0725.searchHomeBannerData(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) at javax.servlet.http.HttpServlet.service(HttpServlet.java:650) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.ibatis.exceptions.PersistenceException: ```

c3p0连接池中获取的Connection对象的close()方法是真的把连接给关闭了?

自己做写了一个管理数据源的DBManager,构想中从数据源里面获取的Connection使用完之后执行close()方法,然后把Connection对象闲置回连接池中。 但是测试出来的结果好像每次执行close()之后connection就销毁了。 代码如下: DBManager.java -------------- package ben.DBUtils; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; import java.util.HashMap; import java.util.HashSet; import java.util.Properties; import java.util.Set; import com.mchange.v2.c3p0.ComboPooledDataSource; import org.apache.log4j.Logger; /** * Created with IntelliJ IDEA. * User: Ben * Date: 13-7-3 * Time: 下午5:06 * To change this template use File | Settings | File Templates. */ public class DBManager { //保存数据库连接池的容器 private static HashMap<String, ComboPooledDataSource> datasourceMap = new HashMap<String, ComboPooledDataSource>(); private final static ThreadLocal<Connection> conns = new ThreadLocal<Connection>(); private static Logger logger = Logger.getLogger(DBManager.class); static { InitDataSource(null); } /** * 初始化连接池 * */ private final static void InitDataSource(Properties dbProperties){ try{ if (dbProperties == null){ dbProperties = new Properties(); dbProperties.load(DBManager.class.getClassLoader().getResourceAsStream("dbInfo.properties")); } //获取数据源名称 Set<String> keys = new HashSet<String>(); for (Object key : dbProperties.keySet()){ String skey = (String)key; Integer point = skey.indexOf("."); keys.add(skey.substring(0, point)); } //实例化DataSource并放入容器中 for (String key : keys) { ComboPooledDataSource ds = new ComboPooledDataSource(); ds.setDriverClass(dbProperties.getProperty(key + "." + "Driver")); ds.setJdbcUrl(dbProperties.getProperty(key + "." + "Url")); ds.setUser(dbProperties.getProperty(key + "." + "User")); ds.setPassword(dbProperties.getProperty(key + "." + "Password")); ds.setMaxPoolSize(Integer.parseInt(dbProperties.getProperty(key + "." + "MaxPoolSize"))); ds.setMinPoolSize(Integer.parseInt(dbProperties.getProperty(key + "." + "MinPoolSize"))); ds.setMaxIdleTime(Integer.parseInt(dbProperties.getProperty(key + "." + "MaxIdleTime"))); ds.setInitialPoolSize(Integer.parseInt(dbProperties.getProperty(key + "." + "InitialPoolSize"))); ds.setAcquireIncrement(Integer.parseInt(dbProperties.getProperty(key + "." + "AcquireIncrement"))); ds.setAcquireRetryAttempts(Integer.parseInt(dbProperties.getProperty(key + "." + "AcquireRetryAttempts"))); ds.setAcquireRetryDelay(Integer.parseInt(dbProperties.getProperty(key + "." + "AcquireRetryDelay"))); ds.setMaxStatements(Integer.parseInt(dbProperties.getProperty(key + "." + "MaxStatements"))); ds.setIdleConnectionTestPeriod(Integer.parseInt(dbProperties.getProperty(key + "." + "IdleConnectionTestPeriod"))); ds.setCheckoutTimeout(Integer.parseInt(dbProperties.getProperty(key + "." + "CheckoutTimeout"))); ds.setTestConnectionOnCheckin(Boolean.parseBoolean(dbProperties.getProperty(key + "." + "TestConnectionOnCheckin"))); ds.setTestConnectionOnCheckout(Boolean.parseBoolean(dbProperties.getProperty(key + "." + "TestConnectionOnCheckout"))); datasourceMap.put(key, ds); Connection conn = getConnection(key); DatabaseMetaData metaData = conn.getMetaData(); logger.info("Using DataSource: " + conn.getClass().getName()); closeConnection(); } } catch (Exception e){ logger.error("DataSource Error:" + e.toString()); } } /** * 断开连接池 * */ public final static void closeDataSource(String dataSourceName){ try{ ComboPooledDataSource dataSource = datasourceMap.get(dataSourceName); dataSource.close(); } catch (Exception e){ logger.error("Unable to destroy DataSource! " + e.toString()); } } /** * 获取连接 * @return Connection * */ public final static Connection getConnection(String dataSourceName) throws SQLException{ Connection conn = conns.get(); if (conn == null || conn.isClosed()){ ComboPooledDataSource dataSource = datasourceMap.get(dataSourceName); conn = dataSource.getConnection(); conns.set(conn); } return conn; } /** * 关闭连接 * */ public final static void closeConnection(){ Connection conn = conns.get(); try{ if (conn != null && !conn.isClosed()){ conn.setAutoCommit(true); conn.close(); } } catch (SQLException ex){ logger.error("Unable to close connection! " + ex.toString()); } finally { conns.remove(); //conns.set(null); } } } ---------- dbInfo.properties ----------------- DemoData.AcquireIncrement = 2 DemoData.AcquireRetryAttempts = 30 DemoData.AcquireRetryDelay = 1000 DemoData.CheckoutTimeout = 3000 DemoData.Driver = com.microsoft.sqlserver.jdbc.SQLServerDriver DemoData.IdleConnectionTestPeriod = 18000 DemoData.InitialPoolSize = 2 DemoData.MaxIdleTime = 300 DemoData.MaxPoolSize = 100 DemoData.MaxStatements = 1000 DemoData.MinPoolSize = 2 DemoData.Password = 123 DemoData.TestConnectionOnCheckin = false DemoData.TestConnectionOnCheckout = false DemoData.Url = jdbc:sqlserver://localhost:1433;DatabaseName=DemoData DemoData.User = sa ---------- 测试代码:TestDBManager.java ----------------------- package ben.DBUtils; import java.sql.Connection; /** * Created with IntelliJ IDEA. * User: Ben * Date: 13-7-6 * Time: 上午12:28 * To change this template use File | Settings | File Templates. */ public class TestDBManager { public static void main(String[] args) { for (Integer i=0; i<10; i++){ try{ System.out.println(DBManager.getConnection("DemoData")); DBManager.closeConnection(); System.out.println("---------------------------"); } catch (Exception ex){ ex.printStackTrace(); } } } } 打印出来的结果每次都不一样 com.mchange.v2.c3p0.impl.NewProxyConnection@ff5c225 --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@5bafcc2c --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@ded0b93 --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@25057fe --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@198ad24a --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@1228bd68 --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@36db09fa --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@35886ba1 --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@17d8986 --------------------------- com.mchange.v2.c3p0.impl.NewProxyConnection@2bb9e538 ---------------------------

java.lang.IllegalStateException项目运行一会儿后,自动报的错误

java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1293) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1158) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1040) at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1507) at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1477) at com.mchange.v2.resourcepool.BasicResourcePool.cullExpired(BasicResourcePool.java:1565) at com.mchange.v2.resourcepool.BasicResourcePool.access$1900(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool$CullTask.run(BasicResourcePool.java:2089) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) Exception in thread "C3P0PooledConnectionPoolManager[identityToken->1hge2h29m1zvigj1c8yih|3bfe9985]-AdminTaskTimer" java.lang.NoClassDefFoundError: com/mchange/v2/resourcepool/BasicResourcePool$1DestroyResourceTask at com.mchange.v2.resourcepool.BasicResourcePool.destroyResource(BasicResourcePool.java:1040) at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1507) at com.mchange.v2.resourcepool.BasicResourcePool.removeResource(BasicResourcePool.java:1477) at com.mchange.v2.resourcepool.BasicResourcePool.cullExpired(BasicResourcePool.java:1565) at com.mchange.v2.resourcepool.BasicResourcePool.access$1900(BasicResourcePool.java:44) at com.mchange.v2.resourcepool.BasicResourcePool$CullTask.run(BasicResourcePool.java:2089) at java.util.TimerThread.mainLoop(Timer.java:555) at java.util.TimerThread.run(Timer.java:505) Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1295) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1158) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119) ... 8 more Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access. at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1305) at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1293) ... 10 more 这个问题,时不时的发生。也不知道是什么原因 自从换了C3P0连接池之后,就会发生这个问题 <property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="hibernate.c3p0.max_size">100</property> <property name="hibernate.c3p0.min_size">5</property> <property name="hibernate.c3p0.timeout">120</property> <property name="c3p0.maxIdleTime">1800</property> <!-- <property name="automaticTestTable">Test</property> --> <!-- JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。 --> <property name="hibernate.c3p0.max_statements">0</property> <!-- 每隔多少秒检查连接池中的空闲连接 --> <property name="hibernate.c3p0.idle_test_period">1800</property> <!-- 当c3p0连接池枯竭时,一次获得多少连接的数量 --> <property name="hibernate.c3p0.acquire_increment">3</property> <!-- 因性能消耗大请只在需要的时候使用它。如果设为true那么在每个connection提交的时候都将校验其有效性。建议使用idleConnectionTestPeriod或automaticTestTable等方法来提升连接测试的性能。Default: false --> <property name="c3p0.testConnectionOnCheckout">false</property> <property name="c3p0.idle"></property> <!-- 每次都验证连接是否可用 --> <property name="hibernate.c3p0.validate">false</property> <property name="dialect"> org.hibernate.dialect.SQLServerDialect </property> 我是初学者,也不知道哪里配的有问题 这也是,我第一次在CSDN上提问。望各位前辈,指点一二

JSP对数据库进行信息添加及关键字查询出现错误,怎么解决

org.apache.jasper.JasperException: An exception occurred processing JSP page /emp_list.jsp at line 18 15: if(keyWord==null){ 16: keyWord=""; 17: } 18: List<Emp> all=DAOFactory.getIEmpDAOInstance().findAll(keyWord); 19: Iterator<Emp> iter=all.iterator(); 20: %> 21: <center> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:141) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118) com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289) java.sql.DriverManager.getConnection(DriverManager.java:579) java.sql.DriverManager.getConnection(DriverManager.java:221) com.wgh.dbc.DatabaseConnection.<init>(DatabaseConnection.java:13) com.wgh.dao.proxy.EmpDAOProxy.<init>(EmpDAOProxy.java:13) com.wgh.factory.DAOFactory.getIEmpDAOInstance(DAOFactory.java:7) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.net.UnknownHostException: locahost java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866) java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258) java.net.InetAddress.getAllByName0(InetAddress.java:1211) java.net.InetAddress.getAllByName(InetAddress.java:1127) java.net.InetAddress.getAllByName(InetAddress.java:1063) com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:246) com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289) java.sql.DriverManager.getConnection(DriverManager.java:579) java.sql.DriverManager.getConnection(DriverManager.java:221) com.wgh.dbc.DatabaseConnection.<init>(DatabaseConnection.java:13) com.wgh.dao.proxy.EmpDAOProxy.<init>(EmpDAOProxy.java:13) com.wgh.factory.DAOFactory.getIEmpDAOInstance(DAOFactory.java:7) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.57 logs.

springboot mybatis atomikos 事务超时未提交 求解

Transaction com.tlw.bpm.engine.atomikos.spring.jdbc.tm157010820885800001 has timed out and will rollback. 2019-10-03 21:10:59.237 ERROR 12120 --- [p-nio-80-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.CannotAcquireLockException: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction ### The error may involve com.springboot.demo.dao.primary.PrimaryStudentDao.insert-Inline ### The error occurred while setting parameters ### SQL: INSERT INTO student(id,name) VALUES (?,?) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction ; Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction

新手在jboss下配置连接池出问题,请大家帮忙,万分感谢!!

1.在\server\default\deploy下新建文件mysql-ds.xml,内容如下: <datasources> <local-tx-datasource> <jndi-name>MySqlDS</jndi-name> <connection-url>jdbc:mysql://localhost:3306/test</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password>123456</password> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name> <!-- should only be used on drivers after 3.22.1 with "ping" support <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name> --> <!-- sql to call when connection is created <new-connection-sql>some arbitrary sql</new-connection-sql> --> <!-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql> --> <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) --> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> </datasources> 2.修改\server\default\conf\ standardjbosscmp-jdbc.xml <jbosscmp-jdbc> <defaults> <datasource>java:/MySqlDS</datasource> <datasource-mapping>mySQL</datasource-mapping> </defaults> </jbosscmp-jdbc> 3.在jboss-4.0.4\server\default\conf\ login-config.xml中追加如下内容 <application-policy name = "MySqlDbRealm"> <authentication> <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required"> <module-option name ="principal">MySqlDS</module-option> <module-option name ="userName">root</module-option> <module-option name ="password">123456</module-option> <module-option name ="managedConnectionFactoryName"> jboss.jca:service=LocalTxCM,name=MySqlDS </module-option> </login-module> </authentication> </application-policy> 4.测试代码: try { Context envCtx = new InitialContext(); DataSource ds = (DataSource) envCtx.lookup("java:/MySqlDS"); return ds.getConnection(); } catch (SQLException e) { System.out.println("数据源配置发生错误" + e.toString()); return null; } catch (NamingException e2) { System.out.print("数据源配置" + e2.toString()); return null; } 5.在测试连接池是不是好用时报错如下: 10:17:30,093 INFO [STDOUT] 数据源配置javax.naming.NameNotFoundException: MySqlDS not bound 10:17:33,875 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at org.apache.jsp.MyJsp_jsp._jspService(MyJsp_jsp.java:80) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446) at java.lang.Thread.run(Unknown Source) [b]问题补充:[/b] 在server\default\conf\下没有 standardjaws.xml,现在是不是只要修改standardjbosscmp-jdbc.xml就可以了

MyBatis逆向工程提示javax.net.ssl.SSLException是什么问题?

请问MyBatis逆向工程提示javax.net.ssl.SSLException是什么问题?怎么解决? 错误提示: ``` Wed Jan 22 15:08:37 CST 2020 WARN: Caught while disconnecting... EXCEPTION STACK TRACE: ** BEGIN NESTED EXCEPTION ** javax.net.ssl.SSLException MESSAGE: closing inbound before receiving peer's close_notify STACKTRACE: javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:133) at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255) at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:645) at java.base/sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:624) at com.mysql.cj.protocol.a.NativeProtocol.quit(NativeProtocol.java:1284) at com.mysql.cj.NativeSession.quit(NativeSession.java:182) at com.mysql.cj.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:1911) at com.mysql.cj.jdbc.ConnectionImpl.close(ConnectionImpl.java:730) at org.mybatis.generator.config.Context.closeConnection(Context.java:535) at org.mybatis.generator.config.Context.introspectTables(Context.java:468) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:222) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:133) at GeneratorSqlmap.generator(GeneratorSqlmap.java:27) at GeneratorSqlmap.main(GeneratorSqlmap.java:33) ** END NESTED EXCEPTION ** WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.mybatis.generator.internal.DomWriter (file:/F:/SSM%e9%a1%b9%e7%9b%ae%e5%ae%9e%e6%88%98/%e7%ac%ac%e4%b8%80%e4%bb%b6%20maven%e7%ae%a1%e7%90%86%e7%9a%84ssm%e6%a1%86%e6%9e%b6(%e8%af%a6%e8%a7%a3)/e3%e5%95%86%e5%9f%8e_day01/%e9%bb%91%e9%a9%ac32%e6%9c%9f/01.%e6%95%99%e6%a1%88-3.0/01.%e5%8f%82%e8%80%83%e8%b5%84%e6%96%99/mybatis/%e9%80%86%e5%90%91%e5%b7%a5%e7%a8%8b/generatorSqlmapCustom/lib/mybatis-generator-core-1.3.2.jar) to method com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.getXmlVersion() WARNING: Please consider reporting this to the maintainers of org.mybatis.generator.internal.DomWriter WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release ``` 工程结构: ![图片说明](https://img-ask.csdn.net/upload/202001/22/1579677296_992794.png) GeneratorSqlmap类 ``` public class GeneratorSqlmap { public void generator() throws Exception{ List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File("generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } public static void main(String[] args) throws Exception { try { GeneratorSqlmap generatorSqlmap = new GeneratorSqlmap(); generatorSqlmap.generator(); } catch (Exception e) { e.printStackTrace(); } } } ``` generatorConfig.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN" "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd"> <generatorConfiguration> <context id="testTables" targetRuntime="MyBatis3"> <commentGenerator> <!-- 是否去除自动生成的注释 true:是 : false:否 --> <property name="suppressAllComments" value="true" /> </commentGenerator> <!--数据库连接的信息:驱动类、连接地址、用户名、密码 --> <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/e3mall?serverTimezone=UTC" userId="root" password="root"> </jdbcConnection> <!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 NUMERIC 类型解析为java.math.BigDecimal --> <javaTypeResolver> <property name="forceBigDecimals" value="false" /> </javaTypeResolver> <!-- targetProject:生成PO类的位置 --> <javaModelGenerator targetPackage="cn.e3mall.pojo" targetProject=".\src"> <!-- enableSubPackages:是否让schema作为包的后缀 --> <property name="enableSubPackages" value="false" /> <!-- 从数据库返回的值被清理前后的空格 --> <property name="trimStrings" value="true" /> </javaModelGenerator> <!-- targetProject:mapper映射文件生成的位置 --> <sqlMapGenerator targetPackage="cn.e3mall.mapper" targetProject=".\src"> <!-- enableSubPackages:是否让schema作为包的后缀 --> <property name="enableSubPackages" value="false" /> </sqlMapGenerator> <!-- targetPackage:mapper接口生成的位置 --> <javaClientGenerator type="XMLMAPPER" targetPackage="cn.e3mall.mapper" targetProject=".\src"> <!-- enableSubPackages:是否让schema作为包的后缀 --> <property name="enableSubPackages" value="false" /> </javaClientGenerator> <!-- 指定数据库表 --> <table schema="" tableName="tb_content"></table> <table schema="" tableName="tb_content_category"></table> <table schema="" tableName="tb_item"></table> <table schema="" tableName="tb_item_cat"></table> <table schema="" tableName="tb_item_desc"></table> <table schema="" tableName="tb_item_param"></table> <table schema="" tableName="tb_item_param_item"></table> <table schema="" tableName="tb_order"></table> <table schema="" tableName="tb_order_item"></table> <table schema="" tableName="tb_order_shipping"></table> <table schema="" tableName="tb_user"></table> </context> </generatorConfiguration> ```

org.apache.ibatis.exceptions.PersistenceException怎么解决?

调试一个开源项目出现报错,项目所有sql都会报空指针异常 ``` 严重: Servlet.service() for servlet [springMvc] in context with path [/mallapp] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.NullPointerException ### The error may exist in file [H:\WorksSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\mallapp\WEB-INF\classes\mybatis\category\CategoryMapper.xml] ### The error may involve CategoryMapper.listAll-Inline ### The error occurred while setting parameters ### SQL: select category_name, category_img, sort, category_id, super_id from shop_category where super_id =? order by sort ### Cause: java.lang.NullPointerException] with root cause java.lang.NullPointerException at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:43) at org.apache.ibatis.scripting.defaults.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:81) at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:80) at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62) at com.sun.proxy.$Proxy84.parameterize(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.prepareStatement(ReuseExecutor.java:79) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:56) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358) at com.sun.proxy.$Proxy74.selectList(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:198) at com.yq.dao.DaoSupport.findForList(DaoSupport.java:118) at com.yq.service.category.impl.CategoryService.listAll(CategoryService.java:62) at com.yq.service.category.impl.CategoryService$$FastClassBySpringCGLIB$$51d95cd7.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:711) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644) at com.yq.service.category.impl.CategoryService$$EnhancerBySpringCGLIB$$c2253a36.listAll(<generated>) at com.yq.controller.category.CategoryController.list(CategoryController.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:624) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) ``` CategoryMapper.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="CategoryMapper"> <!--表名 --> <sql id="tableName"> shop_category </sql> <!-- 字段 --> <sql id="Field"> category_name, category_img, sort, category_id, super_id </sql> <!-- 字段值 --> <sql id="FieldValue"> #{category_name}, #{category_img}, #{sort}, #{category_id}, #{super_id} </sql> <!-- 新增--> <insert id="save" parameterType="pd"> insert into <include refid="tableName"></include> ( <include refid="Field"></include> ) values ( <include refid="FieldValue"></include> ) </insert> <!-- 删除--> <delete id="delete" parameterType="pd"> delete from <include refid="tableName"></include> where category_id = #{category_id} </delete> <!-- 修改 --> <update id="edit" parameterType="pd"> update <include refid="tableName"></include> set category_name = #{category_name}, category_img = #{category_img}, sort = #{sort} where category_id = #{category_id} </update> <!-- 通过ID获取数据 --> <select id="findById" parameterType="pd" resultType="pd"> select <include refid="Field"></include> from <include refid="tableName"></include> where category_id = #{category_id} </select> <!-- 列表 --> <select id="datalistPage" parameterType="page" resultType="pd"> select <include refid="Field"></include> from <include refid="tableName"></include> where 1=1 and super_id =#{pd.super_id} order by sort </select> <!-- 列表(全部) --> <select id="listAll" parameterType="pd" resultType="pd"> select <include refid="Field"></include> from <include refid="tableName"></include> where super_id =#{super_id} order by sort </select> <!-- 批量删除 --> <delete id="deleteAll" parameterType="String"> delete from <include refid="tableName"></include> where category_id in <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> #{item} </foreach> </delete> </mapper> ``` mybatis-config.xml ``` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD SQL Map Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="cacheEnabled" value="true" /><!-- 全局映射器启用缓存 --> <setting name="useGeneratedKeys" value="true" /> <setting name="defaultExecutorType" value="REUSE" /> <!-- 打印查询语句 --> <setting name="logImpl" value="LOG4J" /> </settings> <typeAliases> <typeAlias type="org.change.entity.system.User" alias="User"/> <typeAlias type="org.change.entity.system.Role" alias="Role"/> <typeAlias type="org.change.entity.system.Menu" alias="Menu"/> <typeAlias type="org.change.entity.system.Dictionaries" alias="Dictionaries"/> <typeAlias type="org.change.entity.system.Department" alias="Department"/> <typeAlias type="org.change.util.PageData" alias="pd"/> <!-- 分页 --> <typeAlias type="org.change.entity.Page" alias="Page"/> </typeAliases> <plugins> <plugin interceptor="org.change.plugin.PagePlugin"> <property name="dialect" value="mysql"/> <property name="pageSqlId" value=".*listPage.*"/> </plugin> </plugins> </configuration> ``` DAO.java ``` public interface DAO { /** * 保存对象 * @param str * @param obj * @return * @throws Exception */ public Object save(String str, Object obj) throws Exception; /** * 修改对象 * @param str * @param obj * @return * @throws Exception */ public Object update(String str, Object obj) throws Exception; /** * 删除对象 * @param str * @param obj * @return * @throws Exception */ public Object delete(String str, Object obj) throws Exception; /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForObject(String str, Object obj) throws Exception; /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForList(String str, Object obj) throws Exception; /** * 查找对象封装成Map * @param s * @param obj * @return * @throws Exception */ public Object findForMap(String sql, Object obj, String key , String value) throws Exception; } ``` DaoSupport.java ``` @Repository("daoSupport") public class DaoSupport implements DAO { @Resource(name = "sqlSessionTemplate") private SqlSessionTemplate sqlSessionTemplate; /** * 保存对象 * @param str * @param obj * @return * @throws Exception */ public Object save(String str, Object obj) throws Exception { return sqlSessionTemplate.insert(str, obj); } /** * 批量更新 * @param str * @param obj * @return * @throws Exception */ public Object batchSave(String str, List objs )throws Exception{ return sqlSessionTemplate.insert(str, objs); } /** * 修改对象 * @param str * @param obj * @return * @throws Exception */ public Object update(String str, Object obj) throws Exception { return sqlSessionTemplate.update(str, obj); } /** * 批量更新 * @param str * @param obj * @return * @throws Exception */ public void batchUpdate(String str, List objs )throws Exception{ SqlSessionFactory sqlSessionFactory = sqlSessionTemplate.getSqlSessionFactory(); //批量执行器 SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false); try{ if(objs!=null){ for(int i=0,size=objs.size();i<size;i++){ sqlSession.update(str, objs.get(i)); } sqlSession.flushStatements(); sqlSession.commit(); sqlSession.clearCache(); } }finally{ sqlSession.close(); } } /** * 批量更新 * @param str * @param obj * @return * @throws Exception */ public Object batchDelete(String str, List objs )throws Exception{ return sqlSessionTemplate.delete(str, objs); } /** * 删除对象 * @param str * @param obj * @return * @throws Exception */ public Object delete(String str, Object obj) throws Exception { return sqlSessionTemplate.delete(str, obj); } /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForObject(String str, Object obj) throws Exception { return sqlSessionTemplate.selectOne(str, obj); } /** * 查找对象 * @param str * @param obj * @return * @throws Exception */ public Object findForList(String str, Object obj) throws Exception { return sqlSessionTemplate.selectList(str, obj); } public Object findForMap(String str, Object obj, String key, String value) throws Exception { return sqlSessionTemplate.selectMap(str, obj, key); } } ``` spring.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" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd "> <!-- 配置事务管理器 --> <bean name="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property name="dataSource" ref="dataSource"></property> </bean> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location" value="classpath:jdbc.properties"/> </bean> <!-- 阿里 druid数据库连接池 --> <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close"> <!-- 数据库基本信息配置 --> <property name="driverClassName" value="${driverClassName}" /> <property name="url" value="${url}" /> <property name="username" value="${username}" /> <property name="password" value="${password}" /> <property name="filters" value="${filters}" /> <!-- 最大并发连接数 --> <property name="maxActive" value="${maxActive}" /> <!-- 初始化连接数量 --> <property name="initialSize" value="${initialSize}" /> <!-- 配置获取连接等待超时的时间 --> <property name="maxWait" value="${maxWait}" /> <!-- 最小空闲连接数 --> <property name="minIdle" value="${minIdle}" /> <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 --> <property name="timeBetweenEvictionRunsMillis" value="${timeBetweenEvictionRunsMillis}" /> <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 --> <property name="minEvictableIdleTimeMillis" value="${minEvictableIdleTimeMillis}" /> <property name="validationQuery" value="${validationQuery}" /> <property name="testWhileIdle" value="${testWhileIdle}" /> <property name="testOnBorrow" value="${testOnBorrow}" /> <property name="testOnReturn" value="${testOnReturn}" /> <property name="maxOpenPreparedStatements" value="${maxOpenPreparedStatements}" /> <!-- 打开removeAbandoned功能 --> <property name="removeAbandoned" value="${removeAbandoned}" /> <!-- 1800秒,也就是30分钟 --> <property name="removeAbandonedTimeout" value="${removeAbandonedTimeout}" /> <!-- 关闭abanded连接时输出错误日志 --> <property name="logAbandoned" value="${logAbandoned}" /> </bean> <!-- 启用注解 --> <context:annotation-config /> <!-- 启动组件扫描,排除@Controller组件,该组件由SpringMVC配置文件扫描 --> <context:component-scan base-package="com"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> <!-- 注解方式配置事务--> <!-- <tx:annotation-driven transaction-manager="transactionManager" /> --> <!-- 拦截器方式配置事务 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="delete*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception"/> <tx:method name="insert*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="update*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="save*" propagation="REQUIRED" read-only="false" rollback-for="java.lang.Exception" /> <tx:method name="*" propagation="SUPPORTS"/> </tx:attributes> </tx:advice> <aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 事物处理 --> <aop:config> <aop:pointcut id="pc" expression="execution(* com.*.service..*(..))" /> <aop:advisor pointcut-ref="pc" advice-ref="txAdvice" /> </aop:config> <!-- 配置mybatis --> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="configLocation" value="classpath:mybatis-config.xml"></property> <!-- mapper扫描 --> <property name="mapperLocations" value="classpath:mybatis/*/*.xml"></property> </bean> <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> <constructor-arg ref="sqlSessionFactory" /> </bean> </beans> ```

我用的是纯驱动连接SQL server数据库,运行的时候显示第128行错误,不知道怎么改。求帮助。

package servlets; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.sql.*; import toolbean.*; public class regservlet extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; /** * Destruction of the servlet. <br> */ public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here } /** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response);} /** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to post. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */ public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=gbk"); PrintWriter out = response.getWriter(); ValueBean vb=new ValueBean(); vb.setUsername(MyTools.toChinese(request.getParameter("username"))); vb.setUserpass(request.getParameter("userpass")); vb.setBirthdate(request.getParameter("birthdate")); vb.setGender(MyTools.toChinese(request.getParameter("gender"))); vb.setNativeplace(MyTools.toChinese(request.getParameter("nativeplace"))); vb.settype(MyTools.toChinese(request.getParameter("type"))); String url="jdbc:sqlserver://127.0.0.1:1433;DataBaseName=lkk"; String user="root"; String pwd="123"; String sql=""; Connection conn=null; Statement stmt=null; ResultSet rs=null; try{ sql="select username from user where username='"+vb.getUsername()+"'"; conn=DriverManager.getConnection(url, user, pwd); stmt=conn.createStatement(); rs=stmt.executeQuery(sql); HttpSession session=request.getSession(); if(rs.next()){ PrintWriter pw=response.getWriter(); pw.write("<script language='javascript'>alert('用户名已存在,请重新注册')</script>"); response.sendRedirect("reg.jsp?err=1"); }else{ StringBuffer newsql=new StringBuffer(); newsql.append("insert into user (username,userpass,gender,birthdate,nativeplace,type) values ('"); newsql.append(vb.getUsername()); newsql.append("','"); newsql.append(vb.getUserpass()); newsql.append("','"); newsql.append(vb.getGender()); newsql.append("','"); newsql.append(vb.getBirthdate()); newsql.append("','"); newsql.append(vb.getNativeplace()); newsql.append("','"); newsql.append("会员"); newsql.append("')"); stmt.executeUpdate(newsql.toString()); session.setAttribute("msg_ok","注册成功!"); session.setAttribute("username",vb.getUsername()); response.sendRedirect("regMsg.jsp"); } }catch(Exception e){ out.print(e.toString()); }finally{ try{rs.close();}catch(Exception ee){} try{stmt.close();}catch(Exception ee){} try{conn.close();}catch(Exception ee){} } } /** * Initialization of the servlet. <br> * * @throws ServletException if an error occure */ public void init() throws ServletException { try{ Class.forName("com.microsoft.jdbc.SQLServerDriver"); }catch (Exception e){ throw new ServletException("加载数据库驱动失败!");//这是第128行 } }} 错误描述: javax.servlet.ServletException: 加载数据库驱动失败! servlets.regservlet.init(regservlet.java:128) javax.servlet.GenericServlet.init(GenericServlet.java:212) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:619)

boot客户管理系统登录报错HTTP Status 500 – Internal Server Error

HTTP Status 500 – Internal Server Error Type 异常报告 消息 Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 描述 服务器遇到一个意外的情况,阻止它完成请求。 Exception org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) ### The error may exist in com/ssm/core/dao/UserDao.xml ### The error may involve com.ssm.core.dao.UserDao.findUser ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:660) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) Root Cause org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) ### The error may exist in com/ssm/core/dao/UserDao.xml ### The error may involve com.ssm.core.dao.UserDao.findUser ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) com.sun.proxy.$Proxy16.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) com.sun.proxy.$Proxy22.findUser(Unknown Source) com.ssm.core.service.impl.UserServiceImpl.findUser(UserServiceImpl.java:21) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) com.sun.proxy.$Proxy23.findUser(Unknown Source) com.ssm.core.web.controller.UserController.login(UserController.java:28) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:660) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) Root Cause org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) ### The error may exist in com/ssm/core/dao/UserDao.xml ### The error may involve com.ssm.core.dao.UserDao.findUser ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) com.sun.proxy.$Proxy16.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) com.sun.proxy.$Proxy22.findUser(Unknown Source) com.ssm.core.service.impl.UserServiceImpl.findUser(UserServiceImpl.java:21) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) com.sun.proxy.$Proxy23.findUser(Unknown Source) com.ssm.core.web.controller.UserController.login(UserController.java:28) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:660) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) Root Cause org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82) org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68) org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336) org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) com.sun.proxy.$Proxy16.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) com.sun.proxy.$Proxy22.findUser(Unknown Source) com.ssm.core.service.impl.UserServiceImpl.findUser(UserServiceImpl.java:21) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) com.sun.proxy.$Proxy23.findUser(Unknown Source) com.ssm.core.web.controller.UserController.login(UserController.java:28) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:660) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) Root Cause java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES)) org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2294) org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039) org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533) org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82) org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68) org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336) org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) com.sun.proxy.$Proxy16.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) com.sun.proxy.$Proxy22.findUser(Unknown Source) com.ssm.core.service.impl.UserServiceImpl.findUser(UserServiceImpl.java:21) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) com.sun.proxy.$Proxy23.findUser(Unknown Source) com.ssm.core.web.controller.UserController.login(UserController.java:28) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:660) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) Root Cause java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835) com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455) com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) org.apache.commons.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:39) org.apache.commons.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:256) org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2304) org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290) org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2039) org.apache.commons.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1533) org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82) org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68) org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:336) org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:84) org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324) org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) com.sun.proxy.$Proxy16.selectOne(Unknown Source) org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166) org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82) org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) com.sun.proxy.$Proxy22.findUser(Unknown Source) com.ssm.core.service.impl.UserServiceImpl.findUser(UserServiceImpl.java:21) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333) org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) com.sun.proxy.$Proxy23.findUser(Unknown Source) com.ssm.core.web.controller.UserController.login(UserController.java:28) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.base/java.lang.reflect.Method.invoke(Method.java:566) org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) javax.servlet.http.HttpServlet.service(HttpServlet.java:660) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ):注意 主要问题的全部 stack 信息可以在 server logs 里查看 Apache Tomcat/8.5.49

怎么解决 Bean property 'dataSouce' is not writable or has an invalid setter method

``` 七月 22, 2019 11:14:13 上午 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.31 using APR version 1.4.8. 七月 22, 2019 11:14:13 上午 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 七月 22, 2019 11:14:14 上午 org.apache.catalina.core.AprLifecycleListener initializeSSL 信息: OpenSSL successfully initialized (OpenSSL 1.0.1h 5 Jun 2014) 七月 22, 2019 11:14:14 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-apr-8080"] 七月 22, 2019 11:14:14 上午 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-apr-8009"] 七月 22, 2019 11:14:14 上午 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 1967 ms 七月 22, 2019 11:14:15 上午 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 七月 22, 2019 11:14:15 上午 org.apache.catalina.core.StandardEngine startInternal 信息: Starting Servlet Engine: Apache Tomcat/7.0.56 七月 22, 2019 11:14:15 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\docs 七月 22, 2019 11:14:16 上午 org.apache.catalina.util.SessionIdGenerator createSecureRandom 信息: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [741] milliseconds. 七月 22, 2019 11:14:16 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\docs has finished in 1,350 ms 七月 22, 2019 11:14:16 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\examples 七月 22, 2019 11:14:17 上午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: contextInitialized() 七月 22, 2019 11:14:17 上午 org.apache.catalina.core.ApplicationContext log 信息: SessionListener: contextInitialized() 七月 22, 2019 11:14:17 上午 org.apache.catalina.core.ApplicationContext log 信息: ContextListener: attributeAdded('org.apache.jasper.compiler.TldLocationsCache', 'org.apache.jasper.compiler.TldLocationsCache@4a0cefb2') 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\examples has finished in 660 ms 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\hibernate 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\hibernate has finished in 364 ms 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\host-manager 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\host-manager has finished in 217 ms 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\jsp 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\jsp has finished in 286 ms 七月 22, 2019 11:14:17 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\login 七月 22, 2019 11:14:18 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\login has finished in 404 ms 七月 22, 2019 11:14:18 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\manager 七月 22, 2019 11:14:18 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\manager has finished in 210 ms 七月 22, 2019 11:14:18 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\ROOT 七月 22, 2019 11:14:18 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\ROOT has finished in 232 ms 七月 22, 2019 11:14:18 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\spring-hibernate 七月 22, 2019 11:14:20 上午 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplicationInitializer types detected on classpath 七月 22, 2019 11:14:20 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\spring-hibernate has finished in 1,884 ms 七月 22, 2019 11:14:20 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\SSH1 七月 22, 2019 11:14:22 上午 org.apache.catalina.core.ApplicationContext log 信息: No Spring WebApplicationInitializer types detected on classpath 七月 22, 2019 11:14:22 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\SSH1 has finished in 1,847 ms 七月 22, 2019 11:14:22 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deploying web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\test 七月 22, 2019 11:14:22 上午 org.apache.catalina.startup.HostConfig deployDirectory 信息: Deployment of web application directory H:\04. Servlet\apache-tomcat-7.0.56\webapps\test has finished in 279 ms 七月 22, 2019 11:14:22 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["http-apr-8080"] 七月 22, 2019 11:14:22 上午 org.apache.coyote.AbstractProtocol start 信息: Starting ProtocolHandler ["ajp-apr-8009"] 七月 22, 2019 11:14:22 上午 org.apache.catalina.startup.Catalina start 信息: Server startup in 7814 ms log4j:WARN No appenders could be found for logger (org.springframework.core.env.StandardEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 七月 22, 2019 11:14:42 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/SSH1] threw exception [org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: class path resource [jdbc.properties] cannot be opened because it does not exist] with root cause java.io.FileNotFoundException: class path resource [jdbc.properties] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:172) at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:154) at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:98) at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:177) at org.springframework.core.io.support.PropertiesLoaderSupport.mergeProperties(PropertiesLoaderSupport.java:158) at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.postProcessBeanFactory(PropertySourcesPlaceholderConfigurer.java:139) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:281) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:161) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84) at org.apache.jsp.login_jsp._jspService(login_jsp.java:86) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2462) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2451) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 七月 22, 2019 11:15:21 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/SSH1] threw exception [org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in URL [file:C:/Workspaces/MyEclipse2017CI/spring-hibernate/src/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSouce' of bean class [org.springframework.orm.hibernate4.LocalSessionFactoryBean]: Bean property 'dataSouce' is not writable or has an invalid setter method. Did you mean 'dataSource'?] with root cause org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSouce' of bean class [org.springframework.orm.hibernate4.LocalSessionFactoryBean]: Bean property 'dataSouce' is not writable or has an invalid setter method. Did you mean 'dataSource'? at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243) at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:437) at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:292) at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1564) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140) at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84) at org.apache.jsp.login_jsp._jspService(login_jsp.java:86) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2462) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2451) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 七月 22, 2019 11:18:07 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/SSH1] threw exception [An exception occurred processing JSP page /login.jsp at line 19 16: login=(Login)session.getAttribute("login"); 17: 18: if(login==null){ 19: ApplicationContext context=new ClassPathXmlApplicationContext( 20: "applicationContext.xml"); 21: LoginDao LoginDao=(LoginDao)context.getBean("LoginDaoImpl"); 22: login=LoginDao.login(uname,password); Stacktrace:] with root cause org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSouce' of bean class [org.springframework.orm.hibernate4.LocalSessionFactoryBean]: Bean property 'dataSouce' is not writable or has an invalid setter method. Did you mean 'dataSource'? at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243) at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:437) at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:292) at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:280) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:95) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1564) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1276) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83) at org.apache.jsp.login_jsp._jspService(login_jsp.java:86) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2462) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2451) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) ``` [图片说明](https://img-ask.csdn.net/upload/201907/22/1563776179_645013.jpg) ![图片说明](https://img-ask.csdn.net/upload/201907/22/1563787704_348502.jpg)

mybatis调用mysql存储过程时报错

<parameterMap type="java.util.Map" id="callMap"> <parameter property="pId" jdbcType="VARCHAR" mode="IN"/> <parameter property="colName" jdbcType="VARCHAR" mode="IN"/> <parameter property="colPname" jdbcType="VARCHAR" mode="IN"/> <parameter property="tName" jdbcType="VARCHAR" mode="IN"/> <parameter property="outColName" jdbcType="VARCHAR" mode="IN"/> <parameter property="retVal" jdbcType="VARCHAR" mode="OUT"/> <parameter property="userCount" jdbcType="INTEGER" mode="OUT"/> </parameterMap> <select id="getChildDeptAndCountByParentId" parameterMap="callMap" statementType="CALLABLE" > {CALL pro_getChildList( #{pId,jdbcType=VARCHAR,mode=IN}, #{colName,jdbcType=VARCHAR,mode=IN}, #{colPname,jdbcType=VARCHAR,mode=IN}, #{tName,jdbcType=VARCHAR,mode=IN}, #{outColName,jdbcType=VARCHAR,mode=IN}, #{retVal,jdbcType=VARCHAR,mode=OUT}, #{userCount,jdbcType=INTEGER,mode=OUT} )} </select> 在本机跟测试mysql 5.6.36中可以正常运行,但放到生产环境中,mysql版本为5.6.44时会抛出错误 std [0523 14:45:27 ERROR: druid.sql.Statement - {conn-10020, cstmt-20014} execute error. {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362) at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) at com.sun.proxy.$Proxy38.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId(<generated>) at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) std [0523 14:45:27 ERROR: com.alibaba.dubbo.rpc.filter.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 172.21.4.80. service: com.concom.yunzq.service.user.IDepartmentService, method: queryChildDeptAndCountByParentId, exception: org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 ### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml] ### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMap ### The error occurred while setting parameters ### SQL: {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1, dubbo version: 2.8.4, current host: 172.21.4.80 org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 ### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml] ### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMap ### The error occurred while setting parameters ### SQL: {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447) at com.sun.proxy.$Proxy38.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId(<generated>) at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:407) at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362) at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) ... 40 more

spring中关于form的错误

type Exception report message An exception occurred processing JSP page /Book_frontshow1.jsp at line 44 description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /Book_frontshow1.jsp at line 44 41: 42: <tr> 43: <td width=30%>学号:</td> 44: <td width=70%> <sf:input path="u_id" size="20"/> 45: </td> 46: </tr> 47:

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

Linux命令学习神器!命令看不懂直接给你解释!

大家都知道,Linux 系统有非常多的命令,而且每个命令又有非常多的用法,想要全部记住所有命令的所有用法,恐怕是一件不可能完成的任务。 一般情况下,我们学习一个命令时,要么直接百度去搜索它的用法,要么就直接用 man 命令去查看守冗长的帮助手册。这两个都可以实现我们的目标,但有没有更简便的方式呢? 答案是必须有的!今天给大家推荐一款有趣而实用学习神器 — kmdr,让你解锁 Linux 学习新姿势...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

史上最全的 python 基础知识汇总篇,没有比这再全面的了,建议收藏

网友们有福了,小编终于把基础篇的内容全部涉略了一遍,这是一篇关于基础知识的汇总的文章,请朋友们收下,不用客气,不过文章篇幅肯能会有点长,耐心阅读吧爬虫(七十)多进程multiproces...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

新一代神器STM32CubeMonitor介绍、下载、安装和使用教程

关注、星标公众号,不错过精彩内容作者:黄工公众号:strongerHuang最近ST官网悄悄新上线了一款比较强大的工具:STM32CubeMonitor V1.0.0。经过我研究和使用之...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

大学一路走来,学习互联网全靠这几个网站,最终拿下了一把offer

大佬原来都是这样炼成的

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

为什么你不想学习?只想玩?人是如何一步一步废掉的

不知道是不是只有我这样子,还是你们也有过类似的经历。 上学的时候总有很多光辉历史,学年名列前茅,或者单科目大佬,但是虽然慢慢地长大了,你开始懈怠了,开始废掉了。。。 什么?你说不知道具体的情况是怎么样的? 我来告诉你: 你常常潜意识里或者心理觉得,自己真正的生活或者奋斗还没有开始。总是幻想着自己还拥有大把时间,还有无限的可能,自己还能逆风翻盘,只不是自己还没开始罢了,自己以后肯定会变得特别厉害...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

你期望月薪4万,出门右拐,不送,这几个点,你也就是个初级的水平

先来看几个问题通过注解的方式注入依赖对象,介绍一下你知道的几种方式@Autowired和@Resource有何区别说一下@Autowired查找候选者的...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

立即提问
相关内容推荐