Course_Management_System | # # c 大作业之学生选课系统 # # # 1 、 开发环境配置 : | SQL Database library
kandi X-RAY | Course_Management_System Summary
kandi X-RAY | Course_Management_System Summary
##C++大作业之学生选课系统 ###1、开发环境配置:(Visual Studio 2013).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Course_Management_System
Course_Management_System Key Features
Course_Management_System Examples and Code Snippets
Community Discussions
Trending Discussions on Course_Management_System
QUESTION
I was having the following error: java.sql.SQLException: Cannot create PoolableConnectionFactory (Cannot open file:C:\AppServers\glassfish5\glassfish\domains\domain1/config/keystore.jks [Keystore was tampered with, or password was incorrect])
Solved it by simply adding useSSL=false
on MySQL database connection and JDBC_URL
String in class DBConnection.
Database Connection
...ANSWER
Answered 2021-Apr-13 at 01:43Your problem has nothing whatsoever to do with NullPointerException. Your exception handling is bad, and you need to fix it, so that you don't get confused again.
The problemYour exception handling scheme boils down to: "Print some information to standard out and just keep going". That last bit is the problem: Your code was not written with the notion that every line may simply do something, or nothing, depending on whether exceptions happen. Thus, your code keeps rolling and because things aren't in a state you expected, further errors occur, and these errors are completely irrelevant - they are not the problem, but they clog the logs and confuse you.
The right strategy to deal with exceptions is to deal with them. "Whatever, just print it out and keep on going" is not dealing with them. If you can't deal with them (and that's the common case), then just let the exception bubble up. Do not catch it unless you can write code that solves the problem. An exception that nothing can handle should bubble all the way up and roll up the thread, that's the best solution, and also the least code, so that's a win-win.
Methods that clearly are intended to interact with the database should be declared to throws SQLException
, and your public static void main
method should be declared to throws Exception
, which is allowed.
If you somehow MUST catch a checked exception even if you don't know what to do (that's bad), then at least put; throw new RuntimeException("Unhandled", e);
in your catch block, instead of `e.printStackTrace(System.out).
Your mysql driver is trying to load a corrupted keystore. That's a rather tricky problem.
Most likely you've added a configuration (or a default configuration is being applied) that expects a keystore file at
C:\AppServers\glassfish5\glassfish\domains\domain1/config/keystore.jks
- I don't think the problem is the mix of slashes (java usually understands this just fine), but I bet that file doesn't exist. Alternatively, you tried to make it, an exception occured, and the same deplorable exception handling has resulted in you not realizing that the keyfile is corrupt. Check the file - it's probably not there at all, or at 0 bytes. (Re)generate it, or fix the configuration.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Course_Management_System
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page