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