Search code examples
javajndijava-6jvm-crash

Why this code crashes the JVM?


Why does this code crashes the 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!");
    }
}

The log is the following:

#
# 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]

I have already upgraded from 6.0_29 to 6.0_39, but it didn't solve the problem.


Solution

  • Briefly, it shouldn't. That looks like a bug in db2jcct2.dll (your DB2 driver).

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

    Can you try another version of your JDBC driver ? And/or report this to IBM ?