0

我在创建池时遇到了 C3P0 和 java 的问题,然后我做了一个测试查询,它工作正常……直到测试查询结束。在成功查询并尝试关闭连接后,我收到了这个巨大的错误。

编码:

package database;
import com.mchange.v2.c3p0.*;
import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;
import java.io.IOException;
import java.sql.Statement;
import java.sql.ResultSet; 
public class Datasource {
    private ComboPooledDataSource cpds;
    private static Datasource datasource;

    private Datasource() throws IOException, SQLException {

        cpds = new ComboPooledDataSource();

        try {
            cpds.setDriverClass("com.mysql.jdbc.Driver");
        } catch (PropertyVetoException e) {
            e.printStackTrace();
        }

        cpds.setJdbcUrl("[removed for safety]");
        cpds.setUser("[removed for safety]");
        cpds.setPassword("[removed for safety]");
        cpds.setMinPoolSize(5);
        cpds.setAcquireIncrement(5);
        cpds.setMaxPoolSize(10);

        Connection testConnection = null;
        Statement testStatement = null;
        ResultSet rs = null; 
        // test connectivity and initialize pool
        try {
               testConnection = cpds.getConnection();
               testStatement = testConnection.createStatement();
               rs = testStatement.executeQuery("SELECT * From ScoreBoard");
               while (rs.next()) {
                String id = rs.getString("ScoreBoardID");
                System.out.println("ID: " + id);
            }
            } catch (SQLException e) {
                throw e;
            } finally {
                testStatement.close();
                testConnection.close();
        }

    }

    public static Datasource getInstance() throws IOException, SQLException {
        if (datasource == null) {
              datasource = new Datasource();
              return datasource;
            } else {
              return datasource;
            }
    }

    public Connection getConnection() throws SQLException {
        return this.cpds.getConnection();
    }
}

我在 main 中唯一做的就是打电话

Datasource ds = Datasource.getInstance();

这是疯狂的错误:

UTE019: Unable to obtain storage for thread control block  UTE thread start failed for thread 00007FEFB4F37900 Unhandled exception Type=Segmentation error vmState=0x000540ff J9Generic_Signal_Number=00000004 Signal_Number=0000000b Error_Value=00000000 Signal_Code=00000001 Handler1=00007FEFBBA02C80 Handler2=00007FEFBB6BBFF0 InaccessibleAddress=0000000000000038 RDI=0000000000000000 RSI=0000000000000010 RAX=00000000B4062808 RBX=00007FEF881ED670 RCX=00007FEFB418DFB0 RDX=0000000000000020 R8=00007FEFB868D708 R9=00007FEFB868D710 R10=0000000000000047 R11=00007FEFB419E2F8 R12=00007FEFB868D83B R13=0000000000000010 R14=00007FEFB868D850 R15=0000000000000000 RIP=00007FEFBA481D1C GS=0000 FS=0000 RSP=00007FEFB868D740 EFlags=0000000000210202 CS=0033 RBP=0000000000000000 ERR=0000000000000004 TRAPNO=000000000000000E OLDMASK=0000000000000000 CR2=0000000000000038 xmm0 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm1 0000000000000000 (f: 0.000000, d:
0.000000e+00) xmm2 7173796d2f6d6f63 (f: 795701120.000000, d: 3.170290e+238) xmm3 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm4 4040404040404040 (f: 1077952512.000000, d: 3.250196e+01) xmm5 5b5b5b5b5b5b5b5b (f: 1532713856.000000, d: 1.213625e+132) xmm6 2020202020202020 (f: 538976256.000000, d: 6.013470e-154) xmm7 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm8 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm9 0000000000000000 (f: 0.000000, d:
0.000000e+00) xmm10 ff000000000000ff (f: 255.000000, d: -5.486124e+303) xmm11 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm12 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm13 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm14 0000000000000000 (f: 0.000000, d: 0.000000e+00) xmm15 0000000000000000 (f: 0.000000, d:
0.000000e+00) Module=/usr/lib/jvm/java-1.6.0-ibm-1.6.0.14.0.x86_64/jre/lib/amd64/default/libj9jit24.so Module_base_address=00007FEFBA391000

Method_being_compiled=com/mysql/jdbc/Field.getSQLType()I Target=2_40_20130704_155156 (Linux 2.6.32-358.18.1.el6.x86_64) CPU=amd64 (8 logical CPUs) (0x1ebfd7000 RAM)
----------- Stack Backtrace ----------- (0x00007FEFBA481D1C [libj9jit24.so+0xf0d1c]) (0x00007FEFBA481CEE [libj9jit24.so+0xf0cee]) (0x00007FEFBA70E19D [libj9jit24.so+0x37d19d]) (0x00007FEF4C1F7210 [<unknown>+0x0])
--------------------------------------- JVMDUMP039I Processing dump event "gpf", detail "" at 2013/10/08 13:52:31 - please wait. JVMDUMP032I JVM requested System dump using '/students/8/hhnvx8/capstone/DBTest/core.20131008.135231.7921.0001.dmp' in response to an event JVMPORT030W /proc/sys/kernel/core_pattern setting "|/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e" specifies that the core dump is to be piped to an external program.  Attempting to rename either core or core.7964.

JVMDUMP010I System dump written to /students/8/hhnvx8/capstone/DBTest/core.20131008.135231.7921.0001.dmp JVMDUMP032I JVM requested Java dump using '/students/8/hhnvx8/capstone/DBTest/javacore.20131008.135231.7921.0002.txt' in response to an event JVMDUMP010I Java dump written to /students/8/hhnvx8/capstone/DBTest/javacore.20131008.135231.7921.0002.txt JVMDUMP032I JVM requested Snap dump using '/students/8/hhnvx8/capstone/DBTest/Snap.20131008.135231.7921.0003.trc' in response to an event JVMDUMP010I Snap dump written to /students/8/hhnvx8/capstone/DBTest/Snap.20131008.135231.7921.0003.trc JVMDUMP013I Processed dump event "gpf", detail "".

Unhandled exception in signal handler. Protected function: reportThreadCrash


Unhandled exception in signal handler. Protected function: executeAbortHook

我知道可能不太可能有人会知道如何帮助我,但值得一试,您提供的任何帮助都会得到感激。

谢谢

4

1 回答 1

1

看起来您使用 IBM JDK 运行它。尝试使用当前的 Oracle/Sun JDK,它可能开箱即用。如果您需要使用 IBM JDK,请检​​查您的启动参数,您可能需要增加内存限制。

于 2013-10-08T19:14:23.327 回答