Monday, January 30, 2017

Troubleshooting - When an email is being sent, the following error.

The following error occurred when sending an email with Gmail SMTP from other server.
30 1월 2017;22:10:39.951 [pool-1-thread-2] ERROR o.s.a.i.SimpleAsyncUncaughtExceptionHandler.handleUncaughtException(37) - Unexpected error occurred invoking async method 'public void com.abilists.home.service.impl.HomeServiceImpl.sendEmail(com.abilists.home.bean.para.RequestPara) throws java.lang.Exception'. java.lang.RuntimeException: javax.mail.AuthenticationFailedException: 534-5.7.14 https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbsZ 534-5.7.14 xuLCEFlPwh4BIsuGE0dCKxtaRghuM_aV5ghEeqeN27jyYUG1fXnGzT9HFrAnPpQeypwXKh 534-5.7.14 OwvJp_fSk9Ram3RyxvR1lq3_sHDGn4myTJR_qRGNkcOkzpUvM9mcSoXCT6U1lmUgDNgFp2
Just click the URL on your account.
https://accounts.google.com/DisplayUnlockCaptcha

Sunday, January 29, 2017

H2 - How to make user function

I've made user function for H2.
But It didn't work as blow.
29 Jan 2017;05:25:30.778 [1719132627@qtp-715211920-0] ERROR c.a.c.c.AbstractBaseController.handleException(289) - Exception's trace:
org.springframework.jdbc.UncategorizedSQLException:
### Error updating database. Cause: org.h2.jdbc.JdbcSQLException: Function "LAST_INSERT_ID_MAX" not found; SQL statement:
UPDATE
abilists_sequence
SET
id=LAST_INSERT_ID_MAX(id+1)
WHERE
seq_name = ? [90022-191]

What cause the error is public in java.
This is the error code.
CREATE ALIAS LAST_INSERT_ID_MAX AS '

@CODE
public int lastInsertIdMax(int id) throws Exception {
return id;
}
';

What cause the error is public in java.
This is the solved code.
CREATE ALIAS LAST_INSERT_ID_MAX AS '

@CODE
int lastInsertIdMax(int id) throws Exception {
return id;
}
';

Wednesday, November 9, 2016

VirtualBox - Have to do the following after cloning machine

Make a new MAC address

Make a new UUID for network
$ uuidgen eth0

If there is the error as below.

Remove the 70-persistent-net.rules file.
$ rm /etc/udev/rules.d/70-persistent-net.rules


Check the configure file of VirtualBox
vim /home/njoonk/.config/VirtualBox/VirtualBox.xml

Sunday, October 2, 2016

Troubleshooting - Content type 'application/json;charset=UTF-8' not supported

■ There was no problem when testing on Gradle JettyRun.
But After deployed an application, The following error appeared in the log file.

02 Oct 2016;02:05:58.666 [http-nio-8080-exec-6] ERROR c.a.c.AbstractBaseController.handleException(167) - Exception's trace:
org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/json;charset=UTF-8' not supported

    at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:235) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:149) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:127) ~[spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) ~[spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE]
    at
 ...
 ...

■ How to solve this problem.
Add the jar module into build.gradle as below.

dependencies {
...
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.3'
...
}

Wednesday, September 28, 2016

Iptables - Mapping port directly (http or https)

■ Add the following rules.
For mapping a port from 80(HTTP) to 8080 and from 443(HTTPS) to 8443
*nat
-A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
-A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
COMMIT
You don't need to set up Apache HTTP for HTTP or HTTPS
But it will not work as it is, in addition, you have to do the next step

■ Have to open 8080 and 8443 port as below
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT

■ This is full set up in iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
*nat
-A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
-A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
COMMIT