2013-02-11 189 views
1

爲什麼此代碼會使JVM崩潰?爲什麼這段代碼崩潰了JVM?

public Connection createConnectionFromDS() throws Exception { 
    try { 
     Connection con = null; 
     Properties props = new Properties(); 
     props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); 
     props.put(Context.PROVIDER_URL, "my_ip"); 
     Context ctx = new InitialContext(props); 
     log.debug("Looking up datasource " + dataSourceName); 
     DataSource dataSource = (javax.sql.DataSource) ctx.lookup(dataSourceName); 
     con = dataSource.getConnection(); 
     return con; 
    } catch (NameNotFoundException e) { 
     throw new Exception("Datasource [" + dataSourceName + "] not bound!"); 
    } 
} 

日誌如下:

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000001800060ba, pid=3816, tid=3076 
# 
# JRE version: 6.0_39-b04 
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.14-b01 mixed mode windows-amd64 compressed oops) 
# Problematic frame: 
# C [db2jcct2.dll+0x60ba] 

我已經升級,從6.0_29到6.0_39,但它並沒有解決問題。

回答

4

簡而言之,它不應該。這看起來像db2jcct2.dll(您的DB2驅動程序)中的錯誤。

# Problematic frame: 
# C [db2jcct2.dll+0x60ba] 

你可以試試其他版本的JDBC驅動程序嗎?和/或向IBM報告?

+1

起初我以爲它是你的JVM,但重讀時我認爲它是你的DB2驅動程序。抱歉的混淆。 – 2013-02-11 15:12:11