[Android]TextView Outline text

public class IATOutLineTextView extends AppCompatTextView {
public IATOutLineTextView(Context context) {
this(context, null);
}

public IATOutLineTextView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}

public IATOutLineTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}

@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);

int textColor = this.getCurrentTextColor();

TextPaint paint = this.getPaint();
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeJoin(Paint.Join.MITER);
paint.setStrokeMiter(10);
this.setTextColor(Color.parseColor("#ff0000"));
paint.setStrokeWidth(10);
super.onDraw(canvas);
paint.setStyle(Paint.Style.FILL);
paint.setStrokeWidth(0);
this.setTextColor(textColor);
super.onDraw(canvas);
}
}

Posted by incree

2018/04/21 07:16 2018/04/21 07:16
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/392

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

[잡다] 소코반(창고지기) 풀이

SokobanTouch Alphabets(6 trials) - No.03

사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지
사용자 삽입 이미지














Posted by incree

2018/04/15 04:59 2018/04/15 04:59
,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/391

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

MySQL Troubleshooting(MySQL 문제 해결 가이드) - P.152


트랜잭션이 기다리는 모든 락에 대한 정보 :
 SELECT * FROM INNODB_LOCK_WAITS

블럭된 트랜잭션의 목록 :
SELECT * FROM INNODB_LOCKS WHERE LOCK_TRX_ID IN (SELECT BLOCKING_TRX_ID FROM INNODB_LOCK_WAITS)

또는
SELECT INNODB_LOCKS.* FROM INNODB_LOCKS JOIN INNODB_LOCK_WAITS ON (INNODB_LOCKS.LOCK_TRX_ID=INNODB_LOCK_WAITS.BLOCKING_TRX_ID)

특정 테이블에 대한 락의 목록 :
SELECT * FROM INNODB_LOCKS WHERE LOCK_TABLE='<데이터베이스_이름>.<테이블_이름>'

락을 기다리는 모든 트랜잭션의 목록 :
SELECT TRX_ID, TRX_REQUESTED_LOCK_ID, TRX_MYSQL_THREAD_ID,TRX_QUERY FROM INNODB_TRX WHERE TRX_STATE='LOCK WAIT'

Posted by incree

2018/04/08 01:13 2018/04/08 01:13
,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/390

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다



MPAndroidChart custom BarchartRenderer Example

차트에 배경 이미지 넣기
막대에 그라데이션 적용

package com.incree.mpandroidchart.custom.barchartrenderer.example;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.WindowManager;
import android.widget.SeekBar;
import android.widget.TextView;

import com.github.mikephil.charting.animation.ChartAnimator;
import com.github.mikephil.charting.buffer.BarBuffer;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.formatter.IAxisValueFormatter;
import com.github.mikephil.charting.interfaces.dataprovider.BarDataProvider;
import com.github.mikephil.charting.interfaces.datasets.IBarDataSet;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.renderer.BarChartRenderer;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.Transformer;
import com.github.mikephil.charting.utils.Utils;
import com.github.mikephil.charting.utils.ViewPortHandler;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {
protected BarChart mChart;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);

mChart = (BarChart) findViewById(R.id.chart1);

mChart.setDrawBarShadow(false);
mChart.setDrawValueAboveBar(true);

mChart.getDescription().setEnabled(false);

setData();

mChart.setRenderer(new MyBarChartRenderer(mChart, mChart.getAnimator(), mChart.getViewPortHandler()));
}

private void setData() {

float start = 1f;

ArrayList<BarEntry> yVals1 = new ArrayList<BarEntry>();

for (int i = 0; i < 12; i++) {
float mult = (500 + 1);
float val = (float) (Math.random() * mult);

yVals1.add(new BarEntry(i, val));
}

BarDataSet set1;

if (mChart.getData() != null &&
mChart.getData().getDataSetCount() > 0) {
set1 = (BarDataSet) mChart.getData().getDataSetByIndex(0);
set1.setValues(yVals1);
mChart.getData().notifyDataChanged();
mChart.notifyDataSetChanged();
} else {
set1 = new BarDataSet(yVals1, "The year 2017");

set1.setDrawIcons(false);

set1.setColors(ColorTemplate.MATERIAL_COLORS);

ArrayList<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();
dataSets.add(set1);

BarData data = new BarData(dataSets);
data.setValueTextSize(10f);
data.setBarWidth(0.9f);

mChart.setData(data);
}
}

class MyBarChartRenderer extends BarChartRenderer {
public MyBarChartRenderer(BarDataProvider chart, ChartAnimator animator,
ViewPortHandler viewPortHandler) {
super(chart, animator, viewPortHandler);

initBuffers();
}

@Override
public void drawData(Canvas c) {
Drawable d = getResources().getDrawable(R.drawable.zzang);
d.setBounds(0, 0, c.getWidth(), c.getHeight());
d.draw(c);

super.drawData(c);
}

private RectF mBarShadowRectBuffer = new RectF();

@Override
protected void drawDataSet(Canvas c, IBarDataSet dataSet, int index) {
Transformer trans = mChart.getTransformer(dataSet.getAxisDependency());

mBarBorderPaint.setColor(dataSet.getBarBorderColor());
mBarBorderPaint.setStrokeWidth(Utils.convertDpToPixel(dataSet.getBarBorderWidth()));

final boolean drawBorder = dataSet.getBarBorderWidth() > 0.f;

float phaseX = mAnimator.getPhaseX();
float phaseY = mAnimator.getPhaseY();

// draw the bar shadow before the values
if (mChart.isDrawBarShadowEnabled()) {
mShadowPaint.setColor(dataSet.getBarShadowColor());

BarData barData = mChart.getBarData();

final float barWidth = barData.getBarWidth();
final float barWidthHalf = barWidth / 2.0f;
float x;

for (int i = 0, count = Math.min((int)(Math.ceil((float)(dataSet.getEntryCount()) * phaseX)), dataSet.getEntryCount());
i < count;
i++) {

BarEntry e = dataSet.getEntryForIndex(i);

x = e.getX();

mBarShadowRectBuffer.left = x - barWidthHalf;
mBarShadowRectBuffer.right = x + barWidthHalf;

trans.rectValueToPixel(mBarShadowRectBuffer);

if (!mViewPortHandler.isInBoundsLeft(mBarShadowRectBuffer.right))
continue;

if (!mViewPortHandler.isInBoundsRight(mBarShadowRectBuffer.left))
break;

mBarShadowRectBuffer.top = mViewPortHandler.contentTop();
mBarShadowRectBuffer.bottom = mViewPortHandler.contentBottom();

c.drawRect(mBarShadowRectBuffer, mShadowPaint);
}
}

// initialize the buffer
BarBuffer buffer = mBarBuffers[index];
buffer.setPhases(phaseX, phaseY);
buffer.setDataSet(index);
buffer.setInverted(mChart.isInverted(dataSet.getAxisDependency()));
buffer.setBarWidth(mChart.getBarData().getBarWidth());

buffer.feed(dataSet);

trans.pointValuesToPixel(buffer.buffer);

final boolean isSingleColor = dataSet.getColors().size() == 1;

if (isSingleColor) {
mRenderPaint.setColor(dataSet.getColor());
}

for (int j = 0; j < buffer.size(); j += 4) {

if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[j + 2]))
continue;

if (!mViewPortHandler.isInBoundsRight(buffer.buffer[j]))
break;

if (!isSingleColor) {
// Set the color for the currently drawn value. If the index
// is out of bounds, reuse colors.
mRenderPaint.setColor(dataSet.getColor(j / 4));
}

c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
buffer.buffer[j + 3], mRenderPaint);

if (drawBorder) {
c.drawRect(buffer.buffer[j], buffer.buffer[j + 1], buffer.buffer[j + 2],
buffer.buffer[j + 3], mBarBorderPaint);
}

Drawable d = getResources().getDrawable(R.drawable.fade_red);
d.setBounds((int)buffer.buffer[j], (int)buffer.buffer[j + 1], (int)buffer.buffer[j + 2],
(int)buffer.buffer[j + 3]);
d.draw(c);
}
}

@Override
public void drawExtras(Canvas c) {
super.drawExtras(c);
/*
Paint p = new Paint();
p.setAlpha(90);

Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.zzang);
c.drawBitmap(image, 0, 0, p);
*/
}
}
}

https://github.com/PhilJay/MPAndroidChart


https://github.com/incree/MPAndroidChart-custom-BarChartRenderer-example












Posted by incree

2018/04/07 07:14 2018/04/07 07:14
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/389

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

Android gravity, layout_gravity dynamic programmatically

gravity : 자식 뷰를 어떻게 표시 할지
layout_gravity : 부모 뷰에 어떻게 표시할지

동적으로 추가할때 layout_gravity는 LayoutParams에 적용해야 하고
gravity는 View에 적용한다




LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.setGravity(Gravity.CENTER);
    setLayoutParams(params);

    setGravity(Gravity.CENTER);

Posted by incree

2018/03/20 12:01 2018/03/20 12:01
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/388

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다


전자정부프레임워크 프로젝트를 github 연동후 다음과 같은 에러가 나면
org.eclipse.jgit.api.errors.TransportException: Nothing to fetch.
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:253)
at org.eclipse.egit.core.op.PullOperation$1.run(PullOperation.java:97)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.egit.core.op.PullOperation.execute(PullOperation.java:128)
at org.eclipse.egit.ui.internal.pull.PullOperationUI.execute(PullOperationUI.java:139)
at org.eclipse.egit.ui.internal.pull.PullOperationUI$1.runInWorkspace(PullOperationUI.java:114)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.jgit.errors.TransportException: Nothing to fetch.
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1087)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
... 8 more


config 파일 [remote "origin"] 항목에

fetch = +refs/heads/*:refs/remotes/origin/*


를 추가한다.

이클립스에서 모든 프로젝트에 적용되게 하려면

Windows -> Preferences -> Team -> Git -> Configuration - Repository Settings 탭
-> Add Entry
Key : remote.origin.fetch
Value : +refs/heads/*:refs/remotes/origin/*

config 파일 전체 내용
[core]
symlinks = false
repositoryformatversion = 0
filemode = false
logallrefupdates = true
[remote "origin"]
url = git url
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master



Posted by incree

2018/02/11 13:08 2018/02/11 13:08
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/386

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

안드로이드 웹뷰 액티비티를 사용하고 정상적으로 종료하지 않았을때

fabric log


Crash Insights
Heads Up!
Unable to add window -- token is not valid; is your activity running?

Details:
This crash is usually caused by your app trying to display a dialog using a previously-finished Activity as a context. For example, this can happen if an Activity triggers an AsyncTask that tries to display a dialog when it is finished, but the user navigates back from the Activity before the task is completed.

s crash is usually caused by your app trying to display a dialog using a previously-finished Activity as a context. For example, this can happen if an Activity triggers an AsyncTask that tries to display a dialog when it is finished, but the user navigates back from the Activity before the task is completed.
Resources:
1. Android – Displaying Dialogs From Background Threads
2. Error : BinderProxy@45d459c0 is not valid; is your activity running?

Fatal Exception: android.view.WindowManager$BadTokenException
Unable to add window -- token android.os.BinderProxy@d21dce2 is not valid; is your activity running?
 Raw Text
android.view.ViewRootImpl.setView (ViewRootImpl.java:890)
com.android.webview.chromium.Ap.handleJsAlert (WebViewContentsClientAdapter.java:355)
org.chromium.android_webview.AwContentsClientBridge$$Lambda$2.run (Unknown Source:3)
android.os.Handler.handleCallback (Handler.java:751)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
Show all 44 Threads

이와 같은 에러가 나면서 앱이 크래쉬 되는 경우가 있다.

webview activity를 종료한 후 결제등의 화면에서 세션이 종료되는 것을 알리는 alert를 띄워줄때 발생하는 경우가 있다.

activity만 종료했기 때문이고, webview도 distory 해주면 이 에러는 해결된다.

백버튼이나 액티비티 종료 버튼을 눌러서 종료할때

다음과 같이 webview를 distory 한후 activity를 finish 한다.

@Override
public void onBackPressed() {
webView.destroy();
finish();
}


사용자 삽입 이미지



Posted by incree

2018/01/26 23:16 2018/01/26 23:16
,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/385

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

전자정부 3.6.0에 포함된 spring 에서 기본으로 제공하는 엑셀 다운로드는

HSSFWorkbook 을 사용하기 때문에 65536 레코드가 넘어가면 에러가 발생한다.


XSSFWorkbook 형태로 다운로드 받기 위해서는 AbstractView를 직접 구현해 주어야 한다.



1. pom.xml에 poi, poi-ooxml dependency 추가


<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>


2. AbstractView 구현

package com.incree.excel;

import java.util.List;
import java.util.Map;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFDataFormat;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Component;

@Component("listExcelView")
public class ListExcelView extends AbstractView  {
private static final String CONTENT_TYPE = "application/vnd.ms-excel";

public ListExcelView() {
setContentType(CONTENT_TYPE);
}

  /**
   * 스프링 AbstractExcelView 에 있는 함수 편리하게 쓰기 위해 추가
   */
protected XSSFCell getCell(XSSFSheet sheet, int row, int col) {
XSSFRow sheetRow = sheet.getRow(row);
if (sheetRow == null) {
sheetRow = sheet.createRow(row);
}
XSSFCell cell = sheetRow.getCell(col);
if (cell == null) {
cell = sheetRow.createCell(col);
}
return cell;
}

/**
   * 스프링 AbstractExcelView 에 있는 함수 편리하게 쓰기 위해 추가
   */
protected void setText(XSSFCell cell, String text) {
cell.setCellType(CellType.STRING); // 스프링엔 cell.setCellType(HSSFCell.CELL_TYPE_STRING); 로 돼 있지만 deprecated 됐으므로 수정
cell.setCellValue(text);
}

@Override
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
XSSFWorkbook wb = new XSSFWorkbook();
        XSSFSheet sheet = (XSSFSheet) wb.createSheet("쉬트이름");

        XSSFCell cell = null;

        XSSFDataFormat format = wb.createDataFormat();
        XSSFCellStyle style = wb.createCellStyle();
    style.setDataFormat(format.getFormat("#,###"));

int cellStartIndex = 2;

// set header information
setText(getCell(sheet, 1, 0), "셀내용");
setText(getCell(sheet, 2, 1), "셀내용2");
setText(getCell(sheet, 3, 2), "셀내용3");

               // List resultList =  (List) model.get("resultList");

..............
..............
..............


ServletOutputStream out = response.getOutputStream();
wb.write(out);

        if (out != null) out.close();
        if (wb != null) wb.close();
}
}

3. controller 구현

package com.incree.excel;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ListController {
@RequestMapping("/listExcelDownload.do")
public ModelAndView listExcelDownload(Model model, HttpServletResponse response) throws Exception{
// List resultList = getList();

// Map<String, Object> map = new HashMap<String, Object>();
// map.put("resultList", resultList);

response.setHeader("Content-Disposition", "attachment; fileName=\"list_excel.xlsx\";");
response.setHeader("Content-Transfer-Encoding", "binary");

return new ModelAndView("listExcelView", map);
}

}

Posted by incree

2017/12/19 14:51 2017/12/19 14:51
, ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/384

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

iOS 11 UITableView reloadData 오작동

iOS 11에서 머가 바뀐건지 잘 작동하던 UITableView가 이상하게 작동하는 증상이 발생했다

reloadData를 호출했는데 cell들이 storyboard에 있는 형태로 초기화 돼 버리는 것이다

로그로 찍어보면 cell 내의 view들이 정상값을 가지고 있는데 화면에만 잘못 노출되는 것이다.

머가 바껴서 이 문제가 생긴지는 확인 못했지만,

다음 옵션들을 적용하면 이상 증상은 해결되었다

self.tableView.estimatedRowHeight = 58 // cell 하나 높이
self.tableView.estimatedSectionHeaderHeight = 20 // 없으면 0
self.tableView.estimatedSectionFooterHeight = 20 // 없으면 0

Posted by incree

2017/12/07 10:56 2017/12/07 10:56
, , ,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/383

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다


전자정부프레임워크에는 EgovIdGnrService 라는 id를 생성해 주는 기능이 있다.

가끔 이 기능을 사용할때 다음과 같은 에러가 발생할 수 있다.(mysql)

 [IDGeneration Service] ORDER_ID 테이블을 업데이트하는 예외가 발생했습니다.

다음의 update query 문에서 발생하는 에러이다.

UPDATE COMTECOPSEQ SET next_id = ? WHERE table_name = ?

에러 로그를 보면

egovframework.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl

클래스 223 줄에서 exception이 찍히는데, 에러 내용만 봐서는 어떤 에러인지 알기 힘들다.

전자정부프레임워크 사이트에 이 문제에 대한 답변이 하나 있는데

COMTECOPSEQ table에 lock이 걸려서 발생하는 문제이니 lock을 해결하라고 돼 있다
(https://open.egovframe.go.kr/cop/bbs/selectBoardArticle.do?bbsId=BBSMSTR_000000000013&nttId=18793)


사용자 삽입 이미지

전자정부프레임워크 답변



SELECT ORDER_ID FROM COMTECOPSEQ WHERE = ?

쪽에서 exception이 발생하는 경우는 DataAccessException 을 로깅해 주기 때문에

바로 디비 에러 사항을 확인할 수 있는데,

update에서는 DataAccessException 을 FdlException 로 throw 하기 때문에 디비에서 발생한 에러 내용을 바로 확인할 수 없다.

디버깅 해서 update시 발생한 DataAccessException 로그를 확인해 보면 아래와 같다

org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorizedSQLExceptionfor SQL [UPDATE COMTECOPSEQ SET next_id = ? WHERE table_name = ?]; SQL state [HY000]; error code [1665]; Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.; nested exception isjava.sql.SQLException: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:84)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
      at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:660)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:909)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:970)
      at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:980)
      at egovframework.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl$1.doInTransaction(EgovTableIdGnrServiceImpl.java:218)
      at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
      at egovframework.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl.allocateIdBlock(EgovTableIdGnrServiceImpl.java:160)
      at egovframework.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl.allocateLongIdBlock(EgovTableIdGnrServiceImpl.java:257)
      at egovframework.rte.fdl.idgnr.impl.AbstractDataBlockIdGnrService.getNextLongIdInner(AbstractDataBlockIdGnrService.java:120)
      at egovframework.rte.fdl.idgnr.impl.AbstractIdGnrService.getNextLongIdChecked(AbstractIdGnrService.java:151)
      at egovframework.rte.fdl.idgnr.impl.AbstractIdGnrService.getNextIntegerId(AbstractIdGnrService.java:203)
      at
      at
      at
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
      at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at egovframework.burgerking.api.comm.filter.LogSessionIdFilter.doFilter(LogSessionIdFilter.java:32)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4158)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2615)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2776)
      at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2840)
      at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2082)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2334)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2262)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2246)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
      at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:916)
      at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:909)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:644)
      ... 57 more








에러는 transaction isolation level이 READ_COMMITTED (or READ_UNCOMMITTED)인데 BINLOG_FORMAT 이 statement 이기 때문에 발생하는 오류다.  


egovframework.rte.fdl.idgnr.impl.EgovTableIdGnrServiceImpl  클래스 115줄에 보면

transaction isolation level을 강제로 READ_COMMITTED로 변경하는 코드가 있다.
 
this.transactionTemplate.setIsolationLevelName("ISOLATION_READ_COMMITTED");



이 코드에 있는 transaction isolation level을 변경하거나,

BINLOG를 사용하지 않거나

BINLOG_FORMAT을 mixed로 변경하면  [IDGeneration Service] ORDER_ID 테이블을 업데이트하는 예외가 발생했습니다.


에러는 해결할 수 있다.



P.S
 * 다른 이유로 에러나는 경우도 있을 수 있으나 경험해 보지 못해, 우선 경험하고 해결한 것만 포스팅
 * select 쪽 에러시에는 DataAccessException을 로깅하는데, update에는 왜 로깅하지 않을까?? 이 로깅만 돼 있었어도 고생안하고 바로 알았을텐데....






















Posted by incree

2017/08/22 14:42 2017/08/22 14:42
,
Response
0 Trackbacks , 0 Comments
RSS :
http://www.incree.com/tc/incree/rss/response/382

Trackback URL : 이 글에는 트랙백을 보낼 수 없습니다

« Previous : 1 : 2 : 3 : 4 : 5 : ... 15 : Next »