티스토리 툴바

10:31:18,623 WARNING [Injector] duplicate class definition bug occured? Please report this : com/vo/RequestHeader$JaxbAccessorM_getComHeaderValues_setComHeaderValues_[Ljava_lang_String;
java.lang.ClassFormatError: Illegal class name "com/vo/RequestHeader$JaxbAccessorM_getComHeaderValues_setComHeaderValues_[Ljava_lang_String;" in class file com/vo/RequestHeader$JaxbAccessorM_getComHeaderValues_setComHeaderValues_[Ljava_lang_String;
    at java.lang.ClassLoader.defineClass1(Native Method)

여러 업무 파트 중에 특정 업무 파트만 오류를 발생하고 있어서
반나절 정도 고생 후 찾아 낸 원인은... JAXB 버그 - -;;
해당 파트가 SOAP CLIENT 를 만들기 위해 CXF 라이브러리를 쓴게 있는데
거기 JAXB 버전이 2.2.1
원래 서버에 있는 버전은 2.1.1
버그 픽스 된 버전은 2.2.2
 
- -;; 음... 찾은게 용타 http://java.net/jira/browse/JAX_WS-870
저작자 표시 비영리 동일 조건 변경 허락


dbunit 으로 테이블에 데이터 export / import

package com.radius.common.dao.card;

import static org.junit.Assert.assertTrue;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

import javax.sql.DataSource;

import org.dbunit.DatabaseUnitException;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.csv.CsvDataSetWriter;
import org.dbunit.dataset.excel.XlsDataSet;
import org.dbunit.dataset.xml.XmlDataSet;
import org.dbunit.ext.mssql.MsSqlDataTypeFactory;
import org.dbunit.operation.DatabaseOperation;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

/**
 * The Class DbInitTest.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:resources/spring-dao.xml" })
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
@Transactional
public class DbInitTest {

    /** The data source. */
    @Autowired
    @Qualifier("dataSource")
    private DataSource dataSource;

    /**
     * Pre load.
     */
    @BeforeClass
    static public void preLoad() {
    }

    /**
     * Gets the connection.
     *
     * @return the connection
     * @throws Exception the exception
     */
    private IDatabaseConnection getConnection() throws Exception {
        // get connection
        Connection con = dataSource.getConnection();
        DatabaseMetaData databaseMetaData = con.getMetaData();
        // oracle schema name is the user name
        IDatabaseConnection connection = new DatabaseConnection(con);
        // IDatabaseConnection connection = new
        // DatabaseConnection(con,databaseMetaData.getUserName().toLowerCase());
        // IDatabaseConnection connection = new
        // DatabaseConnection(con,databaseMetaData.getUserName().toUpperCase(),true);
        DatabaseConfig config = connection.getConfig();
        // oracle 10g
       
        // ms sql
        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
                new MsSqlDataTypeFactory());
        // receycle bin
        // config.setFeature(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES,
        // Boolean.TRUE);
        return connection;
    }

    /**
     * Export xls.
     *
     * @throws Exception the exception
     */
    @Test
    public void exportXls() throws Exception {
        String[] strs = { "person", "test_data"};
        this.exportXlsFrom(strs);
        assertTrue(new File("c://test/card.xls").exists());
    }

    /**
     * Export xls from.
     *
     * @param tableNames the table names
     * @throws Exception the exception
     */
    private void exportXlsFrom(String... tableNames) throws Exception {
        IDataSet dataSet = getConnection().createDataSet(tableNames);
        CsvDataSetWriter.write(dataSet, new File("c://test"));
        XmlDataSet.write(dataSet, new FileOutputStream(new File("c://test/test.xml")));
        XlsDataSet.write(dataSet, new FileOutputStream(new File("c://test/test.xls")));
    }

    /**
     * Import xls from.
     *
     * @throws DatabaseUnitException the database unit exception
     * @throws SQLException the sQL exception
     * @throws Exception the exception
     */
    public void importXlsFrom() throws DatabaseUnitException, SQLException,
            Exception {
        // 테스트데이터 입력
        IDataSet dataSet = new XlsDataSet(new FileInputStream("c://test/test.xls"));
        DatabaseOperation.CLEAN_INSERT.execute(getConnection(), dataSet);
    }

    /**
     * Test.
     */
    @Test
    public void test() {
        assertTrue(true);
    }

}

백기선 님의 블로그를 참고해서 테스트 코드 작성 했습니다.
저작자 표시 비영리 동일 조건 변경 허락

SPRING scheduler 중복 실행 문제

Posted 2011/01/25 16:30

Spring 에서 quartz스케쥴러를 사용하다가
같은 task 가 중복 실행되는 문제로...
한참을 웹서핑을 했다.

같은 증상을 원인까지 잘 정리된 블로그 발견..

http://blog.ajkuhn.com/116

해당 블로그의 2번째 원인이었음..

아그 내가 설정을 잘못했는데 누구탓을 하나 쩝.
저작자 표시 비영리 동일 조건 변경 허락

MS SQL 에는 DUAL 이 없다.

Posted 2011/01/24 20:16

MS SQL 에서  ORACLE의 DUAL 을 대신할 테이블을 한 참 찾았는데
결론은
MS SQL 에서는 아예 FROM 절을 쓰지 않는데 였다. 
헉...

INSERT INTO table SELECT #{key}, #{keyName}, #{keyType}, #{createdDate}
        WHERE NOT EXISTS (SELECT * FROM table WHERE key = #{key})




저작자 표시 비영리 동일 조건 변경 허락

spring3 task namespace

Posted 2011/01/24 19:51
spring framework을 쓴지 어언 몇년인데 아직도
네임스페이스를 못잡아서 헤메냐 - -;;

* namespace 설정
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/task
        http://www.springframework.org/schema/task/spring-task-3.0.xsd">


* tag 설정 예제
<task:scheduler id="myScheduler"/>
<task:scheduled-tasks scheduler="myScheduler">
   <task:scheduled ref="pushService" method="excute" fixed-delay="5000"/>
</task:scheduled-tasks>
<bean id="pushService" class="com.PushService" autowire="byName"/>

저작자 표시 비영리 동일 조건 변경 허락

MS SQL SERVER PAGING SAMPLE

Posted 2010/12/24 12:33
MS SQL 에서 페이징 처리 SQL 코드를 짜려고..

검색을 좀 했더니...

select top (@pageSize)

            execDate, paymentID

    from tblPayment


    where paymentID not in (

                            select top ((@page - 1) * @pageSize) paymentID

                            from tblPayment

                                ORDER BY paymentID desc

                            )

    ORDER BY paymentID desc



이런 방식이 주로 검색되었다.

그러서 작업을 했는데 mybatis 에서 top 뒤에 @pageSize 를 파라메타로 받지 못하는 거 아닌가
- -;;;

고민 끝에 검색해서...

select Row_Number() OVER (ORDER BY paymentID desc) AS rowNum,

            execDate, paymentID

        from

            tblPayment



이런 방식으로 교체

 잘된다.


참고..

http://polomin.tistory.com/entry/MS-SQL-20002005-%ED%8E%98%EC%9D%B4%EC%A7%95-%EA%B8%B0%EB%B2%95

http://www.decipherinfosys.com/PDFgallery.htm




저작자 표시 비영리 동일 조건 변경 허락

code naming style

Posted 2010/12/20 11:05

    * camel-case
    * upper-camel-case
    * hyphenated
    * dotted
    * underscored

Axis2 사용시 주의

Posted 2010/11/08 11:28
Axis2 를 사용할 일이 있어서 이것 저것 테스트 중인데
생각보다 빠릇 빠릇 되지는 않는 것 같다.. 뭐든 그렇듯이


1. eclipse 에서 axis2 로 서버 만들기

이클립스 갈릴레오에 맞는 axis2 버전이 1.4.1 이란다.
괜히 최신 버전을 깔았다가 생성하고 실행시 에러가 나는 문제가 ㅋ

암튼 1.4.1 버전으로 설치하면 별문제없어 잘 생성된다.


2. axis2 로 client 만들기

wsdl2java 방식으로 client 생성시
ADB 바인딩 방식으로 생성시 AnyType 을 맵핑 못한다는 오류 발생??
몰까 쩝..

그래서
xmlbeans 바인딩 방식으로 생성하여 생성 성공
런타입시 클래스를 못찾는 오류 발생 ..
생성된 소스 중에 TypeSystemHolder.class 이라는 클래스가 있는데
(소스 생성인데 클래스를 생성하는건 몬가 ㅋ )
이클립스에서 소스와 바이너리 위치가 달라서 생기는 문제임
바이너리 폴더로 이동후 문제 해결

jibx 방식은 아직 테스트 안해봤음

WIN XP 에 MSSQL 설치하기

Posted 2010/05/10 10:33
노트북에 MS SQL SERVER 를 설치하여 테스트 할일 이 있어서 찾아보았더니..

MS SQL SERVER 2008 EXPRESS 라는 무료 설치 버전이 있었다.

무언가 잔뜩 설치를 요구해서 이리저리 찾아보다가
잘 정리된 글이 있어서 참고해서 무사히 설치


http://fellen.pe.kr/4159221

ps1>
아 ms xml parser 에러가 나면 ms xml parser 6 을 설치 제거한 후 진행할 것.

아마 ms sql 에서 요구하는 버전보다 높에서 문제인듯.

ps2>
jdbc에서 연결이 안되는 문제가 있어서 헤메었는데
옆에 친구(?)가
Sql Server Configuration Manager 에서
프로토콜 세션에서
명명된 파이프/ TCP/IP 를 사용 가능 으로 하고
포트도 1433 으로 셋팅 해주면 잘 되네요.





저작자 표시 비영리
jautodoc homepage
http://jautodoc.sourceforge.net/

eclipse plugin 설치
http://jautodoc.sourceforge.net/update/

eclipse 에 내장된 javadoc 기능도 그렇게 나쁘지 않으나..
jautodoc에는 강력한 templates 기능이 내장되어 있고
기본적으로 java naming rule 에 의한 javadoc을 생성한다.