Tag Archives: xml

[Solved] Spring set xml Component Scanning error: Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException…

Spring set xml Component Scanning error

Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 9 in XML document from class path resource [applicationConfig.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 62; cvc-complex-type.2.4.c: The wildcard match is comprehensive, but the declaration of the element ‘context:component-scan’ cannot be found.

Reason:
applicationConfig configurate schemaLocation error:

Solution:

Done!!!

[Solved] nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter

Error: javax/xml/bind/DatatypeConverter

Error content

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  at

Error reporting reason:

JAXB API is an API for java EE and this Jar package is no longer included in java SE 9.0.
By default, the Jar package for java EE will no longer be included in Java SE
In JDK 6/7/8 about this API are bundled together.

Solutioin:

Method I:

Downgrade the version of JDK to JDK 8

Method II:

The following parts are introduced into the dependencies of the pom.xml file:

<dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>

[Solved] Manifest merger failed with multiple errors, see logs

Manifest merge failed with multiple errors, see logs solution

In component-based development, when testing a single component, such problems sometimes occur in compilation


Simulate with my project:

The current test is lib_news
lib_news requires webView of lib_web

lib_news build gradle

if (isRelease) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}

apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android{
	……
	defaultConfig {
       ……
        kapt {
            arguments {
                arg("AROUTER_MODULE_NAME", project.getName())
            }
        }
        buildConfigField("boolean", "isRelease", String.valueOf(isRelease))

    }
	sourceSets{
        main {
            if (isRelease) {
                //if library,then compile AndroidManifest.xml in manifest
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                //if application, then compile theAndroidManifest.xml in the home directory.
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
    ……
	dependencies{
		……
		implementation project(path: ':lib_web') //import lib_web
	}
	
}

project config.gradle

ext{
    isRelease = false
    //isUseWeb = true Comment first, the general configuration file is only configured with isRelease
	……
}

lib_web build.gradle

if (isRelease) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}

apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'

android{
	……
	defaultConfig {
       ……
        kapt {
            arguments {
                arg("AROUTER_MODULE_NAME", project.getName())
            }
        }
        buildConfigField("boolean", "isRelease", String.valueOf(isRelease))

    }
	sourceSets{
        main {
            if (isRelease) {
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
    ……
	dependencies{
		……
	}
	
}

In general, we only set isrelease to determine whether a single component test or integrated compilation
so the test lib_news, directly change isrelease to false, and also lib_web will also become Application, which is equivalent to us in lib_news importing Application instead of Library, will involve the problem of  androidmanifest.xml

Show me androidmanifest.xml
lib_web component mode
Lib_ Web integration mode


Solution:

project config.gradle
add a isuseweb to identify the lib_web to be used in the componentization mode

ext{
    isRelease = false
    isUseWeb = true 
	……
}

Modify lib_webbuild.gradle

if (isUseWeb) {
    apply plugin: 'com.android.library'
} else {
    apply plugin: 'com.android.application'
}
android {
	……
	defaultConfig {
		……
		buildConfigField("boolean", "isUseWeb", String.valueOf(isUseWeb))
	}
	……
	sourceSets{
        main {
            if (isUseWeb) {
                manifest.srcFile 'src/main/manifest/AndroidManifest.xml'
            } else {
                manifest.srcFile 'src/main/AndroidManifest.xml'
            }
        }
    }
	
}

Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber

Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 5; 1-byte UTF-8 sequence of byte 1 is invalid.

Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 5; 1 byte of UTF-8 sequence byte 1 Invalid. SAXParseException; lineNumber: 5; columnNumber: 5; 1 byte of UTF-8 sequence with byte 1 invalid.
The specific error is as follows:

org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in com/kuang/mapper/UserMapper.java (best guess)
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 5; 1 字节的 UTF-8 序列的字节 1 无效。

	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
	at MyTest.test(MyTest.java:18)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 5; 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:122)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:99)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)
	... 24 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 5; 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:263)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:127)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:81)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:76)
	at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.loadXmlResource(MapperAnnotationBuilder.java:178)
	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 org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:388)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:120)
	... 26 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 5; 1 字节的 UTF-8 序列的字节 1 无效。
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1029)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:507)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:867)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:796)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:142)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:247)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:261)
	... 35 more
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702)
	at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:568)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1895)
	at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1375)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:801)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1036)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:914)
	... 43 more

The final solution is to transfer all configuration files in mybatis from

<?xml version="1.0" encoding="UTF-8" ?>

to

<?xml version="1.0" encoding="UTF8" ?>

[Solved] Error building SqlSession. ### The error may exist in com/itrs/mapper/OrderMapper.xml

Error reporting information

org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in com/itrs/mapper/OrderMapper.xml
### The error occurred while processing mapper_resultMap[orderMap]
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/itrs/mapper/OrderMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'order'.  Cause: java.lang.ClassNotFoundException: Cannot find class: order

	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
	at com.itrs.test.MybatisTest.test1(MybatisTest.java:33)
	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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/itrs/mapper/OrderMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'order'.  Cause: java.lang.ClassNotFoundException: Cannot find class: order
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:98)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)
	... 24 more
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'com/itrs/mapper/OrderMapper.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'order'.  Cause: java.lang.ClassNotFoundException: Cannot find class: order
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:122)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:94)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:374)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:119)
	... 26 more
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'order'.  Cause: java.lang.ClassNotFoundException: Cannot find class: order
	at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:262)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:253)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:245)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:118)
	... 29 more
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'order'.  Cause: java.lang.ClassNotFoundException: Cannot find class: order
	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)
	... 33 more
Caused by: java.lang.ClassNotFoundException: Cannot find class: order
	at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200)
	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)
	... 35 more

Problem Description:

Here are: error parsing SQL mapper configuration, error parsing mapper XML and type typeexception: unable to resolve type alias “order”.

Cause analysis:

Unable to resolve type name ‘ order ‘, please see

sqlMapConfig.xml. It is found that the custom name order is omitted

Solution:

<!--Add a custom name-->
    <typeAliases>
        <typeAlias type="com.itrs.domain.User" alias="user"></typeAlias>
        <typeAlias type="com.itrs.domain.Order" alias="order"></typeAlias>
    </typeAliases>

Add a custom name to solve the problem

### Error building SqlSession. ### The error may exist in com/itrs/mapper/UserMapper.xml ### Cause:

Project scenario:

Mybatis

Problem Description:

org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in com/itrs/mapper/UserMapper.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/itrs/mapper/UserMapper.xml

	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
	at com.itrs.test.MybatisTest.test1(MybatisTest.java:21)
	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 org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/itrs/mapper/UserMapper.xml
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:121)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:98)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:78)
	... 24 more
Caused by: java.io.IOException: Could not find resource com/itrs/mapper/UserMapper.xml
	at org.apache.ibatis.io.Resources.getResourceAsStream(Resources.java:114)
	at org.apache.ibatis.io.Resources.getResourceAsStream(Resources.java:100)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:372)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:119)
	... 26 more

Cause analysis:

it is the path problem.


Solution:

When creating files under resources, use the following methods to create files

Don’t write it as com.xx.mapper.xxxxx.xml

[Solved] ### Error building SqlSession. ### The error may exist in com/atguigu/dao/SysUserMapper.xml ### Caus

Error building SqlSession.
The error may exist in com/atguigu/dao/SysUserMapper.xml
Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/atguigu/dao/SysUserMapper.xml

In POM.XML:

<build>
    <!--Configure resources in build, to prevent our resource export from failing-->
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.properties</include>
                <include>**/*.xml</include>
            </includes>
            <filtering>true</filtering>
        </resource></resources>
</build>

[Solved] Could not identify launch activity: Default Activity not found Error while Launching activity

        <activity android:name=".ui.home.HomeActivity"
            android:configChanges="mcc|mnc"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.Preference.DayNight"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
<!--                <category android:name="android.intent.category.LAUNCHER" />-->
            </intent-filter>
        </activity>

The reason for this is that the < category > line was commented out in the entry activity. The default activity is not found,
Remove the comment and the problem is gone!

[Solved] Error while extracting response for type [] and content type []…

When resttemplate is used to request restful interface, the returned JSON data will always be parsed into XML data for processing under specific circumstances, and then the error in the title will appear:

Error while extracting response for type [] and content type [application/xml;charset=UTF-8]; nested exception is org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Unexpected character ‘5’ (code 53) in content after ‘<‘ (malformed start element?).
at [row,col {unknown-source}]: [1,15395]; nested exception is com. fasterxml. jackson. databind. JsonMappingException: Unexpected character ‘5’ (code 53) in content after ‘<‘ (malformed start element?).

According to the error information, it seems that the response header marks the return type as [application/XML; charset = UTF-8], but the actual situation is that all the returned data is [application/JSON; charset = UTF-8].

After tracing the resttemplate source code, it is found that the instance created by new resttemplate (httprequestfactory()) will have 7 Converters:

Continue to track the exchange of the resttemplate. When performing type conversion on the response, all converters in the current instance will be iterated, and then select a converter that supports the current type for execution. Use canread to judge:

At this time, the problem is found. Under certain circumstances, the contenttype of the response header is read as “application/XML”. However, the real data at this time is still in JSON format. Therefore, if the converter for XML format is deleted, the iterator will look for the next executable converter, mappingjackson2httpmessageconverter. Or change the order of the two to reduce the priority of XML.

Solution:

1: Delete XML converter

    @Bean
    public RestTemplate restTemplate() {
        RestTemplate template = new RestTemplate(httpRequestFactory());
        // Exclude xml parsing converters to avoid parsing json data as xml
        List<HttpMessageConverter<?>> collect = template.getMessageConverters().stream().filter(m -> !(m instanceof MappingJackson2XmlHttpMessageConverter)).collect(Collectors.toList());
        template.setMessageConverters(collect);
        return template;
    }

2: Reduce XML converter priority

    @Bean
    public RestTemplate restTemplate() {
        RestTemplate template = new RestTemplate(httpRequestFactory());
        // Turn down the priority of xml parsing
        int xml = 0, json = 0;
        List<HttpMessageConverter<?>> messageConverters = template.getMessageConverters();
        for (int i = 0; i < messageConverters.size(); i++) {
            HttpMessageConverter<?> h = messageConverters.get(i);
            if (h instanceof MappingJackson2XmlHttpMessageConverter) {
                xml = i;
            } else if (h instanceof MappingJackson2HttpMessageConverter) {
                json = i;
            }
        }
        Collections.swap(template.getMessageConverters(), xml, json);

        return template;
    }

IDEA pom.xml dependency version error [How to Solve]

Self problem solving record, tossed all morning and finally solved:

I tried other solutions first, but there was no response. You can still try:

1. Modify the Maven version number, download the old version again, configure the environment variables, and install cleanLastUpdated.bat small script to clear the package that has not been downloaded successfully/completely. It is useless

Share this script:

Copy to Notepad and save the file as cleanLastUpdated.bat, select the file format as all file formats.

set REPOSITORY_PATH=Absolute path to your own local repository
rem is searching...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*lastUpdated*"') do (
    del /s /q %%i
)
rem search completed
pause

2. Re-check other configurations in settings \ Maven and check these two again. It’s useless

3. Final solution

I went to the local warehouse and found that the jar package had been downloaded, but it was inconsistent with the version number that my pom.xml relied on, so the modification was over.