【问题标题】:MalformedParameterizedTypeException when running Mybatis AppMybatis App运行时出现MalformedParameterizedTypeException
【发布时间】:2013-01-07 03:12:20
【问题描述】:

这是堆栈跟踪:

上下文初始化失败 org.springframework.beans.factory.BeanCreationException:创建 ServletContext 资源 [/WEB-INF/applicationContext.xml] 中定义的名称为“sqlSessionFactory”的 bean 时出错:bean 初始化失败;嵌套异常是 java.lang.reflect.MalformedParameterizedTypeException

我使用了带有 mybatis-spring 1.1.1 的库,并添加了 spring-web-3.1.1.RELEASE.jar。我的 IDE 是 JDeveloper 11.1.2.1.0。这是WEB-INF/lib的内容

aopalliance-1.0.jar
commons-logging-1.1.1.jar
jettison-1.1.jar
mybatis-3.1.1.jar
mybatis-spring-1.1.1.jar
mybatis-spring-1.1.1-javadoc.jar
mybatis-spring-1.1.1-sources.jar
spring-aop-3.1.1.RELEASE.jar
spring-asm-3.1.1.RELEASE.jar
spring-batch-core-2.1.8.RELEASE.jar
spring-batch-infrastructure-2.1.8.RELEASE.jar
spring-beans-3.1.1.RELEASE.jar
spring-context-3.1.1.RELEASE.jar
spring-core-3.1.1.RELEASE.jar
spring-expression-3.1.1.RELEASE.jar
spring-jdbc-3.1.1.RELEASE.jar
spring-tx-3.1.1.RELEASE.jar
spring-web-3.1.1.RELEASE.jar
xpp3_min-1.1.4c.jar
xstream-1.3.jar

这是 applicationContext.xml 的内容

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="${driverClassName}"/>
    <property name="url" value="${url}"/>
    <property name="username" value="${username}"/>
    <property name="password" value="${password}"/>
</bean>

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="typeAliasesPackage" value="ph.com.aub.util"/>
</bean>

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="ph.com.aub.mappers" />
</bean>

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:jdbc.properties</value>
</property>
</bean>

【问题讨论】:

  • 你能发布你的xml applicationContext.xml吗?
  • 你的问题呢?

标签: spring mybatis


【解决方案1】:

我认为你使用了错误的库:你应该使用 mybatis-3.1.0

spring-mybatis-integration

【讨论】:

  • 仍然无法正常工作。我尝试从 mybatis 网站下载 JPetstore 应用程序。我将 JPetstore 应用程序中的库添加到我的项目中。现在我得到了 ff: java.lang.NoSuchMethodError: org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;我的类路径上没有任何 spring 2 罐子。 Jdeveloper 和 mybatis 有问题吗?
  • 终于搞定了。我添加了一个带有 ff 内容的 weblogic.xml 文件: bea.com/ns/weblogic/weblogic-web-app"> true
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-01-13
  • 2020-07-02
  • 2017-09-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多