Freemaker的java.beans.IntrospectionException: type mismatch between read and write methods

原创 2017年07月12日 09:46:47

引言:freemaker在特定的spring以及jdk下的问题解决路径。

环境描述

spring 3.1.1, jdk1.8u80, freemake 2.3.19

错误信息描述:

严重: Exception sending context initialized event to listener instance of class org.jeecgframework.web.system.listener.OnlineListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘freemarker’ defined in file [D:\OpenSource\jeewx\jeewx\target\classes\spring-mvc-cgform.xml]: Initialization of bean failed; nested exception is org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [freemarker.template.Configuration]; nested exception is java.beans.IntrospectionException: type mismatch between read and write methods
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.springframework.beans.FatalBeanException: Failed to obtain BeanInfo for class [freemarker.template.Configuration]; nested exception is java.beans.IntrospectionException: type mismatch between read and write methods
at org.springframework.beans.CachedIntrospectionResults.(CachedIntrospectionResults.java:262)
at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149)
at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:324)
at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.filterPropertyDescriptorsForDependencyCheck(AbstractAutowireCapableBeanFactory.java:1242)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1101)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
… 42 more
Caused by: java.beans.IntrospectionException: type mismatch between read and write methods
at java.beans.PropertyDescriptor.findPropertyType(PropertyDescriptor.java:661)
at java.beans.PropertyDescriptor.setReadMethod(PropertyDescriptor.java:257)
at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:282)
at org.springframework.beans.ExtendedBeanInfo.addOrUpdatePropertyDescriptor(ExtendedBeanInfo.java:180)
at org.springframework.beans.ExtendedBeanInfo.(ExtendedBeanInfo.java:100)
at org.springframework.beans.CachedIntrospectionResults.(CachedIntrospectionResults.java:224)
… 48 more

错误的核心关键词是java.beans.IntrospectionException: type mismatch between read and write method。
直观来分析就是javaBean中的方法调用问题,之前的版本和运行都是正确的,所以锁定jdk或者spring版本的问题。

解决方法

经过一番的查找和验证,解决的思路有以下两个:

  • downgrade至JDK 1.7

  • 升级至spring 4.1.2+

参考资料

IntrospectionException: type mismatch between read and write methods

[INFO][2014-09-03 22:13:16,760][com.alibaba.druid.pool.DruidDataSource]{dataSource-1} closed [ERROR...
  • gjswxhb
  • gjswxhb
  • 2014年09月06日 12:08
  • 9401

UIPasteboard Example – Read, Write and Share data between apps

In UIPasteboard Example, I have explained how to read data from UIPasteboard and write data to UIP...

How to read and write JSON files in Java(Gson)

JSON (JavaScript Object Notation) is a data interchange format widely used in many environments. ...

file read and write use java

读文件: FileInputStream 通过打开一个到实际文件的连接来创建一个 FileInputStream,该文件通过文件系统中的路径名 name 指定。创建一个新 FileDes...

differences between Require, Load, Include and Extend methods

Here are the differences between Require, Load, Include and Extend methods:IncludeWhen you Include a...

java反射泛型异常:argument type mismatch解决方案

最近使用java反射泛型的时候出现异常:argument type mismatch,经过debug排查终于解决,废话不说,直接上代码: javabean及相应的执行函数如下所示: pub...

web开发时java.lang.IllegalArgumentException: argument type mismatch异常及解决方法

最近在做一个项目的时候,突然间出现了这个异常 严重:Servlet.service() for servlet action threw exception java.lang.Illegal...

Caused by: java.lang.IllegalArgumentException: argument type mismatch错误

2014-06-24 08:51:42,984 ERROR [main] (DefSchedulerEngine.java:157) - 调度引擎启动异常 org.springframework.o...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Freemaker的java.beans.IntrospectionException: type mismatch between read and write methods
举报原因:
原因补充:

(最多只允许输入30个字)