본문 바로가기
IBM - old/WAS 문제&해결

잘못된 Datasource JNDI mapping 을 넣어도 정상작동

by freeman98 2016. 5. 6.

1. WAS 버전 : WebSphere ND v6.1.0.21

2. OS : All

3. Error 발생 시점 :  어플리케이션 업데이트 시에 실수에 의해 Datasource 에 대한 JNDI mapping 을 틀렸는데도
                           문제 없이 정상작동 될 경우

4. Error message :
Error message 없으나 JNDI mapping 확인을 위하여 Trace 를 걸면 한단과 같은 결과 확인
Trace : *=info:Naming=all:EJBContainer=all:PMGR=all:management=all:WAS.j2c=all

[09. 9. 26   16:38:33:312 KST] 00000035 ResRefListImp 3   Returning   
                                     ******* Resource-Ref *******     
                                 Description=                         
                                 Name=jdbc/XXX_DS                   
                                 JNDIName=jdbc/YYY_DS               
                                 Type=javax.sql.DataSource            
                                 ResAuth=CONTAINER                    
                                 ResSharingScope=SHAREABLE            
                                 IsolationLevel=TRANSACTION_NONE      
                                 loginConfigurationName=null          
                                 loginProperties=[]          
................        
[09. 9. 26   16:38:33:313 KST] 00000035 BeanMetaData  3   looking up  java:comp/env/jdbc/XXX_DS                                           
................                                                      
[09. 9. 26   16:38:33:321 KST] 00000035 ResRefJndiLoo 3   Look up of    Res-Ref with name: jdbc/XXX_DS                                      
[09. 9. 26   16:38:33:321 KST] 00000035 IndirectJndiL >                 getObjectInstance() Entry                                             
[09. 9. 26   16:38:33:321 KST] 00000035 IndirectJndiL >                 getObjectInstanceExt() Entry                                          
[09. 9. 26   16:38:33:323 KST] 00000035 JndiLookupInf 3                 JndiLookupInfoRefAddr.getContent() is returning:                      
                                 jndiName              = jdbc/YYY_DS
                                 providerUrl           =              
                                 initialContextFactory =     

................ 
[09. 9. 26   16:38:44:497 KST] 00000035 BeanMetaData  3   looked up  jdbc/XXX_DS previously 

5. 예상 이유 : 한 트랜잭션에서 처음에 EJB bean 이 호출되면서 Datasource 를 lookup 할 경우 JNDI mapping 을 하는데
             이때, WebSphere 에서 shareable 옵션으로 지정이 되어 있으면 connetion 을 트랜잭션 내에서 재활용하기 위하여
             Memory 에 보관하고 다음 EJB bean 이 호출되어서 동일한 JNDI name 을 찾으면 이 mapping 이 잘못되어 있더라도
             새로운 mapping 을 만드는 것이 아니라 이미 memory 에 저장된 기존 mapping 을 사용하여
             connection 을 재사용하기 때문에 정상 작동됨

6. 조치 방안 : WebSphere 에서 resource 를 최대한 활용하기 위한 smart handle 이라는 기술의 일종으로 추가 조치는 필요없으며
            만약, 이런 방식을 원하지 않는다면 shareable 옵션을 unshareable 로 변경하면 재활용 없이
            트랜잭션 내에서 호출될 때마다 mapping 을 만듦
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/topic/com.ibm.websphere.express.doc/info/exp/ae/cdat_cconpconh.html      

댓글