AbstractMethodError on resultset.getObject

So, I create a minecraft plugin, one part of the plugin grabs a bunch of block data from mysql and loads it into the cache when the server starts. I have some code that works fine in eclipse tests. However, when I load the plugin on the local minecraft server, I get an exception.

    java.lang.AbstractMethodError: Method com / mysql / jdbc / JDBC4ResultSet.getObject (Ljava / lang / String; Ljava / lang / Class;) Ljava / lang / Object; is abstract
            at com.mysql.jdbc.JDBC4ResultSet.getObject (JDBC4ResultSet.java) ~ [spigot-1.8.8.jar: git-Spigot-db6de12-d3e0b6f]
            at fws.plugins.trigger.database.ModelDB.loadCollection (ModelDB.javahaps35) ~ [?:?]
            at fws.plugins.trigger.database.ModelDB.all (ModelDB.java:295) ~ [?:?]
etc ...



A bit of code that challenges.

rs.getObject( field.getName(), p.fieldType());

rsis the instance java.sql.ResultSetreturned from the deductible request.
p.fieldType()returns aClass<?>



A bit larger snippet ... not that it really shows you anything else.

if (field.isAnnotationPresent(Persist.class)) {
    try {
        Persist p = field.getAnnotation(Persist.class);
        Object o = rs.getObject( field.getName(), p.fieldType());
        field.set(m,p.fieldType().cast(o));

    } catch (Exception e) {
        // TODO Auto-generated catch block 
        e.printStackTrace();
    } 
}

I looked at online users who decided to fix it. I need to enable ojdbc6.jar and use it as my connection driver.
I added the file to the project structure under the lib folder, included it in my project and added it to my build file. http://i.imgur.com/7TXLbjj.png and changed the connection driver tooracle.jdbc.OracleDriver

However, I get the same problem, it seems not a fix. Although it is likely that I did all this wrong.

Can anybody help me, any ideas, etc.

EDIT **
from the command line

$ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)


from eclipse

System.out.println(System.getProperty("java.runtime.version"));

returns 1.8.0_51-b16



, ?

+4
2

JDBC 4.1 (Java 7) ResultSet.getObject(String columnLabel, Class<T> type). , JDBC 4.0, JDBC 4.1 ( JDBC 4.2/Java 8).

, JDBC ( Connector/J MySQL 5.1.38).

+2

, . , ResultSet .

@Override
public Select load(ResultSet rs) throws SQLException {
    this.id = rs.getInt("id");
    this.name = rs.getString("name");
    this.uuid = rs.getString("uuid");
    this.chunkX = rs.getInt("chunkX");
    this.chunkZ = rs.getInt("chunkZ");
    this.blockX = rs.getInt("blockX");
    this.blockY = rs.getInt("blockY");
    this.blockZ = rs.getInt("blockZ");
    return this;
};

, , .

0

Source: https://habr.com/ru/post/1625770/


All Articles