Tag Archives: maven

Process finished with exit code 0 error reporting solution

Step 1: when this problem occurs, first check the compiled target file generated by the project in the left navigation bar to see whether the file is compiled successfully

Step 2: click Maven on the right and double-click clean to clear the compiled files under the target file

Step 3: double click compile to recompile. After compilation, start again, and the project will run successfully

About the error of base64decoder reference in eclipse

Problems encountered:

        Pull Maven project from Git   The base64decoder import file appears   But it keeps reporting errors

Solution:

        After searching for a long time, the solution is probably

                1. Right click the project, build path – & gt; Config Build Path

                2. Select JRE system library to expand and select access rules: no rules define  

                 

                3. Click edit on the right  

                4. Click Add

                5. Modify as shown in the figure  

                6. Then OK   Then save the configuration (it is said on the Internet that it is OK to complete this step, but mine is not successful. Next, follow up operations)

                7. Right click item – & gt; MAVEN —> Update project…..

                Remember to add this item

                

        

If there are any questions     Take a look at the JDK version   A search found an article saying  

OK. My problem is solved~

Byte 1 of UTF-8 sequence of error creating document instance. And bytes is invalid

Records of mybatis related bugs

For mybatis learning, I encountered many inexplicable bugs from the beginning! After Baidu and barrage, they didn’t solve it. Later, they changed inexplicably, but they were right. First look at the bug:

"D:\SoftWare\Idea\IntelliJ IDEA 2020.3.2\jbr\bin\java.exe" -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:\SoftWare\Idea\IntelliJ IDEA 2020.3.2\lib\idea_rt.jar=54216:D:\SoftWare\Idea\IntelliJ IDEA 2020.3.2\bin" -Dfile.encoding=UTF-8 -classpath "D:\SoftWare\Idea\IntelliJ IDEA 2020.3.2\lib\idea_rt.jar;D:\SoftWare\Idea\IntelliJ IDEA 2020.3.2\plugins\junit\lib\junit5-rt.jar;D:\SoftWare\Idea\IntelliJ IDEA 2020.3.2\plugins\junit\lib\junit-rt.jar;D:\Desktop\MyBatis02\mybatis-02\target\test-classes;D:\Desktop\MyBatis02\mybatis-02\target\classes;D:\Environment\apache-maven-3.8.1\maven-repo\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar;D:\Environment\apache-maven-3.8.1\maven-repo\org\mybatis\mybatis\3.5.2\mybatis-3.5.2.jar;D:\Environment\apache-maven-3.8.1\maven-repo\junit\junit\4.13.2\junit-4.13.2.jar;D:\Environment\apache-maven-3.8.1\maven-repo\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.lxz.dao.UserDaoTest,getUserLike

java.lang.ExceptionInInitializerError
	at com.lxz.dao.UserDaoTest.getUserLike(UserDaoTest.java:14)
	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:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	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.exceptions.PersistenceException: 
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 9; 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 com.lxz.utils.MybatisUtils.<clinit>(MybatisUtils.java:21)
	... 26 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 9; 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:260)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:126)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:81)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:77)
	... 28 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 9; 1 字节的 UTF-8 序列的字节 1 无效。
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3085)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:258)
	... 31 more
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702)
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:568)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1904)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1377)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:800)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1069)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2898)
	... 39 more


Process finished with exit code -1

First, for reading bugs. In idea, you should read backwards, from bottom to top. Just look at the line of cause by. For the above error reports, * * * * just remove the Chinese comments in the interface mapping file and configuration file of mybatis, or change the encoding method to utf8.

About priority of. Properties file (supplementary)

We knew before that the reference configuration file can be realized through the properties attribute: the reference configuration file code given in the official mybatis document is:

	<!--Introduction of external configuration files-->
    <properties resource="db.properties">
        <property name="username" value="root"/>
        <property name="pwd" value="123123"/>
    </properties>

We can also write the code to import the configuration file as:

<properties resource="db.properties"/>

The premise of this writing is that our resource file contains the name and PWD attributes! When we use the official method of importing the configuration file, but write the name and PWD attributes in the external configuration file, idea will automatically execute the code based on the external file as the standard.

MVN compile Error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin…

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project hello-world: Compilation failure: Compilation failure:
[ERROR] Source option 5 is no longer supported; use version 6 or higher.
[ERROR] Target option 1.5 is no longer supported. please use version 1.6 or higher.

Add the following attributes to pom.xml

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
 
 		<java.version>1.8</java.version>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
	</properties>

Project Startup Error: It was loaded from the following location

Dependency conflict

Problem: the parent project uses the control dependent version, and an error is reported when starting

Description:

......

It was loaded from the following location:

	file:/C:/Users/259876/.m2/repository/com/alibaba/nacos/nacos-api/1.2.0/nacos-api-1.2.0.jar

Solution: delete the last dependency [dependency conflict?] according to the prompt

[Maven] maven filtering OTS parsing error incorrect file size in WOFF head [Two Methods to Solve]

Background description

The front-end static resource file is placed in the Resources folder of the back-end spring boot project. After multi-environment packaging, the icon and text on the front-end page are not displayed as expected. Check the browser console and find the following errors.

OTS parsing error: incorrect file size in WOFF header

Cause location

Let’s first look at the configured Maven POM content.

<build>
        <finalName>project-name</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>utf-8</encoding>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
</build>

You can see that the filtering tag is true, which indicates that the filtering mode is enabled. So what is the function of filtering true?

Filtering: turn on filtering and replace the parameter (eg. ${name}) in the file under the directory with the specified parameter. Directory: specify the location of the resource file.

However, it should be noted that because the project needs to configure multiple environments, it needs to use @profile. Active @ , so the @ method is configured for replacement instead of using the default $symbol.

# application.ymlIn the file
spring:
  # Configure which environment to use, dev development, beta testing, prod online, mainly different data sources.
  profiles:
    # Get the environment specified by maven
    active: @profile.active@

Therefore, the main meaning of the above POM is to replace all @ XXX @ under Src/main/resources. Please refer to the relevant contents of Maven profile for the specific replacement principle, which will not be introduced here.

Solution:

Because there are many @ symbols in the woff file, the above configuration causes the original content of the woff file to be replaced, which leads to errors in browser parsing
therefore, the core of the solution is to prevent woff files from being scanned under filtering.

Scheme 1: when the filtering mode is started, the contents in the static directory will not be replaced.

    <build>
        <finalName>package-name</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>utf-8</encoding>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <!-- Turn on filtering and replace the parameters in the file under directory with the specified parameters -->
                <filtering>true</filtering>
                <! -- Use filter to exclude files under fonts/ first, otherwise the page icon will not be loaded -->
                <excludes>
                    <exclude>static/fonts/**</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <!-- Re-copy the excluded files under fonts/ without using the filter -->
                <filtering>false</filtering>
                <includes>
                    <include>static/fonts/**</include>
                </includes>
            </resource>
        </resources>
    </build>

Scheme 2: the nonfilteredfileextensions tag specifies which suffix files are not uniformly encoded.

    <build>
        <finalName>package-name</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <encoding>utf-8</encoding>
                    <delimiters>
                        <delimiter>@</delimiter>
                    </delimiters>
                    <useDefaultDelimiters>false</useDefaultDelimiters>
                    <nonFilteredFileExtensions>woff</nonFilteredFileExtensions>
                    <nonFilteredFileExtensions>woff2</nonFilteredFileExtensions>
                    <nonFilteredFileExtensions>tff</nonFilteredFileExtensions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

SpringBoot—Error starting ApplicationContext. To display the auto-configuration report re-run your a

Error: Starting the main SpringBoot application gives the prompt.
Error starting ApplicationContext. To display the auto-configuration report re-run your application
Found the error in the pom.xmlFile:
<thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>write wrong to
<thymeleaf.layout-dialect.version>2.1.1</thymeleaf.layout-dialect.version>
should be used in thymeleaf and layout – connection