Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in thread "main" java.lang.IllegalAccessError: tried to access method javassist.ClassPool.<init>()V from class com.zaxxer.hikari.proxy.JavassistProxyFactory #89

Closed
JohnMerlino1 opened this issue Jun 6, 2014 · 1 comment

Comments

@JohnMerlino1
Copy link

I am having an issue with installation. I am using Eclipse. I downloaded the HikariCP-1.3.8.jar and added it to my build path. I noticed it required two dependencies, so I added javassist24.jar to my build path and slf4j-api-1.7.7.jar to my build path. When I tried to compile then, it gave me the error: SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. So I added slf4j-simple.1.7.7.jar to my build path. Now I get the error:

Exception in thread "main" java.lang.IllegalAccessError: tried to access method javassist.ClassPool.()V from class com.zaxxer.hikari.proxy.JavassistProxyFactory
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:82)
at com.zaxxer.hikari.proxy.JavassistProxyFactory.(JavassistProxyFactory.java:57)
at com.zaxxer.hikari.HikariConfig.(HikariConfig.java:83)
at MyConnectionPool.main(MyConnectionPool.java:16)

And all I am doing is just trying to test a connection:

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.Statement;

public class MyConnectionPool {

public static void main(String[] args) throws SQLException {
    Statement   stmt = null;  
    ResultSet   rset = null;  
    Connection  conn = null;

    HikariConfig config = new HikariConfig();
    config.setMaximumPoolSize(50);
    config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
    config.addDataSourceProperty("serverName", "localhost");
    config.addDataSourceProperty("port", "5432");
    config.addDataSourceProperty("databaseName", "mydb");
    config.addDataSourceProperty("user", "myuser");
    config.addDataSourceProperty("password", "mypassword");

    HikariDataSource ds = new HikariDataSource(config);
    try {
        conn = ds.getConnection();
        stmt = conn.createStatement();
        rset = stmt.executeQuery("SELECT * FROM users");
        while (rset.next())  
        {  
            rset.getString(1);
        }
    } catch (SQLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } finally {
        if (stmt != null)  
        {  
            stmt.close();  
        }  

        if (rset != null)  
        {  
            rset.close();  
        }  

        if (conn != null)  
        {  
            conn.close();  
        }
    }
}

}

The exception occurs here:
HikariConfig config = new HikariConfig();

@JohnMerlino1
Copy link
Author

This error went away when I followed the dependencies on this site: https://www.versioneye.com/java/com.zaxxer:HikariCP/1.3.8. I used javassist-3.18.1-GA.jar, slf4j-api-1.7.5.jar and slf4j-simple-1.7.5.jar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants