Log When JDBC Connection Is Acquired And Released

We are fond of one db session per request pattern. For web applications with JPA & Hibernate, it is good strategy in common cases. But for some long-running requests (definition of long-running depends on your use case, maybe 500 ms or 2 s), we need to tweak when we are actually acquiring a db connection … Read more

How To Solve XML Parsing Issue “Content is not allowed in prolog” In Java

If you have come to this post, then you are facing xml parsing issue in Java. Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) One common issue for this is BOM character. So what is a BOM (BYTE ORDER MARK) character? When you have … Read more

How To Fix “unable to find valid certification path to requested target” Error

If you are here, that means probably you have encountered below error: Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target         at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)         at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)         at sun.security.validator.Validator.validate(Validator.java:260)         at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)     … Read more