u011192793
ewevn
采纳率0%
2016-06-17 08:44 阅读 5.9k

使用mybatis遇到的奇葩错误

 java.lang.ClassFormatError: Method "setString" in class sun/reflect/GeneratedMethodAccessor5 has illegal signature "(IPjava/lang/String;)V"
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at sun.reflect.MethodAccessorGenerator$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(Unknown Source)
    at sun.reflect.MethodAccessorGenerator.generateMethod(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:53)
    at com.sun.proxy.$Proxy26.setString(Unknown Source)
    at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:12)
    at org.apache.ibatis.type.StringTypeHandler.setNonNullParameter(StringTypeHandler.java:8)
    at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:23)
    at org.apache.ibatis.type.UnknownTypeHandler.setNonNullParameter(UnknownTypeHandler.java:21)
    at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:23)
    at org.apache.ibatis.executor.parameter.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:73)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:61)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:44)
    at com.sun.proxy.$Proxy25.parameterize(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:44)
    at com.sun.proxy.$Proxy25.parameterize(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:44)
    at com.sun.proxy.$Proxy25.parameterize(Unknown Source)
    at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:56)
    at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:28)
    at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:88)
    at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:44)
    at com.sun.proxy.$Proxy24.update(Unknown Source)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:122)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:111)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.al.persistence.ExtSqlSessionTemplate$SqlSessionInterceptor.invoke(ExtSqlSessionTemplate.java:190)
    at com.sun.proxy.$Proxy12.insert(Unknown Source)
    at com.al.persistence.ExtSqlSessionTemplate.insert(ExtSqlSessionTemplate.java:116)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:59)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:25)
    at com.sun.proxy.$Proxy17.insertCacheData(Unknown Source)

在Mapper.xml 中配置sql语句,
数据库字段:
cache_dir varchar2(50)
cache_key varchar2(50)
cache_value varchar2(1000)
is_remote varchar2(5)
create_date varchar2(50)
value_type varchar2(50)

    public void updateCacheData(Map<String, String> argsMap);
 insert into  
        CACHE_TABLE
        (
            CACHE_DIR,
            CACHE_KEY,
            CACHE_VALUE,
            IS_REMOTE,
            VALUE_TYPE,
            CREATE_DATE
        )
        values(
            #{cacheDir,jdbcType=VARCHAR},
            #{cacheKey,jdbcType=VARCHAR},
            #{cacheValue,jdbcType=VARCHAR},
            #{isRemote,jdbcType=LONGVARCHAR},
            #{valueType,jdbcType=LONGVARCHAR},
            #{createDate,jdbcType=LONGVARCHAR}
        )
    </insert>

后面三个字段用jdbcType=varchar就报上面那个错,用longvarchar就不报错了,所有字段都不为空值,这是为什么?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • u011606457 _1_1_7_ 2016-06-17 11:22

    其实可以不写jdbctype

    点赞 评论 复制链接分享

相关推荐