Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

移除 MybatisSqlSessionFactoryBean.java 中的 NestedIOException #4552

Closed
ruanych opened this issue Jun 1, 2022 · 5 comments · Fixed by #4870
Closed

移除 MybatisSqlSessionFactoryBean.java 中的 NestedIOException #4552

ruanych opened this issue Jun 1, 2022 · 5 comments · Fixed by #4870

Comments

@ruanych
Copy link

ruanych commented Jun 1, 2022

在新版本的 Spring 以及 Mybatis-Spring 中,NestedIOException 已被移除,直接使用 IOException 替代,见 mybatis/spring#663

请问mybatis-plus 将会计划在何时兼容这一举措呢?

@miemieYaho
Copy link
Member

等myabtis-soring发新版后并且我们有发版计划的时候

@MQPearth
Copy link

等myabtis-soring发新版后并且我们有发版计划的时候

不能先发个SNAPSHOT吗

@FirokOtaku
Copy link

项目在新环境拉取了一遍依赖, 已经开始爆炸了 🎉

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.0.0-M4</version>
    <relativePath/>
</parent>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    <version>3.5.2</version>
</dependency>
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: org/springframework/core/NestedIOException
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:161) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:629) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]
	... 72 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/NestedIOException
	at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration.sqlSessionFactory(MybatisPlusAutoConfiguration.java:163) ~[mybatis-plus-boot-starter-3.5.2.jar:3.5.2]
	...
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:130) ~[spring-beans-6.0.0-M5.jar:6.0.0-M5]

@FirokOtaku
Copy link

项目在新环境拉取了一遍依赖, 已经开始爆炸了 🎉

可选方案之一是自己创建一个 org/springframework/core/NestedIOException 类,
把该继承的构造方法都写上. 参考 这里.

package org.springframework.core;

public class NestedIOException extends Exception
{
	public NestedIOException()
	{
		super();
	}

	public NestedIOException(String message)
	{
		super(message);
	}

	public NestedIOException(String message, Throwable cause)
	{
		super(message, cause);
	}

	public NestedIOException(Throwable cause)
	{
		super(cause);
	}

	protected NestedIOException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)
	{
		super(message, cause, enableSuppression, writableStackTrace);
	}
}

简单测试, 可以正常启动并使用各数据库 API.

@linghengqian
Copy link
Contributor

  • I am working on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants