java中的invoke方法的作用,原理

求大神讲解一下invoke方法的机制,作用,原理,先谢谢了。

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Java--Mybatis foreach 循环之 数组(array)取值 方法

![图片说明](https://img-ask.csdn.net/upload/201906/03/1559573176_380982.png)![图片说明](https://img-ask.csdn.net/upload/201906/03/1559573182_58833.png) 错误详情: ```### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ] - (28462 ms) - 2019-6-3 22:35:45[DEBUG](JakartaCommonsLoggingImpl.java:46) Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@23103ebd] - (28463 ms) - 2019-6-3 22:35:45[DEBUG](DataSourceUtils.java:327) Returning JDBC Connection to DataSource - (28468 ms) - 2019-6-3 22:35:45[DEBUG](AbstractHandlerExceptionResolver.java:132) Resolving exception from handler [public java.lang.String com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(com.dms.pojo.Course,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,java.lang.String)]: org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 - (28483 ms) - 2019-6-3 22:35:45[DEBUG](AbstractHandlerExceptionResolver.java:132) Resolving exception from handler [public java.lang.String com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(com.dms.pojo.Course,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,java.lang.String)]: org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 - (28484 ms) - 2019-6-3 22:35:45[DEBUG](AbstractHandlerExceptionResolver.java:132) Resolving exception from handler [public java.lang.String com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(com.dms.pojo.Course,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,java.lang.String)]: org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 - (28507 ms) - 2019-6-3 22:35:45[DEBUG](AbstractHandlerExceptionResolver.java:132) Resolving exception from handler [public java.lang.String com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(com.dms.pojo.Course,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,java.lang.String)]: org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 - (28507 ms) - 2019-6-3 22:35:45[DEBUG](AbstractHandlerExceptionResolver.java:132) Resolving exception from handler [public java.lang.String com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(com.dms.pojo.Course,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,java.lang.String)]: org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 - (28513 ms) - 2019-6-3 22:35:45[DEBUG](AbstractHandlerExceptionResolver.java:132) Resolving exception from handler [public java.lang.String com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(com.dms.pojo.Course,javax.servlet.http.HttpSession,javax.servlet.http.HttpServletRequest,java.lang.String)]: org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 - (28514 ms) - 2019-6-3 22:35:45[DEBUG](FrameworkServlet.java:976) Could not complete request org.springframework.jdbc.BadSqlGrammarException: ### Error updating 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '吕试听'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '吕试听') - ?, ?,?, ?,?,?,?) insert into expense_info(cId,sId,expenseDate,expenseWeek,expenseSchoolTime,expenseCoach,createdName,expenseSurplusClassHour,expenseCoursesContent,expenseTeachResult,createdBy,creationDate,modifyBy,modifyDate) values( (select max(id) from course_info), (select s.id from student_info s where s.studentName = '3'), ?,?,?,?,? (select studentClassHourNum from student_info where studentName = '3') - ?, ?,?, ?,?,?,?) ### 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 ; 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:237) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364) at com.sun.proxy.$Proxy9.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:236) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:46) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43) at com.sun.proxy.$Proxy11.addExpenseInfo(Unknown Source) at com.dms.service.course.impl.CourseServiceImpl.addExpenseInfo(CourseServiceImpl.java:52) at com.dms.controller.monthlyinfo.CourseInfoController.courseInfoSave(CourseInfoController.java:375) 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.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:743) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:672) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:82) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) 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:660) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 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 '(select studentClassHourNum from student_info where studentName = '???è?????') -' at line 6 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:353) at com.mysql.jdbc.Util.getInstance(Util.java:336) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1601) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1710) at com.mysql.jdbc.Connection.execSQL(Connection.java:2436) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1402) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:977) at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169) 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.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:55) at com.sun.proxy.$Proxy25.execute(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137) 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:354) ... 50 more 1. ``` 这种写法如何取到值??

用反射调用私有方法,mapper没有注入进去的问题

今天跑单元测试遇到一个问题。 用反射调用私有方法,私有方法里面涉及调用数据库 mapper没有注入进去的 报了空指针 类似https://www.jianshu.com/p/4b3f55e76637 这个文章的情况 但是我对他解释的原因不是很认同 因为把private改为public后 就没有报空指针 个人猜测是因为Spring 无法得知私有方法的细节,也就无法注入,请大佬讲一下深入一点的原理 ,或者源码 代码类似于 ``` Class AImpl{ @Autowried private Amapper amapper priavte void f(){ amapper.select(); } } Class Test{ @Autowried private AImpl aImpl; public void test(){ Method method = AImpl.class.getDeclaredMethod("f",null); method.setAccessible(true); method.invoke(aImpl,null); } } ```

JDK动态代理的问题,看似简单,居然很多高手回答不了!大家来看看吧

用过JDK动态代理的人都熟悉下面的代码: interface Subject{void doSomething();} class RealSubject implements Subjuect{ public int var = 10; public void doSomething(){System.out.println("RealSubject.doSomething");} } public class SubjectProxyHandler implements InvocationHandler{ private Object proxiedObject; public Object createProxy(Object target) { //该函数传入被代理对象,返回代理对象 this.proxiedObject = target; return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), this); } public Object invoke(Object proxy, Method method, Object[] args) { //直接调用被对象对象的方法,下面两行随便哪个都能正常执行 return method.invoke(proxiedObject, args); return method.invoke(getJdkDynamicProxiedObject(proxy),args)) result= System.out.println("事物结束"); return result; } //下面的函数传入代理对象,返回被代理对象 private static Object getJdkDynamicProxiedObject(Object proxy) { Field h = proxy.getClass().getSuperclass().getDeclaredField("h"); h.setAccessible(true); AopProxy aopProxy = (AopProxy) h.get(proxy); Field advised = aopProxy.getClass().getDeclaredField("advised"); advised.setAccessible(true); Object target = ((AdvisedSupport)advised.get(aopProxy)).getTargetSource().getTarget(); return target; } } 以上忽略了main函数创建实际对象、代理对象等过程,以上代码没有问题能够正常执行,问题是: 1)Proxy.newProxyInstance传入被代理对象(即实际对象)的类、接口和InvocationHandler的实现,返回代理对象,但是却不需要传入被代理对象本身,也就是说创建代理对象的时候不需要被代理对象本身的,各位猜猜看代理对象的var的值是多少呢? 2)接着上面问题,建代理对象的时候不需要被代理对象本身的,但是getJdkDynamicProxiedObject却能够传入代理对象,返回被代理对象,这是如何做到的呢? 我就不悬赏了,因为我身边JAVA做了快十年的这帮人竟然都说不清,爱好技术的大牛们,挑战本身就是悬赏了

通过比较器实现比较排序 Collections.sort 报错

com/sinosoft/mall/freightTransport/ui/action/FreightTransportAction$1at com.sinosoft.mall.freightTransport.ui.action.FreightTransportAction.sortByName(FreightTransportAction.java:932)at com.sinosoft.mall.freightTransport.ui.action.FreightTransportAction.getParameter(FreightTransportAction.java:1048)at com.sinosoft.mall.freightTransport.ui.action.FreightTransportAction.paySend1(FreightTransportAction.java:836)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at com.sinosoft.sysframework.web.control.BaseProcessAction.execute(BaseProcessAction.java:60)at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)at com.sinosoft.admin.common.systemconfig.SessionFilter.doFilter(SessionFilter.java:64)at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)at com.sinosoft.admin.common.systemconfig.LanguageFilter.doFilter(LanguageFilter.java:53)at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2273)at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)11111111

启动Activity出现NullPointerException异常

package com.charming.sensor; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.Bundle; import android.view.View; import android.widget.TextView; public class MainActivity extends Activity implements SensorEventListener { private TextView valueView; private View top, left, right, bottom; private SensorManager sensorManager; private Sensor accelerometer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } private void init() { valueView = (TextView) findViewById(R.id.values); top = findViewById(R.id.top); bottom = findViewById(R.id.bottom); left = findViewById(R.id.left); right = findViewById(R.id.right); sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); } @Override protected void onResume() { super.onResume(); sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_UI); } @Override protected void onPause() { super.onPause(); sensorManager.unregisterListener(this); } @Override public void onSensorChanged(SensorEvent event) { float[] values = event.values; float x = values[0] / 10; float y = values[1] / 10; int scaleFactor; if (x > 0) { scaleFactor = (int) Math.min(x * 255, 255); right.setBackgroundColor(Color.argb(scaleFactor, 255, 0, 0)); left.setBackgroundColor(Color.TRANSPARENT); } else { scaleFactor = (int) Math.min(x * 255, 255); left.setBackgroundColor(Color.argb(scaleFactor, 255, 0, 0)); right.setBackgroundColor(Color.TRANSPARENT); } if (y > 0) { scaleFactor = (int) Math.min(x * 255, 255); top.setBackgroundColor(Color.argb(scaleFactor, 255, 0, 0)); bottom.setBackgroundColor(Color.TRANSPARENT); } else { scaleFactor = (int) Math.min(x * 255, 255); bottom.setBackgroundColor(Color.argb(scaleFactor, 255, 0, 0)); top.setBackgroundColor(Color.TRANSPARENT); } valueView.setText("x:" + x + " " + "y:" + y); } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } } 布局文件 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.charming.sensor.MainActivity"> <TableLayout android:layout_width="match_parent" android:layout_height="match_parent" android:stretchColumns="0, 1, 2"> <TableRow android:layout_weight="1"> <view android:id="@+id/top" android:layout_column="1" /> </TableRow> <TableRow android:layout_weight="1"> <view android:id="@+id/left" android:layout_column="0" /> <view android:id="@+id/right" android:layout_column="2" /> </TableRow> <TableRow android:layout_weight="1"> <view android:id="@+id/bottom" android:layout_column="1" /> </TableRow> </TableLayout> <TextView android:id="@+id/values" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" /> </RelativeLayout> log E/AndroidRuntime: FATAL EXCEPTION: main Process: com.charming.myapplication, PID: 7837 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.charming.myapplication/com.charming.myapplication.MainActivity}: android.view.InflateException: Binary XML file line #16: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: android.view.InflateException: Binary XML file line #16: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at android.view.LayoutInflater.inflate(LayoutInflater.java:539) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) at android.app.Activity.setContentView(Activity.java:2166) at com.charming.myapplication.MainActivity.onCreate(MainActivity.java:24) at android.app.Activity.performCreate(Activity.java:6237) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:738) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)  at android.app.Activity.setContentView(Activity.java:2166)  at com.charming.myapplication.MainActivity.onCreate(MainActivity.java:24)  at android.app.Activity.performCreate(Activity.java:6237)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

java连接MYSQL数据库第一次可以,第二次报错

做项目在做一个用户首次登陆输入手机号码,发送随机密码的功能模块,首次点击完全没问题,系统会发送短信(中国移动的短信机的原理是连接它的数据库,插入一条数据即可)问题就出在连接数据库的问题上,再次发送,则后台报错ResultSet is from UPDATE. No Data.。 报错信息如下 ``` 严重: Exception occurred during processing request: ResultSet is from UPDATE. No Data. java.sql.SQLException: ResultSet is from UPDATE. No Data. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7152) at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3867) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3404) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2385) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at DAO.dbconnection2.<init>(dbconnection2.java:16) at action.testsendaction.execute(testsendaction.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ``` dbconnection2.java 是创建连接,代码如下: ``` package DAO; import java.sql.Connection; import java.sql.DriverManager; public class dbconnection2 { private static final String DRIVER = "com.mysql.jdbc.Driver"; private static final String URL = "jdbc:mysql://*******:3306/mas?useUnicode=true&characterEncoding=gb2312"; private static final String USER = "ywz"; private static final String PASSWORD = "yw690"; private Connection con; public dbconnection2() throws Exception{ Class.forName(DRIVER); this.con = DriverManager.getConnection(URL, USER, PASSWORD); } public Connection getConnection() { return this.con; } public void closecon() throws Exception { if(this.con != null) { try { this.con.close(); } catch(Exception e) { throw e; } } } } ``` action代码: ``` public class testsendaction extends ActionSupport{ private String list; public String getList() { return list; } public void setList(String list) { this.list = list; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } private String content; public String execute() throws Exception{ dbconnection2 dbc2 = new dbconnection2(); Statement s1 = dbc2.getConnection().createStatement(); Random ran = new Random(); String pwd = ""; for(int i=0;i<6;i++) { pwd += ran.nextInt(10)+""; } System.out.println("ranpwd="+pwd); String mess = "本信息来自工资查询系统,用于用户的首次登陆,登陆密码为:"+pwd+" ,登陆成功后,请自行修改密码。"; String send = "insert into api_mt_6(mobiles,content) values('"+list+"','"+mess+"')"; s1.executeUpdate(send); System.out.println("send:"+send); s1.close(); dbc2.closecon(); return SUCCESS; } } ``` 报错是在数据库连接的new语句上。 连接最后也有关闭。但是就是不能进行二次访问数据库。只能重启下tomcat,然后又可以登录一次,第二次也无法连接了。 找了好久都没发现原因,希望大家帮帮忙 ,谢谢了!

有谁用过 ActiveJDBC 这个orm框架吗

想找一个简单的orm框架,写点小东西,hb 和ib 感觉有点大,不值当,于是选了 感觉挺好的,可是我将 官方的例子导入运行 却报错了,不知道什么愿意,求大神!坐等... Exception in thread "main" org.javalite.activejdbc.DBException: failed to determine Model class name, are you sure models have been instrumented? at org.javalite.activejdbc.Model$ClassGetter.getClassName(Model.java:2357) at org.javalite.activejdbc.Model.getClassName(Model.java:2330) at org.javalite.activejdbc.Model.getDaClass(Model.java:2322) at org.javalite.activejdbc.Model.getMetaModel(Model.java:60) at org.javalite.activejdbc.Model.getMetaModelLocal(Model.java:974) at org.javalite.activejdbc.Model.set(Model.java:211) at Main.main(Main.java:11) 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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?

Spring Security @PreAuthorize 问题

最近在做一个spring security的项目,遇到了一个@PreAuthorize 问题。 在interface里面我用@PreAuthorize标记了一些method, public interface PoiActionInterface { @PreAuthorize("hasRole('ROLE_ADMIN')") public String editPoi(); @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_USER')") public String listPois(); @PreAuthorize("hasRole('ROLE_ADMIN')") public String generatePoi() throws IOException, TemplateException; @PreAuthorize("hasRole('ROLE_ADMIN')") public String deletePoi(); @PreAuthorize("hasRole('ROLE_USER')") public String trc(); } 在web server启动之后,如果权限不对,会提示exception message: access denied. 但是如果权限对了时候,会出现一些奇怪的问题, public class POIAction extends ActionSupport implements PoiActionInterface { private static final long serialVersionUID = "$Id: POIAction.java 42163 2011-08-16 18:39:30Z shany@telenav.com $".hashCode(); @Autowired private TrcHibernateService trcHibernateService; @Autowired private MailService mailService; @Autowired private TemplateService templateService; private UserGeneratedPoi userPoi; private UserGeneratedPoiDetail userPoiDetail; private String timeStart; private String timeEnd; private Integer action; private String poiid; private List<UserGeneratedPoi> userPois; private static String userFirstName; public void setUserFirstName(String userFirstName) { POIAction.userFirstName = userFirstName; } public String getUserFirstName() { return userFirstName; } public void setUserPoi(UserGeneratedPoi userPoi) { this.userPoi = userPoi; } public UserGeneratedPoi getUserPoi() { return userPoi; } public String getPoiid() { return poiid; } public void setPoiid(String poiid) { this.poiid = poiid; } public void setTimeStart(String timeStart) { this.timeStart = timeStart; } public String getTimeStart() { return timeStart; } public void setTimeEnd(String timeEnd) { this.timeEnd = timeEnd; } public String getTimeEnd() { return timeEnd; } public void setUserPoiDetail(UserGeneratedPoiDetail userPoiDetail) { this.userPoiDetail = userPoiDetail; } public UserGeneratedPoiDetail getUserPoiDetail() { return userPoiDetail; } public void setAction(Integer action) { this.action = action; } public Integer getAction() { return action; } public void setUserPois(List<UserGeneratedPoi> userPois) { this.userPois = userPois; } public List<UserGeneratedPoi> getUserPois() { return userPois; } public void getFirstName() { Object obj = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); POIAction.userFirstName = ((TrcUserDetail) obj).getFirstName(); } @SkipValidation @Action(value = "trc", results = { @Result(name = "success", location = "page.addpoi", type = "tiles") }) public String trc() { return SUCCESS; } @SkipValidation @Action(value = "editpoi", results = { @Result(name = "success", location = "page.editpoi", type = "tiles") }) public String editPoi() { this.userPoi = trcHibernateService.getById(UserGeneratedPoi.class, Integer.valueOf(poiid)); this.userPoiDetail = trcHibernateService.getById(UserGeneratedPoiDetail.class, Integer.valueOf(poiid)); if (userPoiDetail.getBusinessHour() != null && userPoiDetail.getBusinessHour().split(" ").length > 0) { setTimeStart(userPoiDetail.getBusinessHour().split(" ")[0]); setTimeEnd(userPoiDetail.getBusinessHour().split(" ")[1]); } return SUCCESS; } @SkipValidation @Action(value = "deletepoi", results = { @Result(name = "success", location = "page.listpois", type = "tiles") }) public String deletePoi() { this.userPoi = trcHibernateService.getById(UserGeneratedPoi.class, Integer.valueOf(poiid)); this.userPoiDetail = trcHibernateService.getById(UserGeneratedPoiDetail.class, Integer.valueOf(poiid)); trcHibernateService.delete(this.userPoiDetail); trcHibernateService.delete(this.userPoi); this.userPois = trcHibernateService.getAll(UserGeneratedPoi.class); return SUCCESS; } @SkipValidation @Action(value = "listpois", results = { @Result(name = "success", location = "page.listpois", type = "tiles") }) public String listPois() { getFirstName(); this.userPois = trcHibernateService.getAll(UserGeneratedPoi.class); return SUCCESS; } @Validations(requiredStrings = { @RequiredStringValidator(type = ValidatorType.FIELD, fieldName = "userPoi.brandName", message = "You must enter a brand name for POIs."), @RequiredStringValidator(type = ValidatorType.FIELD, fieldName = "userPoi.street1", message = "You must enter a street address for POIs."), @RequiredStringValidator(type = ValidatorType.FIELD, fieldName = "userPoi.city", message = "You must enter a city name for POIs."), @RequiredStringValidator(type = ValidatorType.FIELD, fieldName = "userPoi.state", message = "You must enter a state name for POIs."), @RequiredStringValidator(type = ValidatorType.FIELD, fieldName = "userPoi.zip", message = "You must enter a zip code for POIs.") }, stringLengthFields = { @StringLengthFieldValidator(type = ValidatorType.FIELD, trim = true, minLength = "1", maxLength = "20", fieldName = "userPoi.street1", message = "Street 1 only can have at most 20 characters") }) @Action(value = "generatepoi", results = { @Result(name = "success", location = "page.message", type = "tiles"), @Result(name = "input", location = "page.addpoi", type = "tiles") }) public String generatePoi() throws IOException, TemplateException { SecurityContext context = SecurityContextHolder.getContext(); Authentication authentication = context.getAuthentication(); User user = new User(); user.setName(authentication.getName()); user = trcHibernateService.getAll(User.class, user).get(0); userPoi.setUserByUserId(user); if (userPoi.getId() == null) { trcHibernateService.save(userPoi); } else { try { trcHibernateService.merge(userPoi); setAction(Integer.valueOf(1)); } catch (DataIntegrityViolationException dve) { addFieldError("userPoi.id", getText("dupicate poi id")); return INPUT; } } userPoiDetail.setId(userPoi.getId()); userPoiDetail.setBusinessHour(getTimeStart() + " " + getTimeEnd() + " "); if (trcHibernateService.getById(UserGeneratedPoiDetail.class, userPoi.getId()) == null) { userPoiDetail.setUserGeneratedPoi(userPoi); trcHibernateService.save(userPoiDetail); } else { try { trcHibernateService.merge(userPoiDetail); } catch (DataIntegrityViolationException dve) { addFieldError("userPoiDetail.poiId", getText("dupicate poi detail id")); return INPUT; } } if (action == null) { addActionMessage(getText("addpoi.successful", null, "")); mailService.sendMail("shany@telenav.com", "POI Added", templateService.getNewPoiNotificationText(userPoi.getId().toString())); } else { addActionMessage(getText("editpoi.successful", null, "")); } return SUCCESS; } } 所有@autowired的object全部都是null, 所以在做action的时候会有Nullpointexception出现。 Exception Stack: java.lang.NullPointerException at com.telenav.trc.action.common.POIAction.listPois(POIAction.java:172) at com.telenav.trc.action.common.POIAction$$FastClassByCGLIB$$83c14b0a.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:688) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:67) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621) at com.telenav.trc.action.common.POIAction$$EnhancerByCGLIB$$40826733.listPois(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:61) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248) at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498) at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77) at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) 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.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:662)

使用windows ad作为kdc,linux中kerberos令牌认证的问题

使用kinit -k -t的时候提示: [root@xyfengkong joindomain]# kinit -k -t fengkong.keytab fengkong kinit: Keytab contains no suitable keys for fengkong@JRTEST.LOCAL while getting initial credentialsgkong.jrtest.local@JRTEST.LOCAL AdminServer.log: while getting initial credentials javax.security.auth.login.LoginException: weblogic.security.spi.IdentityAssertionException: com.bea.security.utils.kerberos.KerberosException: No valid credentials provided (Mechanism level: Attempt to obtain new ACCEPT credentials failed!) at com.bea.common.security.internal.service.ChallengeIdentityAssertionServiceImpl.assertChallengeIdentity(ChallengeIdentityAssertionServiceImpl.java:128) 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 com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57) at com.sun.proxy.$Proxy18.assertChallengeIdentity(Unknown Source) at com.bea.common.security.internal.service.NegotiateIdentityAsserterServiceImpl$NegotiateHandler.assertChallengeContext(NegotiateIdentityAsserterServiceImpl.java:327) at com.bea.common.security.internal.service.NegotiateIdentityAsserterServiceImpl$NegotiateHandler.process(NegotiateIdentityAsserterServiceImpl.java:212) at com.bea.common.security.internal.service.NegotiateIdentityAsserterServiceImpl.process(NegotiateIdentityAsserterServiceImpl.java:130) 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 com.bea.common.security.internal.utils.Delegator$ProxyInvocationHandler.invoke(Delegator.java:57) at com.sun.proxy.$Proxy19.process(Unknown Source) at weblogic.security.providers.authentication.NegotiateIdentityAsserterServletAuthenticationFilter.doFilter(NegotiateIdentityAsserterServletAuthenticationFilter.java:33) at weblogic.servlet.security.internal.AuthFilterChain.doFilter(AuthFilterChain.java:34) at weblogic.servlet.security.internal.WebAppSecurity$ServletAuthenticationFilterAction.run(WebAppSecurity.java:887) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.security.internal.WebAppSecurity.invokeAuthFilterChain(WebAppSecurity.java:828) at weblogic.servlet.security.internal.CertSecurityModule.checkUserPerm(CertSecurityModule.java:87) at weblogic.servlet.security.internal.SecurityModule.checkAccess(SecurityModule.java:95) at weblogic.servlet.security.internal.SecurityModule.isAuthorized(SecurityModule.java:543) at weblogic.servlet.security.internal.WebAppSecurity.checkAccess(WebAppSecurity.java:499) at weblogic.servlet.security.internal.WebAppSecurity.checkAccess(WebAppSecurity.java:463) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2119) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2089) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2074) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1513) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256) at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

flink中的排重逻辑如何处理比较好

flink中如何对于所有的数据进行基于主键的去重。目前采用的keyBy(pk)后通过状态过滤,实际运行的时候checkpoints时间太长,非常阻塞性能。有没有什么更好的处理方式。另外flink-sql中的distinct具体实现逻辑是什么样子,必须指定窗口么。

自定义ClassLoader问题

今天看了ClassLoader基本原理,想自定义个ClassLoader加载类,对任何路径的class类都实用,代码如下: package test; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import org.apache.commons.io.FileUtils; public class MyClassLoader extends ClassLoader { @Override protected Class<?> findClass(String name) throws ClassNotFoundException { String path = null; String[] names = null; try { path = super.getSystemResource("").getPath(); names = name.split("/"); FileUtils.copyFile(new File(name), new File(path+"/"+(getPkgname()+"\\.").replaceAll("\\.", "/")+names[names.length-1])); } catch (IOException e) { e.printStackTrace(); } String classname = getPkgname()+"."+names[names.length-1].split("\\.")[0]; return super.getSystemClassLoader().loadClass(classname); } private String pkgname; public String getPkgname() { return pkgname; } public void setPkgname(String pkgname) { this.pkgname = pkgname; } } ``` public static void main(String[] args) throws SQLException { try { MyClassLoader my = new MyClassLoader(); my.setPkgname("test"); Class c = my.findClass("D:/Test2.class"); Object o = c.newInstance(); Method[] methods = c.getDeclaredMethods(); for (int i = 0; i < methods.length; i++) { System.out.println(methods[i].getName()); methods[i].invoke(o, null); } } catch (Exception e) { e.printStackTrace(); } ``` package test; public class Test2 { public void printa(){ System.out.println("xixi"); } } 以上分别为自定义类,测试运行类和被加载类。 代码很简单,现在问题是类似这种加载classpath外的绝对路径的类java本身的ClassLoader没有这样的方法吗?然后我这样自定义的Classloader怎么在加载时启动?不可能想上面这样直接调用加载器的方法吧,求csdn大神指点!

atomikos分布式事务问题

环境:spring+tomcat+atomikos.看错误信息和jta超时时间有关,但是我已经配置超时时间比较大了,还是不能解决这个问题:我的配置是com.tomikos.icatch.default_jta_timeout=200000,错误信息如下: ERROR org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler - Unexpected error occurred in scheduled task. org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Rolled back already.[2016-07-07 11:00:17,262][pool-1-thread-1] ERROR org.springframework.scheduling.support.TaskUtils$LoggingErrorHandler - Unexpected error occurred in scheduled task. org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException: Rolled back already. at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1024) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:757) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) 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:653) at com.jinr.useryield.service.impl.DayYieldMessageServiceImpl$$EnhancerBySpringCGLIB$$7cbcfd50.findAll(<generated>) at com.jinr.useryield.scheduler.DayYieldMessageProduceJob.run(DayYieldMessageProduceJob.java:57) 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.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: javax.transaction.RollbackException: Rolled back already. at com.atomikos.icatch.jta.TransactionImp.rethrowAsJtaRollbackException(TransactionImp.java:48) at com.atomikos.icatch.jta.TransactionImp.commit(TransactionImp.java:188) at com.atomikos.icatch.jta.TransactionManagerImp.commit(TransactionManagerImp.java:414) at com.atomikos.icatch.jta.UserTransactionImp.commit(UserTransactionImp.java:86) at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1021) ... 25 more

导入hibernate 的效验框架validation需要的jar包 就会出现的500报错

springMvc的学习,在导入hibernate 的效验框架validation需要的jar包 就会出现的500报错 把三个包删掉就运行正常 <br/> <br/> 以下是报错信息 ``` javax.servlet.ServletException: Servlet.init() for servlet [springmvc] threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) ``` ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean#0': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.validation.beanvalidation.OptionalValidatorFactoryBean] from ClassLoader [ParallelWebappClassLoader context: SpringMvc01 delegate: false ----------> Parent Classloader: java.net.URLClassLoader@5a07e868 ] org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:265) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1236) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1151) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:538) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:846) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:863) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:745) ```

谁遇到过腾讯Bugly统计的这种bug

1、 # main(1) SIGSEGV(SEGV_MAPERR) 解析原始 1 #00 pc 00002d28 /system/lib/libPowerStretch.so (LucidConfig::calcTargetFPS(int)+27) [armeabi-v7a] 2 #01 pc 41863584 <unknown> 3 java: 4 com.google.android.gles_jni.EGLImpl.eglReleaseThread(Native Method) 5 android.view.HardwareRenderer$Gl20Renderer$Gl20RendererEglContext.onTerminate(HardwareRenderer.java:1743) 6 android.opengl.ManagedEGLContext.execTerminate(ManagedEGLContext.java:84) 7 android.opengl.ManagedEGLContext.doTerminate(ManagedEGLContext.java:132) 8 android.view.WindowManagerGlobal.endTrimMemory(WindowManagerGlobal.java:460) 9 android.app.ActivityThread.handleTrimMemory(ActivityThread.java:4374) 10 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) 11 android.os.Handler.dispatchMessage(Handler.java:99) 12 android.os.Looper.loop(Looper.java:137) 13 android.app.ActivityThread.main(ActivityThread.java:5450) 14 java.lang.reflect.Method.invokeNative(Native Method) 15 java.lang.reflect.Method.invoke(Method.java:525) 16 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187) 17 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) 18 dalvik.system.NativeStart.main(Native Method) 2、 # main(1) SIGSEGV(SEGV_MAPERR) 解析原始 1 #00 pc 0002975c /system/lib/libdvm.so (javaLangString_length(unsigned int, unsigned int, unsigned int, unsigned int, JValue*)+12) [armeabi-v7a] 2 #01 pc 000228a4 /system/lib/libdvm.so [armeabi-v7a] 3 #02 pc 6d5a02f4 <unknown> 4 java: 5 java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:142) 6 java.lang.StringBuilder.append(StringBuilder.java:216) 7 android.net.NetworkInfo.toString(NetworkInfo.java:444) 8 java.lang.StringBuilder.append(StringBuilder.java:202) 9 com.igexin.push.core.n.a(Unknown Source) 10 com.igexin.push.core.n.onReceive(Unknown Source) 11 android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:794) 12 android.os.Handler.handleCallback(Handler.java:733) 13 android.os.Handler.dispatchMessage(Handler.java:95) 14 android.os.Looper.loop(Looper.java:136) 15 android.app.ActivityThread.main(ActivityThread.java:5314) 16 java.lang.reflect.Method.invokeNative(Native Method) 17 java.lang.reflect.Method.invoke(Method.java:515) 18 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) 19 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:680) 20 dalvik.system.NativeStart.main(Native Method)

如何通过DWR获得登陆口输入的验证码?

验证码是通过struts2的Action来生成的, 一旦通过DWR 框架,那么dwr2.0中 好像还是不太支持struts2, 请问该如何处理呢? 才能在userService.checkLogin(User user,String verifyCode) 中获取到验证码? 我的dwr配置是通过Spring的注入bean来设置的 <dwr> <allow> <convert converter="bean" match="com.squall.oa.model.User" javascript="myUser"/> <create creator="spring" javascript="userService"> <param name="beanName" value="userService"/> <include method="checkLogin"/> </create> </allow> </dwr> [b]问题补充:[/b] TO:lovewhzlq (资深架构师) 感谢您的答复!! 那么在dwr中 为什么必须要通过 org.directwebremoting.WebContextFactory.get().getHttpServletRequest().getSession(); 去获得Session呢? 能告诉下小弟原理是为什么吗? [b]问题补充:[/b] 问题还是没解决 在UserService层中 调用 org.directwebremoting.WebContextFactory.get().getHttpServletRequest().getSession(); 出错 java.lang.NullPointerException at com.squall.oa.service.impl.UserServiceImpl.checkLogin(UserServiceImpl.java:84) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy11.checkLogin(Unknown Source) at com.squall.oa.action.UserAction.checkLogin(UserAction.java:41) at com.squall.oa.action.UserAction.execute(UserAction.java:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404) at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229) at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221) at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) [b]问题补充:[/b] 谢谢,可是问题还是没解决,仍然报错~ 我郁闷死了,难道s2sh 这样的架构,整合dwr这么费劲么? [b]问题补充:[/b] TO:jansel (高级程序员) 我在测试struts2整合dwr2.0框架、 郁闷了半天,都看遍了,还是报告 'DWRActionUtil' 未定义 我都看了~~ 网站目录下也有 DWRActionUtil.js [b]问题补充:[/b] TO:jansel (高级程序员) 我已经整合成功了! 但是 现在就差传参数了!~~ 我前台js是这么写的, 你看行么? var username,password,result; username = $("uname").value; password = $("upass").value; var myUser = {}; myUser.u_name = username; myUser.u_pass = password; DWRActionUtil.execute({ namespace:'/user', action:'checkLogin', executeResult:'false', params:myUser }, 'frmLogin', callBackLogin);//frmDwr为表单id [b]问题补充:[/b] 那您觉得 现在如何设计登录口比较合理? 最主要的是安全、稳定!

关于反射的问题

JAVA的反射机制。 最近看了一下一些发行的库,比如objot等是说运行是没有反射。实现了ioc与aop,不再有反射。是什么原理哦?比如我要动态地调用某个类的某个方法,就只有方法名与类名,参数列表类型,不使用反射能完成吗? 关于反射,我真被搞晕了,什么时候才算是反射呢? 比如 Class A { int field; void method(); } 在操作A类时。 A a = new A(); //或者这里发生反射了吗? Class<?> c = a.getClass(); Class<?> c = A.class; //这里发生反射的操作了吗? Method m = c.getDeclaredMethod("method",new Class[]{}); //这里应该发生了反射吧? m.invoke(a); //这里还算是反射吗? 我有一个Method对象时,调用method的invoke方法还算是反射吗? 能详细说说这个吗?我老觉得我一用反射来做东西,就联想到它的性能比较差。想找代替品,又找不到更灵活的。唉。。

海康SDK如何实现视频流转发

class FRealDataCallBack implements HCNetSDK.FRealDataCallBack_V30 { //预览回调 public void invoke(NativeLong lRealHandle, int dwDataType, ByteByReference pBuffer, int dwBufSize, Pointer pUser) { HWND hwnd =hwand; switch (dwDataType) { case HCNetSDK.NET_DVR_SYSHEAD: //系统头 if (!playControl.PlayM4_GetPort(m_lPort)) //获取播放库未使用的通道号 { break; } if (dwBufSize > 0) { if (!playControl.PlayM4_SetStreamOpenMode(m_lPort.getValue(), PlayCtrl.STREAME_REALTIME)) //设置实时流播放模式 { break; } if (!playControl.PlayM4_OpenStream(m_lPort.getValue(), pBuffer, dwBufSize, 1024 * 1024)) //打开流接口 { break; } if (!playControl.PlayM4_Play(m_lPort.getValue(), hwnd)) //播放开始 { break; } } case HCNetSDK.NET_DVR_STREAMDATA: //码流数据 if ((dwBufSize > 0) && (m_lPort.getValue().intValue() != -1)) { if (!playControl.PlayM4_InputData(m_lPort.getValue(), pBuffer, dwBufSize)) //输入流数据 { break; } } } } 回调函数里的pBuffer是否就是流数据,对于实时预览要如何处理流数据的转发

关于hibernate一个类和多个类有关联关系

``` hibernate一个类和两个类有关联关系,但是第二个类的数组实例化是,我的代码如下 ------------------------------------------------------------------ @Entity @Table(name="user") public class User { @Id @GenericGenerator(name="uid",strategy="increment") @GeneratedValue(generator="uid") private Integer id; private String number; private String name; private String password; @OneToMany @JoinColumn(name="uid") @Cascade(org.hibernate.annotations.CascadeType.ALL) private List<Scart> scart=new ArrayList<Scart>(); @OneToMany @JoinColumn(name="uuid") @Cascade(org.hibernate.annotations.CascadeType.ALL) private List<Order> order=new ArrayList<Order>(); public List<Order> getOrder() { return order; } public void setOrder(List<Order> order) { this.order = order; } public User(String number, String name, String password) { super(); this.number = number; this.name = name; this.password = password; } public User() { // TODO Auto-generated constructor stub } public List<Scart> getScart() { return scart; } public void setScart(List<Scart> scart) { this.scart = scart; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } ---------------------------------------------------------- @Entity @Table(name="order") public class Order { @Id @GenericGenerator(name="sid",strategy="increment") @GeneratedValue(generator="sid") private Integer id; private String name; private String url; private String number; private String price; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } } ------------------------------------------------------------------------------------- @Entity @Table(name="scart") public class Scart { @Id @GenericGenerator(name="sid",strategy="increment") @GeneratedValue(generator="sid") private Integer id; private String name; private String url; private String price; private String number; public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } } -------------------------------------------------------------- public class Test2 { @Test public void test(){ org.hibernate.Session session=HibernateUtil.openSession(); Transaction tx=session.beginTransaction(); String hql="from User u where u.number='20177720378'"; Query query=session.createQuery(hql); User user=(User) query.list().get(0); Scart scart=new Scart(); scart.setName("计算机组成原理第二版"); user.getScart().add(scart); tx.begin(); session.save(user); tx.commit(); } @Test public void test2(){ Session session=HibernateUtil.openSession(); Transaction tx=session.beginTransaction(); String hql="from User u where u.number='20177720378'"; Query query=session.createQuery(hql); User user=(User) query.list().get(0); System.out.println(user.getName()); Order order=new Order(); order.setName("计算机"); user.getOrder().add(order); tx.begin(); session.save(user); tx.commit(); } } -------------------------------------------------------------- 运行结果就是第一个测试成功,第二个测试失败了 运行结果如下 Hibernate: select user0_.id as id0_, user0_.name as name0_, user0_.number as number0_, user0_.password as password0_ from user user0_ where user0_.number='20177720378' 周小坡 Hibernate: select order0_.uuid as uuid0_1_, --------------------------------------------------------------------- 报错信息如下 org.hibernate.exception.SQLGrammarException: could not initialize a collection: [users.User.order#1] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.loader.Loader.loadCollection(Loader.java:2173) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:627) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1863) at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:369) at org.hibernate.collection.AbstractPersistentCollection.write(AbstractPersistentCollection.java:208) at org.hibernate.collection.PersistentBag.add(PersistentBag.java:297) at test.Test2.test2(Test2.java:40) 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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 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 'order order0_ where order0_.uuid=1' 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:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2011) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208) at org.hibernate.loader.Loader.getResultSet(Loader.java:1953) at org.hibernate.loader.Loader.doQuery(Loader.java:802) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) at org.hibernate.loader.Loader.loadCollection(Loader.java:2166) ... 31 more ```

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

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

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

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

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

ArrayList源码分析(入门篇)

ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为

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

数据结构与算法思维导图

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

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

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

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

和黑客斗争的 6 天!

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

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

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

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

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

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

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

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

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

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

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

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

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

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

玩转springboot启动banner定义所得

最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

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

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

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

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

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

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

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

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

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

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

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

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

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

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

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

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

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

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

立即提问
相关内容推荐