JDK 1.5이상부터 제공하는 Sun의 JConsole을 사용하면 VM에 대한 정보를 모니터링 할 수 있습니다. 이를 이용하여 또한 JBoss의 구동중인 VM상태를 모니터링 할 수 있습니다. 자세한 정보는 아래의 URL에서 확인하실 수 있습니다.
http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html
Technical Articles : http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html

1. Local에서 구동중인 JBoss Server에 설정하기
JMX Agent를 Local의 JBoss 서버에 구동시키려면 다음의  java option을 run shell(run.conf/run.sh or run.bat)에 포함시켜 주시면 됩니다.

#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-server -Xms128m -Xmx128m"
fi

# Enable the jconsole agent locally
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"

그런 다음 $JAVA_HOME/bin/jconsole을 실행시키면 다음의 화면이 나타납니다.
[jchoi@/opt/java1.5]jconsole

연결이 되면 아래의 그림처럼 VM 상황에 대한 자세한 정보를 확인할 수 있습니다.



2. Remote Server에서 구동중인 JBoss Server에 설정하기
Remote라고 해서 별다른 설정이 있는 게 아닙니다. 원격에서 실행하는 JBoss Server의 옵션에 필요한 파라미터를 전달받아 JConsole을 로컬에서 실행해서 보면 됩니다.

기본적으로는 다음의 스크립트를 추가하도록 합니다.
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-server -Xms128m -Xmx128m"
fi
# Enable the jconsole agent remotely on port 12345
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"



만약 security 옵션을 사용하지 않고 모니터링하고 싶다는 다음과 같이 start shell을 꾸며주면 됩니다.
# Enable the jconsole agent remotely on port 8888
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=8888"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"

위의 옵션을 준 후 jconsole을 실행시켜 remote탭을 보게 되면 연결할 수 있습니다.

위의 설정을 이용하여 추이를 지켜본 후 Memory Leak등의 여부를 그래프로 확인해볼 수 있을 겁니다.

|

이 문제를 해결하기 위하여 Spring JMS의 configuration을 수정하여야 합니다. 기본적으로 Spring은 Connection URL을 여러 개(예:jnp://serverip:port,serverip:port)로 주었을 때 최초의 lookup url만을 인식하여 exception이 발생하게 됐을 경우 다른 노드가 아닌 같은 노드로의 접속만을 무한대로 시도하게 되는 단점을 가지고 있습니다(Spring 3.0 개선 가능)

 이는 JBoss 뿐만 아니라 WebLogic도 같은 종류의 에러가 발생되고 있습니다. WebLogic 또한 jmsTemplate을 이용하여 URL List를 주었을 때 secondary url로 fail-over가 안되는 현상을 다음의 내용에서 확인하실 수 있습니다. (참조 : http://jira.springframework.org/browse/SPR-4720)

“I've followed this issue for few days as I face the similar problem. I came to the same workaround but it didn't work for me as I use cluster address to my weblogic cluster like t3://192.168.42.58:8001,192.168.42.58:9001

If I use single node weblogic instance, it works just fine. When I use two nodes failover still works but only when I shutdown first node and then start it again. However when I try to shutdown the first node and migrate JMS server to the second node my Spring client doesn't failover. I get this exception:

May 18, 2008 9:14:37 PM org.springframework.jms.listener.DefaultMessageListenerContainer handleListenerSetupFailure
SEVERE: Setup of JMS message listener invoker failed - trying to recover
weblogic.jms.common.JMSException: Destination not found”

 이를 해결하기 위한 방법은 다음의 configuration을 Spring JMS Configuration file에 추가도록 합니다.

<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
        <property name="environment">
            <props>
                <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
                <!-- for server -->
                <prop key="java.naming.provider.url">10.64.160.179:1299,10.64.160.217:1299</prop>                <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
            </props>
        </property>
    </bean>

 <bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiTemplate">
            <ref bean="jndiTemplate" />
        </property>
        <property name="jndiName">
            <value>/ConnectionFactory</value>
        </property>
        <property name="cache" value="false"/>
        <property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
        <!-- Fails both with and without the following two elements defined -->
        <!-- <property name="lookupOnStartup" value="false" /> -->
        <!-- <property name="proxyInterface" value="javax.jms.ConnectionFactory" /> -->
        <!-- END optional -->
    </bean>



 

<bean id="listenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory">
<ref bean="cachingConnectionFactory" />
</property>
        <property name="destination"><ref bean="receiveDestination" /></property>
        <property name="concurrentConsumers" value="3" />
        <property name="recoveryInterval" value="2000" />
        <property name="messageListener" ref="messageListener" />
    </bean>


Test Sequence
1.      1번, 2번 Messaging Server를 기동시키십시오.
2.      1번의 application를 기동시키십시오. 이 때 기본적으로 1번으로 접속을 시도하게 되며 연결을 유지하게 됩니다.
3.      다음의 애플리케이션을 구동시켜 1번으로 메시지를 전송해 봅니다.
/app/test> send.sh
4.      1번의 Messaging Server를 kill.sh로 shutdown시키십시오.
5.      다음의 애플리케이션을 다시 한 번 구동시켜 메시지를 전송합니다.
/app/test> send.sh    
메시지는 자동으로 83번으로 가게 되며 이미 fail-over된 tracking-server는 83번에서 메시지를 전송받게 됩니다.

위의 fail-over상황은 server의 serverlog/server.log 파일에서 debug 모드 fail-over되는 것을 확인하실 수 있습니다.

|

JBoss를 사용하다 한글 처리에 대한 질문을 많이 받고 있습니다. 다국어 지원까지 포함해야 하는 경우도 종종 있습니다.

JBoss에서 한글 처리를 하기 위해서는 2가지의 작업이 필요합니다.

1. Web Application에 filter를 등록하기

첨부하는 파일을 이용하여 web.xml에 Encoding Filter를 등록하도록 합니다.
다음의 내용을 web.xml에 추가합니다.

<filter>
   <filter-name>Set Character Encoding</filter-name>
   <filter-class>filters.SetCharacterEncodingFilter</filter-class>
   <init-param>
       <param-name>encoding</param-name>
       <param-value>UTF-8</param-value>
   </init-param>
</filter>

<filter-mapping>
   <filter-name>Set Character Encoding</filter-name>
   <url-pattern>/*</url-pattern>
</filter-mapping>

JBoss level에서 엄격하게 스펙을 적용하는 통에.. 위의 url-pattern은 * 이 아니고 /* 이어야 합니다.

2. JBoss의 $SERVER_HOME/deploy/jboss-web.deployer/server.xml 파일을 열어 필요한 Connector 부분에 다음의 attribute를 추가합니다. JBoss의 default encoding은 ISO-8859-1입니다.
<Connector ... URIEncoding="UTF-8"/>

위와 같이 설정하면 다국어 지원까지 가능한 애플리케이션을 만들 수 있습니다.


|

일반적으로 server에서 사용하는 라이브러리를 해당 서버 전체의 classpath에 적용시킬 경우 $SERVER_NAME/lib 디렉토리에 jar파일을 가져다 놓으면 모든 애플리케이션에서 사용할 수 있게 됩니다.

그렇지 않으면 WAR의 WEB-INF/lib나 EAR단위의 APP-INF/lib 디렉토리에 필요한 라이브러리를 가져다 놓으면 됩니다.
만약 위에서 제시한 두 가지 방법을 모두 사용하고 싶지 않고 나만의 lib 디렉토리를 만들어서 그 곳에 확장 라이브러리를 사용하고 싶은 경우가 있을 겁니다. 이 때에 다음과 같은 option을 run.sh 를 구동시킬 때 "-p" 옵션을 주게 되면 사용자가 정의한 위치를 class loader를 통해 올리게 됩니다.

run.sh -c default -p lib/ext -b 0.0.0.0
|

구글일정을 SMS로 받기

관련정보

  • servy's box님의 블로그

이메일을 공짜로 SMS로 알려주는 사이트

아레오메일 설정

  • 회원가입
  • 환경설정
  • 메일도착 SMS로 알림 설정
  • 메일주소 calendar-notification@google.com를 설정

구글캘린더 설정

  • 설정 - 알림 기능
  • 알림을 메일로 설정
  • G메일로 알려줌

G메일중 일부만 아레오로 전송

  • 지메일 환경설정
  • 새 필터 만들기
  • 보낸사람이 calendar-notification@google.com 이면 휴대폰번호@arreo.com 메일로 전송
|

놀새~'s Blog is powered by Daum & tistory