Bahor 3 va MyBatis 3.0.4/3.0.6: MalformedParameterizedTypeException

Bahor 3.0.5.RELEASE bilan MyBatis bilan birgalikda Maven muhitida foydalanishga harakat qilaman. Men mybatis bahoriga qaramligini qo'shdim. Bu MalformedParameterizedTypeException tufayli ishlamasligi aniqlandi (batafsil ma'lumot quyida berilgan).

Stacktrace:

SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
    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:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
    at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:60)
    at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.(ParameterizedTypeImpl.java:53)
    at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:95)
    at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:104)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
    at sun.reflect.generics.visitor.Reifier.visitArrayTypeSignature(Reifier.java:159)
    at sun.reflect.generics.tree.ArrayTypeSignature.accept(ArrayTypeSignature.java:42)
    at sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:94)
    at java.lang.reflect.Method.getGenericParameterTypes(Method.java:300)
    at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:385)
    at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116)
    at java.beans.MethodDescriptor.(MethodDescriptor.java:74)
    at java.beans.MethodDescriptor.(MethodDescriptor.java:58)
    at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1196)
    at java.beans.Introspector.getBeanInfo(Introspector.java:423)
    at java.beans.Introspector.getBeanInfo(Introspector.java:189)
    at org.springframework.beans.CachedIntrospectionResults.(CachedIntrospectionResults.java:224)
    at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149)
    at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:305)
    at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:335)
    at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:407)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    ... 19 more
3
IMO bu siz javob bergan va qabul qilgan savol sifatida taqqoslash kerak.
qo'shib qo'ydi muallif Dave Newton, manba
Manoga ega. Rahmat.
qo'shib qo'ydi muallif Martin Becker, manba

1 javoblar

Bu nashrga oid bir nechta xabarlar bor, ammo ularning ko'pchiligi muammoga masalani bahorning 2-qismiga bog'liqligi sababli keltiradi, chunki men uchun bunday bo'lmagan:

Birinchi bog'da bahor 2-bahorga mos kelmasligi haqida bahs-3 bahorda 3-bahorda emas, balki 2-bahorda bo'lmaganligi sababli eslatib o'tiladi. Aslida, haqiqiy muammo mening MyBatis versiyamga ega ekanligini ko'rsatdi ( 3.0.4 ). 3.0.4 versiyasini 3.0.6 versiyasiga o'zgartirdim va hamma narsa yaxshi ishladi. Odatda, loyihada (yoki ota-ona loyihalarida) alohida MyBatis qaramligi bo'lmasa, Mavendan olingan mybatis-bahor asari MyBatis 3.0.6 bilan keladi.

Yonma diqqat: Men foydalanadigan Maven qaramlikni boshqarish tizimi bilan boshqa muammolar mavjud edi, chunki o'zgargan pom.xml bog'liqligi oliy darajadagi loyihalarga tarqalmaydi. Shubhasiz, bir mvn toza o'rnatishdan so'ng - Dmaven.text.skip = haqiqiy bog'liqliklar yuqori darajali loyihalarga tarqaldi va hamma narsa ishlayotgan edi.

2
qo'shib qo'ydi
Xuddi shu masala bor edi: birinchi navbatda alohida mybatis qo'shilishni bartaraf qilish, keyin esa 2.X bahor bog'liqligini olib tashlash.
qo'shib qo'ydi muallif sibidiba, manba