Mybatis

invalid comparison: java.util.ArrayList and java.lang.String

 

위의 에러 발생의 경우이다.

 

<if test="list !='' and list !=null">
	<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
		#{item.value}
	</foreach>
</if>

list 의 경우는 != '' 와 비교가 안되서 발생하는 에러이다.

 

<if test="list.size != 0">
	<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
		#{item.value}
	</foreach>
</if>

다음과 변경할 경우에 에러가 사라진다.

mysql The table '테이블명' is full 에러 발생시

 

테이블의 사이즈가 부족할때 발생한다.

 

방법1.

my.cnf 에서 max_heap_table_size, tmp_table_size   두가지 항목을 추가한다.

[mysqld]
max_heap_table_size             = 5G
tmp_table_size                  = 5G

 

 

방법2.

mysql -u root -p  로 접속 후에

SHOW VARIABLES LIKE 'max_heap_table_size';
SHOW VARIABLES LIKE 'tmp_table_size';

 값 조회한 후에

set global max_heap_table_size = [설정값];
set global tmp_table_size = [설정값];
set session max_heap_table_size = [설정값];
set session tmp_table_size = [설정값];

적용한다.

 

 

방법1, 방법2의 차이점.

방법1에서 my.cnf 에 반영시에는 재기동시 반영된다.

방법2에서 반영시에는 재기동없이 반영되지만, 재기동시에 기존값으로 초기화된다.

-bash: unzip: command not found 에러 발생 시

 

unzip 이 설치되지 않을때 발생한다.

 

 

unzip 명령어를 실행 한 후에 설치가 되지않음을 확인한다.

[root@test ~]# unzip
-bash: unzip: command not found
[root@test ~]# rpm -qa | grep unzip
[root@test ~]# yum list unzip
---생략---
Is this ok [y/N]: y

설치가 완료 된 후에 unzip 을 사용한다.

-bash: unzip: command not found 에러 발생 시

 

unzip 이 설치되지 않을때 발생한다.

 

 

unzip 명령어를 실행 한 후에 설치가 되지않음을 확인한다.

[root@test ~]# unzip
-bash: unzip: command not found
[root@test ~]# rpm -qa | grep unzip
[root@test ~]# yum list unzip
---생략---
Is this ok [y/N]: y

설치가 완료 된 후에 unzip 을 사용한다.

자바스크립트 Uncaught TypeError: Illegal invocation 에러

 

해당 에러 발생시에는 ajax로 데이터 보낼때 파라미터 값이 정상적으로 들어가지 않은 경우이다.

 

예를들어 

 

var param = {};
param.test01 = $("#test01").val();
param.test02 = $("#test02").val();

 다음과 같이 파라미터를 넣어야되는데,

 

var param = {};
param.test01 = test01;
param.test02 = test02;

 

이 처럼 test01이라는 값을 선언 및 초기화도 없이 넣으면 발생되는 에러이다.

 

mysql

"Lock wait timeout exceeded; try restarting transactionSQL 오류 (1205): Lock wait timeout exceeded; try restarting transaction" 에러 발생시

 

 

mysql DB server에 접속한다.

 

root계정으로 접속 한다.

mysql -u root -p

 

innodb_lock_wait_timout 값을 조회한다.

 

show variables like '%wait_timeout%';

 

innodb_lock_wait_timout 값을 변경한다.

 

set innodb_lock_wait_timeout= 28800;

 

 

Java Map 선언과 동시에 초기화하는 방법

 

public final static Map<String, String> fileMap= new HashMap<String, String>() {
     {
         put("code1","코드1");
         put("code2","코드2");
     }
 };

 

다음과 같이 선언하면 된다. 에러가 아닌 경고가 나올수 있는데 무시해도 무관한 경고이다.

mysql syntax error, unexpected '(', expecting FTS_TERM or FTS_NUMB or '*' 에러 발생시

 

 

mysql 에서 fulltext 검색시에 발생되는 에러이다.

 

https://dev.mysql.com/doc/refman/8.0/en/fulltext-boolean.html

 

MySQL :: MySQL 8.0 Reference Manual :: 12.9.2 Boolean Full-Text Searches

12.9.2 Boolean Full-Text Searches MySQL can perform boolean full-text searches using the IN BOOLEAN MODE modifier. With this modifier, certain characters have special meaning at the beginning or end of words in the search string. In the following query, th

dev.mysql.com

 

우선 mysql8.0 reperence에는 

 

InnoDB full-text search does not support the use of a leading plus sign with wildcard ('+*'), a plus and minus sign combination ('+-'), or leading a plus and minus sign combination ('+-apple'). These invalid queries return a syntax error.

 

라고 나와있다.

 

full-text 검색시에 wild card 는 * 이고, ('+-') 의 문자와 함께 사용하지 못한다고 나와있다.

 

 

Java 동적 클래스 생성 및 호출 (reflection)

 

자바 리플렉션을 쉽게 말하자면 자바에서 구체적인 클래스를 알지 못해도 해당 클래스를 호출하고, 메소드, 변수 등에 접근 가능할 수 있도록 해주는 기능입니다.

 

사용하는 방법은 아래와 같습니다.

String className = "패키지명.클래스명";
Class<?> cls = Class.forName(className); // 다음과 같이하면 클래스를 로딩
Object obj = cls.newInstance(); // 해당 클래스 인스턴스 생성
Method method = cls.getMethod("메소드명", String.class); // 메소드 로딩( 메소드의 인자값이 String 하나가 들어가 있다)
String result = method.method.invoke(obj, "야호");// 메소드 인자값인 String 하나를 "야호"라고 넣는다.

다음과 같이하면 해당클래스의 메소드를 호출해서 result 에 값이 들어간다.

 

"패키지명.클래스명"과 "메소드명"은 실제로 있어야지 호출이 가능하다.

스프링에서 톰캣 구동시에

org.springframework.web.context.ContextLoaderListener

 

위와 같은 에러 발생시 해결방법입니다.

 

프로젝트 우클릭 -> properties -> Deployment Assembly 선택 -> Add 선택 -> Java Build Path Entries -> Maven Dependencies 선택 -> Apply 선택

 

위 단계를 마친 후에 톰캣 재가동을 하면 된다.

+ Recent posts