为什么这段代码崩溃了JVM?

时间:2013-02-11 15:04:54

标签: java jndi java-6 jvm-crash

为什么这段代码会崩溃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,但它没有解决问题。

1 个答案:

答案 0 :(得分:4)

简单来说,不应该。这看起来像db2jcct2.dll(您的DB2驱动程序)中的错误。

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

您可以尝试其他版本的JDBC驱动程序吗?和/或向IBM报告?