title: Error creating bean with name 'mySessionFactory' initialization of bean failed; nested exception is MalformedParameterizedTypeException
body: <p>I'm trying to configure spring with hibernate 4. But I keep getting the </p>
  
  <pre>
  SEVERE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' 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:480)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  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:105)
      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
      at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:100)
      at java.lang.Class.getGenericInterfaces(Class.java:814)
      at com.sun.beans.TypeResolver.prepare(TypeResolver.java:278)
      at com.sun.beans.TypeResolver.(TypeResolver.java:243)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:172)
      at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:93)
      at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387)
      at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:114)
      at java.beans.MethodDescriptor.(MethodDescriptor.java:72)
      at java.beans.MethodDescriptor.(MethodDescriptor.java:56)
      at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1150)
      at java.beans.Introspector.getBeanInfo(Introspector.java:433)
      at java.beans.Introspector.getBeanInfo(Introspector.java:174)
      at org.springframework.beans.CachedIntrospectionResults.(CachedIntrospectionResults.java:220)
      at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
      at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
      at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:282)
      at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:333)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1247)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
      ... 29 more
  
  Feb 22, 2014 12:03:13 PM org.apache.catalina.core.StandardContext listenerStart
  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 'mySessionFactory' 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:480)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
  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:105)
      at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
      at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
      at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:100)
      at java.lang.Class.getGenericInterfaces(Class.java:814)
      at com.sun.beans.TypeResolver.prepare(TypeResolver.java:278)
      at com.sun.beans.TypeResolver.(TypeResolver.java:243)
      at com.sun.beans.TypeResolver.resolve(TypeResolver.java:172)
      at com.sun.beans.TypeResolver.resolveInClass(TypeResolver.java:93)
      at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387)
      at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:114)
      at java.beans.MethodDescriptor.(MethodDescriptor.java:72)
      at java.beans.MethodDescriptor.(MethodDescriptor.java:56)
      at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1150)
      at java.beans.Introspector.getBeanInfo(Introspector.java:433)
      at java.beans.Introspector.getBeanInfo(Introspector.java:174)
      at org.springframework.beans.CachedIntrospectionResults.(CachedIntrospectionResults.java:220)
      at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:144)
      at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:252)
      at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptorInternal(BeanWrapperImpl.java:282)
      at org.springframework.beans.BeanWrapperImpl.isWritableProperty(BeanWrapperImpl.java:333)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1247)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
      ... 29 more
  </pre>
  
  <p>I am using following jar files</p>
  
  <pre><code>antlr-2.7.7.jar
  commons-dbcp-1.4.jar
  commons-logging-1.1.3.jar
  commons-pool-1.5.jar
  cruze-1.0.10.jar
  dom4j-1.6.1.jar
  hibernate-commons-annotations-4.0.4.Final.jar
  hibernate-core-4.3.0.Final.jar
  hibernate-jpa-2.1-api-1.0.0.Final.jar
  jandex-1.1.0.Final.jar
  javassist-3.18.1-GA.jar
  javax.inject-1.jar
  jboss-logging-3.1.3.GA.jar
  jboss-logging-annotations-1.2.0.Beta1.jar
  jboss-transaction-api_1.2_spec-1.0.0.Final.jar
  mysql-connector-java-5.1.6-bin.jar
  primefaces-4.0.jar
  spring-2.5.6.jar
  spring-data-commons-core-1.4.1.RELEASE.jar
  spring-orm-4.0.0.RELEASE.jar
  </code></pre>
  
  <p>I am not using Maven or Ant. </p>
  
  <p>My applicationContext.xml file is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
      &lt;beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
          http://www.springframework.org/schema/beans    
          http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-4.0.xsd"&gt;
  
  
      &lt;bean id="cab" class="com.beans.Cab" scope="session" autowire="byType"&gt;&lt;/bean&gt;
      &lt;bean id="isBean" class="assets.impl.SpringBean" autowire="byType"&gt;&lt;/bean&gt;
  
  
      &lt;bean id="myDataSource" class = "org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="com.mysql.jdbc.Driver"/&gt;
          &lt;property name="url" value="jdbc:mysql://localhost:3306/rendacab?useUnicode=true"/&gt;
          &lt;property name="username" value="root"/&gt;
          &lt;property name="password" value="root"/&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="mySessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="myDataSource"/&gt;
          &lt;property name="packagesToScan" value="com.rent.cab.entity"/&gt;
          &lt;property name="hibernateProperties"&gt;
          &lt;props&gt;
              &lt;prop key="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/prop&gt;
              &lt;prop key="hibernate.show_sql"&gt;true&lt;/prop&gt;
              &lt;prop key="hibernate.hbm2ddl.auto"&gt;create&lt;/prop&gt;
          &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>I've searched other forums including stackoverflow but solutions given there were not helpful to me. I keep getting same exception again and again. </p>
  
  <p>Please help me out
  Regards</p>