Coder Social home page Coder Social logo

quarkus-mybatis's Introduction

Quarkus MyBatis Extension

Build License Central

All Contributors

MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. This extension provides the developers ease of configuration and native support. Add the following dependency in your pom.xml to get started,

<dependency>
    <groupId>io.quarkiverse.mybatis</groupId>
    <artifactId>quarkus-mybatis</artifactId>
</dependency>

And then your can use the @Mapper in your application just like

@Mapper
public interface UserMapper {

    @Select("SELECT * FROM USERS WHERE id = #{id}")
    User getUser(Integer id);

    @Insert("INSERT INTO USERS (id, name) VALUES (#{id}, #{name})")
    Integer createUser(@Param("id") Integer id, @Param("name") String name);

    @Delete("DELETE FROM USERS WHERE id = #{id}")
    Integer removeUser(Integer id);
}

For more information and quickstart, you can check the complete documentation.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Amos Feng

💻 🚧

Chao

💻

Viktor Ilvovskyi

💻

Igor Dmitriev

💻

Ken Brumer

💻

Zohar

🚧

bowen

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

quarkus-mybatis's People

Contributors

actions-user avatar allcontributors[bot] avatar andlvovsky avatar avano avatar dependabot[bot] avatar gastaldi avatar holly-cummins avatar kbrumer avatar ladicek avatar liloupar avatar maxandersen avatar quarkiversebot avatar y-bowen avatar zhfeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quarkus-mybatis's Issues

Two MyBatis SQL session factories created with XML config

When I enable XML config with those properties:

quarkus.mybatis.xmlconfig.enable=true
quarkus.mybatis.xmlconfig.path=mybatis/config.xml
quarkus.mybatis.environment=dev
quarkus.mybatis.auto-mapping-unknown-column-behavior=warning
quarkus.mybatis.map-underscore-to-camel-case=true
quarkus.mybatis.log-impl=org.apache.ibatis.logging.slf4j.Slf4jImpl

those two build steps are executed:
io.quarkiverse.mybatis.deployment.MyBatisProcessor#generateSqlSessionFactoryFromXmlConfig
io.quarkiverse.mybatis.deployment.MyBatisProcessor#generateSqlSessionFactory

and the application ends with two instances of org.apache.ibatis.session.Configuration and two instances of SQLSessionFactory; only the XML one is correctly configured, the other one has no mapped statements. It happens to be the one picked up by injection so I get "statement not bound" errors for all mapper methods.

io.quarkiverse.mybatis.runtime.MyBatisRecorder#createSqlSessionFactory called from generateSqlSessionFactory get a MyBatisruntimeConfig with xmlconfig.enabled = true, but it ignores that and doesn't load the XML.

Here are the stack traces for the two build steps:

Stack trace #1:


<init>:42, DefaultSqlSessionFactory (org.apache.ibatis.session.defaults)
build:92, SqlSessionFactoryBuilder (org.apache.ibatis.session)
createSqlSessionFactory:65, MyBatisRecorder (io.quarkiverse.mybatis.runtime)
deploy_0:-1, MyBatisProcessor$generateSqlSessionFactoryFromXmlConfig283316845 (io.quarkus.deployment.steps)
deploy:-1, MyBatisProcessor$generateSqlSessionFactoryFromXmlConfig283316845 (io.quarkus.deployment.steps)
<clinit>:-1, ApplicationImpl (io.quarkus.runner)
forName0:-1, Class (java.lang)
forName:488, Class (java.lang)
forName:467, Class (java.lang)
run:221, StartupActionImpl (io.quarkus.runner.bootstrap)
doJavaStart:250, QuarkusTestExtension (io.quarkus.test.junit)
ensureStarted:609, QuarkusTestExtension (io.quarkus.test.junit)
beforeAll:647, QuarkusTestExtension (io.quarkus.test.junit)
lambda$invokeBeforeAllCallbacks$10:381, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
execute:-1, ClassBasedTestDescriptor$$Lambda$339/0x0000000800cb7010 (org.junit.jupiter.engine.descriptor)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
invokeBeforeAllCallbacks:381, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
before:205, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
before:80, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
lambda$executeRecursively$6:148, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$288/0x0000000800ca7ad8 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, NodeTestTask$$Lambda$287/0x0000000800ca7630 (org.junit.platform.engine.support.hierarchical)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$286/0x0000000800ca7238 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
accept:-1, SameThreadHierarchicalTestExecutorService$$Lambda$292/0x0000000800ca5b90 (org.junit.platform.engine.support.hierarchical)
forEach:1511, ArrayList (java.util)
invokeAll:41, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$6:155, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$288/0x0000000800ca7ad8 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, NodeTestTask$$Lambda$287/0x0000000800ca7630 (org.junit.platform.engine.support.hierarchical)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$286/0x0000000800ca7238 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
submit:35, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
execute:57, HierarchicalTestExecutor (org.junit.platform.engine.support.hierarchical)
execute:54, HierarchicalTestEngine (org.junit.platform.engine.support.hierarchical)
execute:107, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:88, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
lambda$execute$0:54, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
accept:-1, EngineExecutionOrchestrator$$Lambda$236/0x0000000800c91740 (org.junit.platform.launcher.core)
withInterceptedStreams:67, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:52, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:114, DefaultLauncher (org.junit.platform.launcher.core)
execute:86, DefaultLauncher (org.junit.platform.launcher.core)
execute:86, DefaultLauncherSession$DelegatingLauncher (org.junit.platform.launcher.core)
execute:53, SessionPerRequestLauncher (org.junit.platform.launcher.core)
startRunnerWithArgs:71, JUnit5IdeaTestRunner (com.intellij.junit5)
execute:38, IdeaTestRunner$Repeater$1 (com.intellij.rt.junit)
repeat:11, TestsRepeater (com.intellij.rt.execution.junit)
startRunnerWithArgs:35, IdeaTestRunner$Repeater (com.intellij.rt.junit)
prepareStreamsAndStart:235, JUnitStarter (com.intellij.rt.junit)
main:54, JUnitStarter (com.intellij.rt.junit)

Stack trace #2


<init>:42, DefaultSqlSessionFactory (org.apache.ibatis.session.defaults)
build:92, SqlSessionFactoryBuilder (org.apache.ibatis.session)
createSqlSessionFactory:85, MyBatisRecorder (io.quarkiverse.mybatis.runtime)
deploy_0:-1, MyBatisProcessor$generateSqlSessionFactory1685105135 (io.quarkus.deployment.steps)
deploy:-1, MyBatisProcessor$generateSqlSessionFactory1685105135 (io.quarkus.deployment.steps)
<clinit>:-1, ApplicationImpl (io.quarkus.runner)
forName0:-1, Class (java.lang)
forName:488, Class (java.lang)
forName:467, Class (java.lang)
run:221, StartupActionImpl (io.quarkus.runner.bootstrap)
doJavaStart:250, QuarkusTestExtension (io.quarkus.test.junit)
ensureStarted:609, QuarkusTestExtension (io.quarkus.test.junit)
beforeAll:647, QuarkusTestExtension (io.quarkus.test.junit)
lambda$invokeBeforeAllCallbacks$10:381, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
execute:-1, ClassBasedTestDescriptor$$Lambda$339/0x0000000800cb7010 (org.junit.jupiter.engine.descriptor)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
invokeBeforeAllCallbacks:381, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
before:205, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
before:80, ClassBasedTestDescriptor (org.junit.jupiter.engine.descriptor)
lambda$executeRecursively$6:148, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$288/0x0000000800ca7ad8 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, NodeTestTask$$Lambda$287/0x0000000800ca7630 (org.junit.platform.engine.support.hierarchical)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$286/0x0000000800ca7238 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
accept:-1, SameThreadHierarchicalTestExecutorService$$Lambda$292/0x0000000800ca5b90 (org.junit.platform.engine.support.hierarchical)
forEach:1511, ArrayList (java.util)
invokeAll:41, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$6:155, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$288/0x0000000800ca7ad8 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$8:141, NodeTestTask (org.junit.platform.engine.support.hierarchical)
invoke:-1, NodeTestTask$$Lambda$287/0x0000000800ca7630 (org.junit.platform.engine.support.hierarchical)
around:137, Node (org.junit.platform.engine.support.hierarchical)
lambda$executeRecursively$9:139, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:-1, NodeTestTask$$Lambda$286/0x0000000800ca7238 (org.junit.platform.engine.support.hierarchical)
execute:73, ThrowableCollector (org.junit.platform.engine.support.hierarchical)
executeRecursively:138, NodeTestTask (org.junit.platform.engine.support.hierarchical)
execute:95, NodeTestTask (org.junit.platform.engine.support.hierarchical)
submit:35, SameThreadHierarchicalTestExecutorService (org.junit.platform.engine.support.hierarchical)
execute:57, HierarchicalTestExecutor (org.junit.platform.engine.support.hierarchical)
execute:54, HierarchicalTestEngine (org.junit.platform.engine.support.hierarchical)
execute:107, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:88, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
lambda$execute$0:54, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
accept:-1, EngineExecutionOrchestrator$$Lambda$236/0x0000000800c91740 (org.junit.platform.launcher.core)
withInterceptedStreams:67, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:52, EngineExecutionOrchestrator (org.junit.platform.launcher.core)
execute:114, DefaultLauncher (org.junit.platform.launcher.core)
execute:86, DefaultLauncher (org.junit.platform.launcher.core)
execute:86, DefaultLauncherSession$DelegatingLauncher (org.junit.platform.launcher.core)
execute:53, SessionPerRequestLauncher (org.junit.platform.launcher.core)
startRunnerWithArgs:71, JUnit5IdeaTestRunner (com.intellij.junit5)
execute:38, IdeaTestRunner$Repeater$1 (com.intellij.rt.junit)
repeat:11, TestsRepeater (com.intellij.rt.execution.junit)
startRunnerWithArgs:35, IdeaTestRunner$Repeater (com.intellij.rt.junit)
prepareStreamsAndStart:235, JUnitStarter (com.intellij.rt.junit)
main:54, JUnitStarter (com.intellij.rt.junit)

Is it possible to register dtd resource files in quarkus-mybatis

For example, under issue #85, when the server cannot access the Internet, it may still not work. I think the following two files can be registered by quarkus-mybatis to solve this problem.

  • org/apache/ibatis/builder/xml/mybatis-3-config.dtd
  • org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd

The relevant code here is in org.apache.ibatis.builder.xml.XMLMapperEntityResolver . Maybe in the future, GraalVM can recognize and register it.

Error: ... because 'http' access is not allowed due to restriction set by the accessExternalDTD property

Hello,
I'm tring to use mybatis in a Quarkus project built in native mode. When I load an xml mapping file, the following errore is raised:

org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 108; External DTD: Failed to read external DTD 'mybatis-3 -mapper.dtd', because 'http' access is not allowed due to restriction set by the accessExternalDTD property.
  at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:263)                                                                                                                               
  at org.apache.ibatis.parsing.XPathParser.(XPathParser.java:127)                                                                                                                                       
  at org.apache.ibatis.builder.xml.XMLMapperBuilder.(XMLMapperBuilder.java:81)

The code snippet that I use to load the mapping file is:

Configuration configuration = new Configuration();
String mapperResourceName = "mybatis/test.xml";
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(mapperResourceName);
XMLMapperBuilder mapperParser = new XMLMapperBuilder(inputStream, configuration, mapperResourceName,
						configuration.getSqlFragments());
mapperParser.parse();
MappedStatement  mappedStatement = configuration.getMappedStatement("test");
BoundSql boundSql = mappedStatement.getBoundSql(params);

while the mapper file is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">

<mapper namespace="Test">
    <select id="test" >
        SELECT t
        FROM Test t
    </select>
</mapper>

I have already tried to add

<quarkus.native.additional-build-args>-J-Djavax.xml.accessExternalDTD=all</quarkus.native.additional-build-args>

without success.

分页返回数据不对

@path("/user/page/{page}/{pageSize}")
@get
public Page list(@PathParam("page") Integer page,@PathParam("pageSize") Integer pageSize) {
return userMapper.selectPage(new Page<>(page, pageSize), null);
}

版本最新的1.0.0 quarkus-mybatis-plus
分页返回数据错误

Get the dataSource from the Container

Currently we are using Datasouces.from(name) to get the dataSource by Agroal. It needs to change to use ArcContainer to get the data source while some other extension (such sharding-sphere-jdbc ) could produce the dataSource in different way. So it should be get them from the quarkus container.

Add support for MappedTypes and MappedJdbcTypes

It is very useful to have MappedTypes if you work at all with UUIDs. This could be added I think in a simlar way to how Mappers work now - look for any class with an annotation of MappedTypes (or MappedJdbcTypes) and then add them to the configuration.

I'd be more than happy to try and take a first pass at it if someone would point me in the right direction.

Thanks!

Improve datasoruce configuration in mybatis-config.xml

Currently we have to use @DataSourceMapper("xmlconfig") when using the mybatis xml configuration. see #114 #145 and it could make some inconveniences.

I'm thinking to introduce quarkus.mybatis.xmlconfig.datasource to specify the datasource using in the xml configuration,

@Select annotation backfill. If the query field is not consistent with the entity field, it will not be backfilled. I don't know whether it can be optimized

Using the @select annotation, it is found that the select field part must be consistent with the field name of the entity in order to backfill normally. I don't know whether there is any means to define it. In this way, when subqueries are performed, the entity field can be backfilled with select * or select database fields

使用 @select 注解,发现 select 字段部分必须跟 实体的 字段名一致才能正常回填,不知道是否有什么手段可以定义,这样子查询的时候,就可以使用 select * 或 select 数据库字段 回填实体字段

Define table City object
定义表 City 对象

@Data
@TableName("city")
public class City implements Serializable {
    @TableField(value = "city_id")
    private String cityId;
    @TableField(value = "city_name")
    private String cityName;
    @TableField(value = "region_id")
    private Integer regionId;

Define CityMapper
定义 CityMapper

@Mapper
@MapperDataSource("<default>")
public interface CityMapper extends BaseMapper<City> {

    // Cityname can be backfilled normally, city_ ID cannot be backfilled to cityid
    // cityName 可以正常回填, city_id 无法回填到 cityId
    @Select("SELECT city_name cityName,city_id FROM city WHERE region_id = #{id} limit 1")
    City getCity(Integer id); // <1>
}

Define XML mapper mapping file
定义xml Mapper映射文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.edb.qarkus.demo.mapper.CityMapper">
    <resultMap id="BaseResultMap" type="com.edb.qarkus.demo.mapper.City">
        <id column="city_id" jdbcType="CHAR" property="cityId" />
        <result column="city_name" jdbcType="VARCHAR" property="cityName" />
        <result column="region_id" jdbcType="INTEGER" property="regionId" />
    </resultMap>
    <select id="findById" parameterType="int" resultMap="BaseResultMap">
        select * from city where region_id=#{id} limit 1
    </select>
</mapper>

When we call citymapper When getcity (1), you will find city Cityname has value, but city Cityid is not assigned, because there is no field name converted to cityid during select query, but I don't know if this is a bug? Or does it have to be set like this
If you can, I hope to provide a way to obtain field mapping from XML (normally, it already exists in the XML file of mabytis, and it should be able to backfill normally) or an annotation method of field mapping to achieve the effect of field consistency

当我们调用 CityMapper.getCity(1) 时,会发现 City.cityName 有值,但是 City.cityId 没有赋值,原因是 select 查询的时候,没有转换成cityId 的字段名,但我并不知道这个是不是bug? 还是说必须这么设置
可以的话,希望可以提供一个从xml获取字段映射(正常来说mabytis的xml文件里已经有了,应该能正常回填才对) 或 提供一个字段映射的注解方式,达到字段一致的效果

Add XMLConfigBuilderBuildItem

It needs to add this BuildItem for mybatis-plus to override it. And it could be used in createSqlSessionFactory with MyBatisRuntimeConfig

No constructor found

The JVM is running without problems. Native will report an error

Caused by: org.apache.ibatis.executor.ExecutorException: No constructor found in com.xx.model.User matching [java.lang.Integer, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.sql.Timestamp, java.sql.Timestamp, java.sql.Timestamp]
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createByConstructorSignature(DefaultResultSetHandler.java:701)
at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.createResultObject(DefaultResultSetHandler.java:657)

I added a default constructor and a full-parameter constructor to my model, but it still doesn't work. The parameter type configuration matches the one printed by the exception. I don't know why

public User() {
}

public User(Integer id, String username, String nickname, String password, String mobile, Integer status, Timestamp createTime, Timestamp updateTime, Timestamp lastLoginTime) {
this.id = id;
this.username = username;
this.nickname = nickname;
this.password = password;
this.mobile = mobile;
this.status = status;
this.createTime = createTime;
this.updateTime = updateTime;
this.lastLoginTime = lastLoginTime;
}

Finally, does this library run on JVM only, or can it be called native? Is there any configuration required for native?

How to set global Camel-Case with quarkus-mybatis-plus?

pom.xml

        <dependency>
            <groupId>io.quarkiverse.mybatis</groupId>
            <artifactId>quarkus-mybatis-plus</artifactId>
        </dependency>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-jdbc-mysql</artifactId>
        </dependency>

in springBoot ,it default enabled, but quarkus ,i must be use @TableField("nick_name") every column

Type Aliases problem since 0.0.8

Issue

I use an XML configuration for type aliases like so :

    <typeAliases>
        <package name="org.acme.entity"/>
    </typeAliases>
    ...
    <mappers>
        <package name="org.acme.mapper"/>
    </mappers>

The problem is that since version 0.0.8 or more specifically commit 5517c67, this error occur during startup :

Failed to start quarkus: java.lang.RuntimeException: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'org/acme/mapper/MyMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'MyEntity'.  Cause: java.lang.ClassNotFoundException: Cannot find class: MyEntity
	at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51)
	at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:109)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:225)
	at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:206)
	at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:484)
	at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:389)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:64)
	at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:54)
	at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:160)
	at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:96)
	at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:158)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1450)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'org/acme/mapper/MyMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'MyEntity'.  Cause: java.lang.ClassNotFoundException: Cannot find class: MyEntity
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:179)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:118)
	at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
	at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:841)
	at io.quarkiverse.mybatis.runtime.MyBatisRecorder.addMappers(MyBatisRecorder.java:96)
	at io.quarkiverse.mybatis.runtime.MyBatisRecorder.createSqlSessionFactory(MyBatisRecorder.java:70)
	at io.quarkus.deployment.steps.MyBatisProcessor$generateSqlSessionFactory-687538554.deploy_0(MyBatisProcessor$generateSqlSessionFactory-687538554.zig:158)
	at io.quarkus.deployment.steps.MyBatisProcessor$generateSqlSessionFactory-687538554.deploy(MyBatisProcessor$generateSqlSessionFactory-687538554.zig:40)
	at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:260)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.lang.Class.newInstance(Class.java:584)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:65)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:98)
	... 1 more
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'MyEntity'.  Cause: java.lang.ClassNotFoundException: Cannot find class: MyEntity
	at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
	at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:102)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:138)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:131)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:121)
	... 25 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'MyEntity'.  Cause: java.lang.ClassNotFoundException: Cannot find class: MyEntity
	at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120)
	at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149)
	at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116)
	... 29 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: MyEntity
	at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:196)
	at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89)
	at org.apache.ibatis.io.Resources.classForName(Resources.java:261)
	at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116)
	... 31 more

Redacted stacktrace

The error stems from this MyBatisRecorder.createSqlSessionFactory, because it tries to resolve aliases when parsing XML mappers, but this configuration is unaware of the mybatis-config.xml and therefore doesn't know about type aliases packages.

It should be possible to reproduce this issue by using XML based configuration and using an XML mapper that includes a custom type alias :

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.acme.mapper.MyMapper">
    <select id="select" resultType="MyEntity"/>
</mapper>

The root cause seems to be that MyBatisProcessor calls createSqlSessionFactory for each datasource wihtout testing if XML configuration is enabled.

Seems like not support the dynamic sql while running native?

If i want to use annotation like @SelectProvider . It can successfully running in jvm,but running native i get Error like this:

java.lang.NoSuchMethodException: org.apache.ibatis.annotations.SelectProvider.type()
	at java.lang.Class.getMethod(DynamicHub.java:1089)
	at org.apache.ibatis.builder.annotation.ProviderSqlSource.getProviderType(ProviderSqlSource.java:240)
	at org.apache.ibatis.builder.annotation.ProviderSqlSource.<init>(ProviderSqlSource.java:103)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.buildSqlSource(MapperAnnotationBuilder.java:630)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.lambda$parseStatement$2(MapperAnnotationBuilder.java:301)
	at java.util.Optional.ifPresent(Optional.java:183)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parseStatement(MapperAnnotationBuilder.java:300)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:132)
	at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
	at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:841)
	at io.quarkiverse.mybatis.runtime.MyBatisRecorder.createSqlSessionFactory(MyBatisRecorder.java:52)
	at io.quarkus.deployment.steps.MyBatisProcessor$generateSqlSessionFactory112247604.deploy_0(MyBatisProcessor$generateSqlSessionFactory112247604.zig:100)
	at io.quarkus.deployment.steps.MyBatisProcessor$generateSqlSessionFactory112247604.deploy(MyBatisProcessor$generateSqlSessionFactory112247604.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:631)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)

Are there any solutions to this problem?

Add our own GenericTypeReslover

When upgrading to mybatis-plus 3.4.3.3, we should implement our own GenericTypeResolver to avoid depending on the spring one.

Lambda writeReplace function error.

com.baomidou.mybatisplus.core.toolkit.LambdaUtils

/**
     * 该缓存可能会在任意不定的时间被清除
     *
     * @param func 需要解析的 lambda 对象
     * @param <T>  类型,被调用的 Function 对象的目标类型
     * @return 返回解析后的结果
     */
    public static <T> LambdaMeta extract(SFunction<T, ?> func) {
        // 1. IDEA 调试模式下 lambda 表达式是一个代理
        if (func instanceof Proxy) {
            return new IdeaProxyLambdaMeta((Proxy) func);
        }
        // 2. 反射读取
        try {
            Method method = func.getClass().getDeclaredMethod("writeReplace");
            return new ReflectLambdaMeta((SerializedLambda) ReflectionKit.setAccessible(method).invoke(func));
        } catch (Throwable e) {
            // 3. 反射失败使用序列化的方式读取
            return new ShadowLambdaMeta(com.baomidou.mybatisplus.core.toolkit.support.SerializedLambda.extract(func));
        }
    }

在使用queryWrapper的时候这里报错没? 这里好像会报错spring native 和 mp 集成时.

Failed with native build

./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true -Dquarkus.native.additional-build-args='--report-unsupported-elements-at-runtime'
[quarkus-lambda-play-1.0.0-SNAPSHOT-runner:25]    classlist:   8,164.89 ms,  0.93 GB
[quarkus-lambda-play-1.0.0-SNAPSHOT-runner:25]        setup:     613.31 ms,  0.93 GB
Fatal error:java.lang.NoClassDefFoundError
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
        at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:481)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:350)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:509)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:541)
Caused by: java.lang.NoClassDefFoundError: com/sun/jna/LastErrorException
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
        at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleDeletedClass(AnnotationSubstitutionProcessor.java:512)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:305)
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:265)
        at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:919)
        at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:853)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:554)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:469)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Error: Image build request failed with exit status 1

> Task :quarkusBuild FAILED
:quarkusBuild (Thread[Execution worker for ':' Thread 5,5,main]) completed. Took 17.315 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:303)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:829)
        at org.jboss.threads.JBossThread.run(JBossThread.java:501)
  Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:570)
        at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:269)
        ... 10 more


xml configure problem

Inject failed when I used xml to configure Mapper,Can you help me look at this problem

xml :
<configuration> <environments default="development"> <environment id="development"> <transactionManager type="JDBC"/> <dataSource type="QUARKUS"> </dataSource> </environment> </environments> <mappers> <mapper resource="mapper/TaskMapper.xml"/> </mappers> </configuration>

code:

@Inject
TaskMapper taskMapper;

Update the README

It should be better to update the README doc to provide more information about the project.

Investigate the SerializedCahce in Native image

Since the GraalVM 21.x added serialization support for Native Image, I think it need to investigate how this could affect the MyBatis SerializedCache usage. Currently we suppose to ```@CacheNamesapce(readWrite=false) must be used in the native image.

Build fails with the lastest quarkus

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.1.0 Java 11 CE (Java Version 11.0.11+8-jvmci-21.1-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker run --env LANG=C --rm --user 1001:121 -v /home/runner/work/quarkus-mybatis/quarkus-mybatis/current-repo/integration-tests/target/quarkus-mybatis-integration-tests-0.0.8-SNAPSHOT-native-image-source-jar:/project:z quay.io/quarkus/ubi-quarkus-native-image:21.1-java11 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country= -J-Dfile.encoding=UTF-8 --report-unsupported-elements-at-runtime --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar quarkus-mybatis-integration-tests-0.0.8-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-mybatis-integration-tests-0.0.8-SNAPSHOT-runner
[quarkus-mybatis-integration-tests-0.0.8-SNAPSHOT-runner:28]    classlist:   6,877.64 ms,  1.19 GB
[quarkus-mybatis-integration-tests-0.0.8-SNAPSHOT-runner:28]        setup:     712.44 ms,  1.19 GB
Fatal error:java.lang.NoClassDefFoundError
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
	at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:499)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:370)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:531)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:568)
Caused by: java.lang.NoClassDefFoundError: Lcom/aayushatharva/brotli4j/decoder/DecoderJNI$Wrapper;
	at java.base/java.lang.Class.getDeclaredFields0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3061)
	at java.base/java.lang.Class.getDeclaredFields(Class.java:2248)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleDeletedClass(AnnotationSubstitutionProcessor.java:531)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:306)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:266)
	at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:954)
	at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:888)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:580)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.ClassNotFoundException: com.aayushatharva.brotli4j.decoder.DecoderJNI$Wrapper
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	... 16 more
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Quarkus - Mybatis - Parent 0.0.8-SNAPSHOT:
[INFO] 
[INFO] Quarkus - Mybatis - Parent ......................... SUCCESS [  2.999 s]
[INFO] Quarkus - Mybatis - Runtime ........................ SUCCESS [  6.893 s]
[INFO] Quarkus - Mybatis - Deployment ..................... SUCCESS [ 10.933 s]
[INFO] Quarkus - MyBatis - Documentation .................. SUCCESS [ 13.071 s]
[INFO] Quarkus - MyBatis - Integration Tests .............. FAILURE [ 52.990 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

It needs to check with GraalVM 21.1.0

more detail should be https://github.com/quarkiverse/quarkus-mybatis/actions/workflows/quarkus-snapshot.yaml

Investigate to remove the --report-unsupported-elements-at-runtime in native mode

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.1.0 Java 11 CE (Java Version 11.0.11+8-jvmci-21.1-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker run --env LANG=C --rm --user 1000:1000 -v /home/zhfeng/work/zhfeng/quarkiverse-mybatis/integration-tests/target/quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-native-image-source-jar:/project:z quay.io/quarkus/ubi-quarkus-native-image:21.1-java11 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=zh -J-Duser.country=CN -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-runner
[quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-runner:24]    classlist:   3,811.26 ms,  0.93 GB
[quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-runner:24]        (cap):     614.81 ms,  0.93 GB
[quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-runner:24]        setup:   2,597.72 ms,  0.93 GB
05:00:45,896 INFO  [org.jbo.threads] JBoss Threads version 3.4.0.Final
[quarkus-mybatis-integration-tests-0.0.10-SNAPSHOT-runner:24]     analysis:  27,040.59 ms,  2.74 GB
Fatal error:com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.oracle.svm.reflect.Class_getEnclosingMethod0_8a7a0562f19e413046b2404928996c9b00e4e19e.invoke(java.lang.Object, java.lang.Object[]) 
Parsing context:
	parsing java.lang.reflect.Method.invoke(Method.java:566)
	parsing javax.enterprise.util.AnnotationLiteral.invoke(AnnotationLiteral.java:288)
	parsing javax.enterprise.util.AnnotationLiteral.getMemberValue(AnnotationLiteral.java:276)
	parsing javax.enterprise.util.AnnotationLiteral.hashCode(AnnotationLiteral.java:246)
	parsing java.lang.Object.toString(Object.java:246)
	parsing java.lang.String.valueOf(String.java:2951)
	parsing java.lang.StringBuilder.append(StringBuilder.java:168)
	parsing java.lang.Throwable.printStackTrace(Throwable.java:662)
	parsing java.lang.Throwable.printStackTrace(Throwable.java:648)
	parsing java.lang.Throwable.printStackTrace(Throwable.java:639)
	parsing com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:778)
	parsing com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

	at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:331)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureTypeFlowCreated(MethodTypeFlow.java:302)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
	at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:227)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:470)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:542)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:547)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getEnclosingMethod0() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:188)
	at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
	at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:140)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:409)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:389)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:77)
	at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
	at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
	at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:39)
	at com.oracle.svm.reflect.hosted.ReflectionSubstitutionType$ReflectiveInvokeMethod.buildGraph(ReflectionSubstitutionType.java:586)
	at com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:320)
	at com.oracle.graal.pointsto.flow.AnalysisParsedGraph.parseBytecode(AnalysisParsedGraph.java:78)
	at com.oracle.svm.hosted.SVMHost.parseBytecode(SVMHost.java:647)
	at com.oracle.graal.pointsto.meta.AnalysisMethod.ensureGraphParsed(AnalysisMethod.java:592)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:163)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:304)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.createTypeFlow(MethodTypeFlow.java:313)
	... 13 more
Error: Image build request failed with exit status 1

mvn package error

I just introduce a dependency and the compilation will fail, and it's important to me what configuration I need to do to compile

./mvnw clean package -Dmaven.test.skip=true -Dnative  

pom.xml

<properties>
    <surefire-plugin.version>2.22.1</surefire-plugin.version>
    <maven.compiler.target>11</maven.compiler.target>
    <quarkus.platform.version>1.10.5.Final</quarkus.platform.version>
    <maven.compiler.source>11</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <maven.compiler.parameters>true</maven.compiler.parameters>
    <quarkus-plugin.version>1.10.5.Final</quarkus-plugin.version>
    <compiler-plugin.version>3.8.1</compiler-plugin.version>
    <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
  </properties>
Fatal error:com.oracle.graal.pointsto.util.AnalysisError$ParsingError: Error encountered while parsing com.oracle.svm.reflect.Class_getEnclosingMethod0_8a7a0562f19e413046b2404928996c9b00e4e19e.invoke(java.lang.Object, java.lang.Object[]) 
Parsing context:
        parsing java.lang.reflect.Method.invoke(Method.java:566)
        parsing io.quarkus.arc.impl.Qualifiers.invoke(Qualifiers.java:100)
        parsing io.quarkus.arc.impl.Qualifiers.hasQualifier(Qualifiers.java:61)
        parsing io.quarkus.arc.impl.Qualifiers.hasQualifiers(Qualifiers.java:38)
        parsing io.quarkus.arc.impl.ArcContainerImpl.matches(ArcContainerImpl.java:755)
        parsing io.quarkus.arc.impl.ArcContainerImpl.getMatchingBeans(ArcContainerImpl.java:627)
        parsing io.quarkus.arc.impl.ArcContainerImpl.getBeans(ArcContainerImpl.java:468)
        parsing io.quarkus.arc.impl.BeanManagerImpl.getBeans(BeanManagerImpl.java:95)
        parsing io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:102)
        parsing io.quarkus.runtime.Quarkus.run(Quarkus.java:62)
        parsing io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
        parsing io.quarkus.runtime.Quarkus.run(Quarkus.java:104)
        parsing io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
        parsing com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:149)
        parsing com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:184)
        parsing com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

        at com.oracle.graal.pointsto.util.AnalysisError.parsingError(AnalysisError.java:138)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:331)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:302)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
        at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:227)
        at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:470)
        at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:542)
        at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:552)
        at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.Class.getEnclosingMethod0() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
        at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:183)
        at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
        at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:128)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:404)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:384)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookup(AnalysisUniverse.java:76)
        at com.oracle.graal.pointsto.infrastructure.UniverseMetaAccess.lookupJavaMethod(UniverseMetaAccess.java:93)
        at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:66)
        at com.oracle.graal.pointsto.meta.AnalysisMetaAccess.lookupJavaMethod(AnalysisMetaAccess.java:39)
        at com.oracle.svm.reflect.hosted.ReflectionSubstitutionType$ReflectiveInvokeMethod.buildGraph(ReflectionSubstitutionType.java:536)
        at com.oracle.graal.pointsto.meta.AnalysisMethod.buildGraph(AnalysisMethod.java:333)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:187)
        at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:357)
        at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:313)
        ... 13 more
Error: Image build request failed with exit status 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.