And Todays’s Quote Would Be..

Life begins at the end of your comfort zone.

Neale Donald Walsch

[Netbeans] Error NoClassDefFoundError when Building Java Project using Maven

I got this error when trying to build my maven project on Netbeans,

java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils

Here is my complete stacktrace,

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
	at org.apache.maven.wagon.providers.file.FileWagon.resolveDestinationPath(
	at org.apache.maven.wagon.providers.file.FileWagon.resourceExists(
	at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$
	at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(
	... 7 more

Looks like it happen because my maven doesnt have a StringUtils class, from apache-commons-lang library. Adding commons-lang-2.6.jar to my Netbeans maven folder (E:\Program\NetBeans 8.2\java\maven\lib\ext) solves this issue.


Error “Expecting: TRUSTED CERTIFICATE” when Deploying .cer Certificate on Nginx

Got this very weird error when adding .key and .cer on my nginx SSL, “140387178489504:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE”. It’s very weird because it works well previously.

At first i tought it was because i need to convert .cer to .crt, but even i cannot convert my .cer file using openssl. So i come to a conclusion that somehow there was an issue on my .cer file. First my .cer file looks fine when im opening it using vi


But when im open it using vi -b (vi -b /home/certificate/my.cer), it shows some weird symbols.

<ff><fe>-^@-^@-^@-^@-^@B^@E^@G^@I^@N^@ ^@C^@E^@R^@T^@I^@F^@I^@C^@A^@T^@E^@-^@-^@-^@-^@-^@^M^@

Somehow it happens because im transferring my .cer file between my windows desktop to my linux server environment. Using dos2unix command from my windows environment solve this issue,

C:\Users\edw>dos2unix C:\my.cer
dos2unix: converting UTF-16LE file C:\Users\edw\Downloads\selfcare.cer to ANSI_X
3.4-1968 Unix format...

i have dos2unix on my windows environment from cygwin installment.


Fixing MySql’s Error, “Cant create test file /folder/data/servername.lower-test” on RedHat OS

Had a very weird error starting my MySql after im moving MySql’s data folder from /var/lib/mysql to /folder/data on my RHEL 7 Server,

2017-03-23 11:50:52 2119 [Warning] Can't create test file /folder/data/servername.lower-test
2017-03-23 11:50:52 2119 [Warning] Can't create test file /folder/data/servername.lower-test
2017-03-23 11:50:52 2119 [ERROR] /usr/sbin/mysqld: Can't create/write to file 
    '/folder/data/servername.lower-test' (Errcode: 13 - Permission denied)

very very weird because im already change the ownership of my /folder data to mysql user, and still not working. I even chmod it to 777 for testing purpose, yet still no positive result. After a while i found out that my SELinux is blocking it, here is the command to unblock it.

[root@servername ~]# setenforce 0
[root@servername ~]# getenforce

but the commands above only configure your SELinux until reboot. If you want to make it permanent, you could use this command,

[root@servername ~]# vi /etc/selinux/config 
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

Hope it helps others, cheers


How to Find Root Cause of Error 400 on SpringMVC using Log4J

Error 400 is basically telling us that our request is syntactically incorrect. But it will need a while to found out which parameter is incorrect, especially when you are submitting a lot of parameters.

But do not worry, on SpringMVC we can always log which parameters causing error 400 using Log4J. Adding these values on your will display the error location.

And we can see the root cause on our log file,

2017-02-28 22:33:07,241 [DefaultHandlerExceptionResolver] DEBUG - Resolving exception from handler [public java.util.Map xxx.yyy.controller.ZZZController.saveZZZ(xxx.yyy.bean.DDDD,org.springframework.web.multipart.MultipartFile,org.springframework.web.multipart.MultipartFile,javax.servlet.http.HttpSession)]: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'DDDD' on field 'rupiah': rejected value [100.000.000,000000]; codes [typeMismatch.DDDD.rupiah,typeMismatch.rupiah,,typeMismatch]; arguments [ codes [DDDD.rupiah,rupiah]; arguments []; default message [rupiah]]; default message [Failed to convert property value of type 1 to required type 1 for property 'rupiah'; nested exception is java.lang.NumberFormatException]

As you can see, it happens because i expect a BigDecimal on my bean, but i send a String instead.


[nginx] Replacing HTTP 302 Location URL from HTTP to HTTPS

Had this weird problem today, i can login to my web if i access it directly, but unable to do it if my website is on an iframe of another web. I found out that it happen because im using SSL on both of my website (on the iframe) and the iframe parent’s website.

It actually happen because when im successfully login on my iframed-website, it will gives http 302 (Moved Temporarily) to my dashboard page. But somehow the 302 location is not an HTTPS page, it will gives a regular HTTP pages instead. Which is not a problem when im accessing my web directly, but will gives problem when accessed using an iframe website.

The solution is quite simple, using nginx “proxy_redirect” will change my 302 page from HTTP into HTTPS.

proxy_redirect http:// https://;

Hope it helps :)