java - Exception Caught Too Early -
Background: Hibernate connects to a database using the username and password entered in a GUI background, after the failure, the exception is the form. Instead of promoting the error, it comes out as a stack trace in the logger. I do not know where the exception is being caught. Apart from this, a small disturbance is the following block:
if (cause! = Null) {println ("getConnection failed:" + cause); Remove the reason; }
My breakpoint is set to throw (and successfully trigger) the line, but the println statement has never produced a generation (MySQL is using some type of logger setup. Open file can not be found) An exception has been caught, where to find any kind of trick?
1 Edit:
I call
sessionFactory = / * encryption configuration * / AC buildification (factor) ;
The exception is caught by Hibernate somewhere between java.sql.DriverManager
class and my HibernateUtil
class. I think we can decide to be in hibernation that I really do not want to see the exception. I want to hibernate to see the exception.
Edit 2:
My stack is:
java.sql.SQLException: com.mysql At jdbc.SQLError com.mysql.jdbc.SQLError.createSQLException (SQLError.java:1055): Access user user denied '@' machine '(yes using password). Com.mysql.jdbc.MysqlIO.checkErrorPacket (MySqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket (MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO createSQLException (SQLError.java:956) .checkErrorPacket (MysqlIO.java:910) on com.mysql.jdbc.MysqlIO.doHandshake (MysqlIO.java:1273) on com.mysql.jdbc on com.mysql.jdbc.MysqlIO.secureAuth411 (MysqlIO.java:3923). ConnectionImpl.createNewIO (ConnectionImpl.java:2031) at com.mysql.jdbc.ConnectionImpl. & Lt; Init>. (ConnectionImpl.java:718) com.mysql.jdbc.JDBC4Connection at & lt; Init & gt; (JDBC4Connection.java:46) Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (on the original method) at sun.reflect. Native constructor on JavaklangkreflectkConstructorknewInstance (Knstrctorkjawa) 1313) on Com.mysql.jdbc.Util Setor Inplrknetu instance (Native constructor Avesor Inplkxava 3 9). But quickly. Reflect.DellegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:27) on java.lang.reflect.Constructor.newInstance. .handleNewInstance (Util.java:406) com.mysql.jdbc.ConnectionImpl.getInstance (ConnectionImpl.java:302) is thrown on the com.mysql.jdbc.NonRegisteringDriver.connect (NonRegisteringDriver.java:282) / * Exception 1 code block in the next line (original post) * / at / JavaksqlkDriverManagerkgetConnection (DriverManagerkjava:582) on java.sql.DriverManager.getConnection (DriverManager.java:154) * start hidden source * / on org.hibernate.cfg.SettingsFactory.buildSettings call org.hibernate.connection.DriverManagerConnectionProvider.getConnection (DriverManagerConnectionProvider.java:110) (SettingsFactory.java:84) on org.hibernate.cfg.Configuration.buildSettings (Configuration.java: 2009) at org.hibernate.cfg.configuration buildSessionFactory (Configuration.java:1292) org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory (AnnotationConfiguration.java:859) is / * end calls on the hidden source * / com. **** **** Util.HibernateUtil Initialization (HibernateUtil.java34)
I can not get the debugger to see any point above the stack beyond the driver. In front of it, everything in the pile does not appear in the debugger.
First of all, as you think that there is a logger, you can call logs All the println
statements should be changed.
You can also add forward log messages to identify what happens inside the app. Alternatively (or in conjunction with above), you can see steps through the important code part in the debugger where the exception is actually.