java.lang.NoClassDefFoundError:org.springframework.util.LinkedCaseInsensitiveMap

问题描述

运行JdbcTemplate.update进行插入时出现以下错误。我正在使用JDK1.8。

java.lang.NoClassDefFoundError: org/springframework/util/LinkedCaseInsensitiveMap
    at org.springframework.jdbc.core.ColumnMapRowMapper.createColumnMap(ColumnMapRowMapper.java:72)
    at org.springframework.jdbc.core.ColumnMapRowMapper.mapRow(ColumnMapRowMapper.java:54)
    at org.springframework.jdbc.core.ColumnMapRowMapper.mapRow(ColumnMapRowMapper.java:48)
    at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
    at org.springframework.jdbc.core.JdbcTemplate$3.doInPreparedStatement(JdbcTemplate.java:921)
    at org.springframework.jdbc.core.JdbcTemplate$3.doInPreparedStatement(JdbcTemplate.java:910)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:639)
    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:910)
    at io.bigbear.api.repository.FeatureDao.createFeature(FeatureDao.java:46)
    at io.bigbear.api.services.FeatureService.createFeature(FeatureService.java:37)

以下是我的代码,我在第 jdbcTemplate.update(new PreparedStatementCreator()

final String sql = "INSERT INTO feature(feature,error,status,created_by,updated_by,created_dt,last_modified_dt,"
            + "job_id,entity_sk,feature_type,beNumber,osuffix) VALUES( ?,?,?)";
    KeyHolder holder = new GeneratedKeyHolder();
    jdbcTemplate.update(new PreparedStatementCreator() {
        @Override
        public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {

            PreparedStatement ps = null;
            ps = connection.prepareStatement(sql,new String[] { "feature_id" });
            ps.setObject(1,feature.getFeature());
            ps.setString(2,feature.getError());
            ps.setString(3,feature.getStatus());
            ps.setString(4,feature.getCreatedBy());
            ps.setString(5,feature.getUpdatedBy());
            ps.setTimestamp(6,feature.getCreatedDt());
            ps.setTimestamp(7,feature.getUpdatedDt());
            ps.setLong(8,feature.getJobId());
            ps.setString(9,feature.getEntitySk());
            ps.setString(10,feature.getFeatureType());
            ps.setString(11,feature.getBeNumber());
            ps.setString(12,feature.getOsuffix());
            return ps;
        }
    },holder);

    long newFeatureId;
    if (holder.getKeys().size() > 1) {
        newFeatureId = (Long) holder.getKeys().get("Feature_id");
    } else {
        newFeatureId = holder.getKey().longValue();
    }

解决方法

我找到了原因,这是Spring DAO依赖项不匹配的原因之一。代码没有错。 谢谢。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...