Eclipse Web Application and Maven Dependency Issues

When development web application in eclipse and use maven to manage dependency we usually face with some problem as missing library at runtime cause maven dependency issues. In this post i show you how to dianostic that issue.
Step 1. Enable/disable Maven feature
On Eclipse IDE, right click on the project, choose maven->Disable Maven Nature
After that right click on project choose Configure-> Convert to maven project

If you already do this step but no luck, move to step 2
Step 2. Clean and update project
Some time you get exception cause library download by maven get corrupt cause network issue. Check log on console tab carefully to find what library have issue and go to maven local repository to delete that library(you can also delete all). Normal maven local repository lay on %USERPROFILE%/.m2
Next, In Eclipse IDE right click choose maven->update project


If your project still not work when run, go to next step.

Step 3. Checking Deployment Assembly
Right click on project in Eclipse IDE, choose properties and choose Deployment Assembly. Please make sure your project have minimal as below if you don’t using any other library in WEB-INF/lib. If you using more you can manuall add to Deployment Assembly by click Add button.


how to import certificate into java trust store

When using Java application to access server that using invalid certificate or self-signed certificate, you maybe will get below exception: PKIX path building failed: unable to find valid certification path to requested target

To make Java trust those certificate we must manual import that cert into java trust store. In this post i will guide you how to import certificate into trust store. In default Java lookup trust store in $JAVA_HOME/jre/lib/security/cacerts. So you must import certificate that you need to trust to that keystrore using keytool utility that ship with Java using below syntax

#move currency directory to $JAVA_HOME/jre/lib/security/cacerts
# default password of cacerts file is changeit
# in linux maybe you should not use -storepass option and enter direct on console
keytool -import -alias ca -file path_and_cert_name.cer -keystore cacerts –storepass changeit


how to get certificate from a https site

When integration with third party using HttpsURLConnection in java you usually get following issue if your third party use self signed certificate: PKIX path building unable to find valid certification path to requested target

This issue happen cause java cannot verify that certificate and you must import it manual to trust store so java can trust site. But how you can get that certificate? In this post i will guide you how to get certificate from a https site. Continue reading how to get certificate from a https site

Lock wait timeout exceeded try restarting transaction

When running application using mysql as database with high load you maybe get following exception

Caused by: java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction

This happend cause your application try to lock resource on database but cannot get that before reach to lock wait time configure of your database.
To fix this issue once quick solution before you can tunning your application is increase lock wait time of mysql database.

  • Find mysql configuration file( in linux it usually in /etc/my.cnf, if you use windows read this post to find it)
  • Increase below value if exist or add parameter with approriate value


how to configuration mysql to log slow query

In this tutorial, i will show you how to configure mysql to log mysql slow query. This is a important feature we always use when tuning application using mysql database.

We do following config in file my.cnf (in linux OS you can find it on /etc/my.cnf, if you using windows can check on this post to find this file):


slow_query_log to turn on log slow query
slow_query_log_file to configure file mysql will write log.

Consume Restful service using jersey client 2

Continue series tutorial about jersey, today i will guide you how to build a client to consume restful service usign jersey client 2. In this tutorial i also help you how to logging message request on client side. This client application will consume services provide by server side code on part 1:Build RESTful web service with jersey 2
Continue reading Consume Restful service using jersey client 2