블로그 이미지
올해목표 // 10월 어학연수 떠나자~ 자수씨

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
Spring (31)
JAVA (176)
JavaScript (59)
WEB (49)
Database (20)
OS (26)
Tools (8)
Tips (26)
IT정보 (1)
Book (21)
Programming (37)
외부행사 (43)
주변인들 (17)
여행노트 (60)
학교생활 (30)
회사생활 (52)
사회생활 (5)
외국어공부 (12)
잡동사니 (30)
Total
Today
Yesterday
 
05-06 13:11
 

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
 

최근에 올라온 글

최근에 달린 댓글

아래와 같이 JDBCMailbox 는 Mailbox<String> 을 구현한 클래스입니다.

 

 

다른 mailbox 도 고려하기 위해 List<Mailbox<String>>로 리턴형식을 잡고 List<JDBCMailbox> 를 리턴했더니 캐스트 오류가 발생합니다.

 

JDBCMailbox 는 Mailbox<String> 으로 캐스팅이 가능한데 말입니다...

 

그래서 아래와 같은 작업을 해야 한다는...

 

 

무슨 이유가 있겠죠???

 

 

Posted by 자수씨
, |


James 3 에서 제공하는 mailbox 는 jpa, jcr, maildir, hbase, memory 입니다.


기존에 사용하던 메일 시스템의 DB, Filesystem 과 연동을 위해서는 커스터마이징이 필수적입니다.


org.apache.james.container.spring.bean.factorypostprocessor.MailboxConfigurationBeanFactoryPostProcessor 

위의 클래스에서 jdbc 용 provider 를 확장하는게 첫 시작점이 될 것 같습니다.

 

각 provider 별 spring.xml 은 아래 xml 에 import 시켜서 사용합니다.

/apache-james-mailbox/spring/src/main/resources/META-INF/org/apache/james/spring-mailbox.xml

 

 

Posted by 자수씨
, |

어제 로컬에서 띄운 것을 확인하고 오늘와서 띄워보니 아래와 같은 오류가...

 

Caused by: <openjpa-2.2.1-r422266:1396819 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a
javaagent: "
org.apache.james.domainlist.jpa.model.JPADomain
org.apache.james.user.jpa.model.JPAUser
org.apache.james.rrt.jpa.model.JPARecipientRewrite".

 

구글링을 해보니 아래와 같은 해결책을 찾을 수 있었다.

http://djitz.com/neu-mscs/getting-started-using-apache-openjpa/

...

4. Run the Main class (right click the Main.java > Run As > Java Application).
 
If you followed everything correctly, you will see that OpenJPA creates the Patient table automatically. However, it will throw an Exception afterwards, and it goes like:
 
Exception in thread "main" <openjpa-2.0.1-r422266:989424 nonfatal user error> org.apache.openjpa.persistence.ArgumentException: This configuration disallows runtime optimization, but the following listed types were not enhanced at build time or at class load time with a javaagent: "com.djitz.model.Patient".
 
This happens because the OpenJPA fails to run enhanced the entity file (Patient.java) we created. What the OpenJPA (and also Hibernate) does is putting some more code in our Patient class after it is compiled. These code lines enable the OpenJPA to do some “magic”.
 
Now we need to add some lines on the run configuration to apply this enhancement.

F. Add run configuration for Enhancement
 
1. Right click the Main class > Run As > Run configurations
 2. Open the “Arguments” tab
 3. Paste the following in the VM arguments box:
 
-javaagent:[path-to-extraced-openjpa-zip-file]/openjpa-2.0.1.jar
 
4. Re-run the Main.java, there should be no error by now.

...

 

검색한대로 Java VM 에 아래의 파라미터를 추가하니 정상 동작합니다. (경로는 제 개발환경 기준...)

-javaagent:C:\Users\Administrator\.m2\repository\org\apache\openjpa\openjpa\2.2.1\openjpa-2.2.1.jar

 

 

 

 

Posted by 자수씨
, |


James-3.0은 설치해서 테스트는 해봤지만 실제로 주고받는 메시지들을 확인하고 싶어서 개발 환경에 소스를 내려받았습니다.


SVN: http://svn.apache.org/repos/asf/james/server/trunk



2012/11/13 - [JAVA/James] - [James 3] 3.0-beta4 에서 Main 클래스는 어디로...

지난 번에 포스팅했던 적이 있었는데 beta-4에서는 실행시킬 수 있는 클래스가 사라졌습니다. trunk를 체크아웃 받으니 app 프로젝트가 있습니다. (2013.01.08 기준)


"org.apache.james.app.spring.JamesAppSpringMain" 클래스를 실행시키니 ClassNotFoundException 이 후두둑 떨어집니다.


Caused by: java.lang.ClassNotFoundException: org.apache.james.transport.matchers.All

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source

...



검색을 해보니 현재 matcher 와 mailet 쪽을 작업 옮기는 작업 중인지 문제가...

(http://comments.gmane.org/gmane.comp.jakarta.james.user/19155)


MatcherLoader 와 MailetLoader 는 하나인데, matcher, mailet 패키지가 분산되어 발생한 문제인 것 같았습니다.


결국 해결책은 꼼수...




아직 이관되지 않은 matcher 와 mailet 을 org.apache.james.transport.matchers 쪽에 상속 받도록 해놨습니다.

package org.apache.james.transport.matchers;


public class All extends org.apache.james.mailet.standard.matchers.All {


}


10개의 클래스를 꼼수로 만드니 구동됩니다.


이제 다음 스텝으로... 두둥...





Posted by 자수씨
, |

http://mail-archives.apache.org/mod_mbox/james-server-user/201106.mbox/%3C4DFBC41D.9060107@gmx.de%3E


위의 내용을 참고하여 이클립스에 James를 띄우는 것은 성공...




security 쪽이 문제가 되서 "-Djava.security.manager" 옵션을 빼니깐 바로 되는군...


이제부터 IMAP 시작!!





Posted by 자수씨
, |

http://james.apache.org/server/3/dev-build.html 여기엔 분명히 "james-server-spring-deployment" 프로젝트 밑에 Main.java 를 통해 실행할 수 있게 되어 있는데... 3.0-beta4 에서는 해당 클래스가 보이질 않는다.

 

 

 2011년 10월 20일에 app 프로젝트로 이관되었 것을 히스토리를 통해 확인하였다.

 

 

음 근데... app 프로젝트는 아직 3.0-beta3까지 밖에 태깅이 안되어 있는데... 걍 trunk 쪽으로 작업을 해야 하나... 흐흠...

 

 

 

 

Posted by 자수씨
, |

Recently came across this the existance of the -DskipTests argument while running maven.

From the userguide:

You can also skip the tests via command line by executing the following command:

mvn install -DskipTests

If you absolutely must, you can also use the maven.test.skip property to skip compiling the tests. maven.test.skip is honored by Surefire, Failsafe and the Compiler Plugin.

mvn install -Dmaven.test.skip=true

Skiptests is a feature of surefire, while -Dmaven.test.skip is a feature of maven itself.


일단 스크랩... 나중에 정리해야지...


참고자료

http://www.inze.be/andries/2011/05/11/maven-difference-between-dskiptests-and-dmaven-test-skiptrue/


Posted by 자수씨
, |

Uber JAR???

JAVA / 2012. 7. 23. 09:54



Maven 쪽 뭔가를 찾다보니 uber-jar 라는 생소한 단어가 튀어나왔다.


google 을 뒤저보아도 명쾌한 정의가 없었지만 대충 의미라도 확인할 수 있는 사이트를 찾아 내 맘대로 해독(?)했다.


 By default maven is generating a small JAR file, which just contains your compiled classes and other project files. If you want to have a single JAR file which also includes all dependent JAR files, you have to create a uber JAR.

출처: http://robert-reiz.com/2011/10/19/uber-jar-with-maven/



의존관계인 라이브러리의 JAR 를 풀어서 JAR로 묶는 것이 아니라 해당 라이브러리를 그대로 JAR안에 넣고 META-INF 로 조정하는 형식???


확실한 의미를 알게되면 다시 정리해야겠다 =ㅁ='''


Posted by 자수씨
, |

NFC? NFC???

JAVA / 2012. 6. 15. 14:51

 

파일업로드와 관련하여 코딩을 하던 도중(부사수한테 시킨일이지만...) 업로드된 파일명(한글)이 자소분리가 되는 현상이 발생하였습니다. (디버깅해서 확인할 때는 한글이 잘 보이는데, DB에 넣을 때는 자소가 분리되었습니다.)

 

이래저래 검색을 해본결과 유니코드의 정규화 때문에 발생하는 문제라 하는 군요.

 

맥에서는 NFD 방식, 나머지는 NFC 방식인데 부사수놈의 컴퓨터가 NFD 방식으로 넘겨주었나봅니다.

 

훗날을 대비하여 아래와 같이 방어 코드를 작성하였습니다.

 

String originFileName = "한글파일명.txt";

String normalizedFileName = Normalizer.normalize(originFileName, Normalizer.Form.NFC);

 

// normalizedFileName 사용

 

 

참고자료

http://www.androidside.com/bbs/board.php?bo_table=B46&wr_id=39275

Posted by 자수씨
, |


JMX remote 관련해서 급 처리할 일이 생겨서...





출처: http://docs.oracle.com/javase/1.5.0/docs/guide/management/agent.html#properties

Posted by 자수씨
, |

글 보관함

최근에 받은 트랙백