Similar errors are reported. The solutions are as follows
Find the corresponding file according to the path above, usually at the end of the file, and then delete the contents of the red box
Similar errors are reported. The solutions are as follows
Find the corresponding file according to the path above, usually at the end of the file, and then delete the contents of the red box
Phenomenon
When doing a position search using elasticsearch, an error is reported.
ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]
I am using GeoDistanceQueryBuilder for ElasticSearch’s geolocation search and sorting
Searching
Later, I logged in to the elasticsearch server to check the error logs and found the following errors.
That is, my location is not of the geo_point type, and this problem has been troubleshooting for quite a while.
The reason for the problem is simple, it is because my index is automatically created by IndexRequest and there will be problems.
For example.
String string = JSONObject.fromObject(entity).toString();
IndexRequest indexRequest = new IndexRequest(INDEX).type(DOC).id(INDEX + "_" + entity.getId()).source(string, XContentType.JSON);
bulkRequest.add(indexRequest);
Solution:
Create the index manually, or through Java code. Be sure to note that the type of the attribute corresponding to the mapping must be geo_point to work
Here I change the index, position means position information
# use java to manually create the index
public class CreateElsIndexMain {
static final String INDEX_NAME = "t_els_mock";
@Test
public void test() throws Exception {
RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
new HttpHost(
"127.0.0.1",
9200,
"http"
)));
boolean exists = checkExists(client);
if (exists) {
deleteIndex(client);
}
createIndex(client);
}
public static boolean checkExists(RestHighLevelClient client) throws Exception {
GetIndexRequest existsRequest = new GetIndexRequest();
existsRequest.indices(INDEX_NAME);
boolean exists = client.indices().exists(existsRequest, RequestOptions.DEFAULT);
return exists;
}
public static void createIndex(RestHighLevelClient client) throws Exception {
Settings.Builder setting = Settings.builder().put("number_of_shards", "5").put("number_of_replicas", 1);
XContentBuilder mappings = JsonXContent.contentBuilder().
startObject().startObject("properties").startObject("id").field("type", "text").endObject().
startObject("name").field("type", "keyword").endObject().
startObject("createTime").field("type", "keyword").endObject().
startObject("score").field("type","keyword").endObject().
startObject("longitude").field("type","float").endObject().
startObject("latitude").field("type","float").endObject().
startObject("position").field("type","geo_point").endObject().endObject().endObject();
CreateIndexRequest request = new CreateIndexRequest(INDEX_NAME).settings(setting).mapping("doc",mappings);
CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);
System.out.println(createIndexResponse);
}
public static void deleteIndex(RestHighLevelClient client) throws Exception {
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest();//To delete an index, also create an object to accept the index name
deleteIndexRequest.indices(INDEX_NAME);//pass the index name
//execute the delete method for deletion.
AcknowledgedResponse delete = client.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
}
}
Kibana data
We can use the test data to put the data into es and view the data of the index through kibana’s dev tools, as shown in the following example:
Code to add data to es
@Autowired
private RestHighLevelClient client;
private static final String INDEX = "t_els_mock";
String DOC = "doc";
public void addData(){
BulkRequest bulkRequest = new BulkRequest();
List<MockLocationEntity> entities = getEntities();
for (MockLocationEntity entity : entities){
String string = JSONObject.fromObject(entity).toString();
IndexRequest indexRequest = new IndexRequest(INDEX).type(DOC).id(INDEX + "_" + entity.getId()).source(string, XContentType.JSON);
bulkRequest.add(indexRequest);
}
try {
BulkResponse bulk = client.bulk(bulkRequest, RequestOptions.DEFAULT);
} catch (IOException e) {
}
}
private static List<MockLocationEntity> getEntities(){
List<MockLocationEntity> list = new ArrayList<>();
MockLocationEntity one = new MockLocationEntity();
one.setId(UUID.randomUUID().toString());
one.setName("YuanYan GuoJi");
one.setScore("10");
one.setCreateTime("20220322145900");
one.setLongitude(117.20);
one.setLatitude(38.14);
one.setPosition(one.getLatitude() + "," +one.getLongitude());
MockLocationEntity two = new MockLocationEntity();
two.setId(UUID.randomUUID().toString());
two.setName("WenGuang DaSha");
two.setScore("9");
two.setCreateTime("20220322171100");
two.setLongitude(116.01);
two.setLatitude(38.89);
two.setPosition(two.getLatitude() + "," +two.getLongitude());
MockLocationEntity three = new MockLocationEntity();
three.setId(UUID.randomUUID().toString());
three.setName("NeiMengGu JiuDian");
three.setScore("8");
three.setCreateTime("20220322171101");
three.setLongitude(117.99);
three.setLatitude(39.24);
three.setPosition(three.getLatitude() + "," +three.getLongitude());
MockLocationEntity four = new MockLocationEntity();
four.setId(UUID.randomUUID().toString());
four.setName("GuoXianSheng");
four.setScore("10");
four.setCreateTime("20220322171102");
four.setLongitude(117.20);
four.setLatitude(39.50);
four.setPosition(four.getLatitude() + "," +four.getLongitude());
Location fourLocation = new Location();
MockLocationEntity five = new MockLocationEntity();
five.setId(UUID.randomUUID().toString());
five.setName("NongYe YinHang");
five.setScore("8");
five.setCreateTime("20220322171103");
five.setLongitude(116.89);
five.setLatitude(39.90);
five.setPosition(five.getLatitude() + "," +five.getLongitude());
Location fiveLocation = new Location();
MockLocationEntity six = new MockLocationEntity();
six.setId(UUID.randomUUID().toString());
six.setName("XingBaKe");
six.setScore("9");
six.setCreateTime("20220322171104");
six.setLongitude(117.25);
six.setLatitude(39.15);
six.setPosition(six.getLatitude() + "," +six.getLongitude());
MockLocationEntity seven = new MockLocationEntity();
seven.setId(UUID.randomUUID().toString());
seven.setName("JuFuYuan");
seven.setScore("6");
seven.setCreateTime("20220322171104");
seven.setLongitude(117.30);
seven.setLatitude(39.18);
seven.setPosition(seven.getLatitude() + "," +seven.getLongitude());
list.add(one);
list.add(two);
list.add(three);
list.add(four);
list.add(five);
list.add(six);
list.add(seven);
return list;
}
Failed to restart redis-server. service: Unit not found.
1. Problem description
Redis-5.0.5 is compiled and installed on CentOS 7.8. The port is 6579. The following error occurs when restarting:
# systemctl start redis
Redirecting to /bin/systemctl restart redis-server.service
Failed to restart redis-server.service: Unit not found.
2. Cause analysis
This is because during compilation and installation, redis registers the service name redis_6579, and the full service name is required for startup.
3. Correct startup mode
# systemctl start redis_6579
or
# service redis_6579 start
Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Error Messages:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
Solution:
You need to add a configuration in your project’s POM file
<build>
<resources>
<!-- Resolving mapper binding exceptions -->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<!-- Resolve profile exceptions such as data source not found -->
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
</includes>
</resource>
</resources>
</build>
This error was found in the startup project for a long time, that is, the dependency is not correct
factory method 'globaltransactionscanner' threw exception; nested exception is io. seata. common. exception. NotSupportYetException: not support register type: null
My spring dependent version
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.1.10.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Greenwich.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>2.1.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Replace the Seata dependency with this one and start successfully
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-seata</artifactId>
<version>2.1.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>io.seata</groupId>
<artifactId>seata-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-all</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<version>1.4.2</version>
</dependency>
When I use idea to create a simple web project, there are no SRC, webapp files and so on under the project. And the following errors are reported:
The desired archetype does not exista (org.apache. maven archetypes :maven- archetype webapp:RELEASE)
The specific errors are as follows:
[WARNING] The metadata D:\apache-maven-3.6.1\maven-repository\org\apache\maven\archetypes\maven-archetype-webapp\maven-metadata-alimaven.xml is invalid: entity reference name can not contain character ='
Solution:
1. Find the error path (such as the path indicated in bold and underlined above) through the error information above, and find the maven-archetype-webapp folder in your local warehouse
2. Delete files other than folders (such as XML files), and only keep version folders (such as 4.1 folder, 3.1 folder, etc.)
3. Reload the project (or rebuild the project).
Encountered when using case when in mybatis for condition filtering judgment
Failed to process, please exclude the tableName or statementId.
Such error messages are syntax errors
but I have no problem running SQL statements on the MySQL command line
//case when
WHERE dept.type = 1
AND
(
CASE agent.dept_type
WHEN "agent" THEN dept.id=30
END
)
//When the agent's dept_type is "agent", the judgment that dept.id = 30 will be added
There is no problem running this SQL statement on the command line, but an error will be reported if it is executed on mybatis
//Modified
WHERE dept.type = 1
AND dept.id=
(
CASE agent.dept_type
WHEN "agent" THEN 30
END
)
Later, put dept.id outside to solve this problem
20190718 – Supplementary record: another problem is encountered. If the dept
table is associated query, there may be no data. When the dept
has no data, we can’t assign any parameters to dept.id
and can’t affect the query of the data in the original table. I changed it to the following:
//Modified
WHERE dept.type = 1
AND (dept.id=
(
CASE agent.dept_type
WHEN "agent" THEN 30
ELSE 0
END
) or dept.id is null)
Add the judgment that dept.id
is empty
(there are many ways to solve it in MySQL statements, but an error will be reported on mybatis – – |)
2019-7-30-supplementary notes:
if it is an empty string, you can’t use ""
but change it to single quotation mark ''
CASE WHEN *** THEN ***
ELSE "" =>Need to change to=> ELSE''
Problem description
Today, we are integrating mybatis with springboot, and an error is reported at runtime:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.16.jar:5.3.16]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.16.jar:5.3.16]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.4.jar:2.6.4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) [spring-boot-2.6.4.jar:2.6.4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) [spring-boot-2.6.4.jar:2.6.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-2.6.4.jar:2.6.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) [spring-boot-2.6.4.jar:2.6.4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) [spring-boot-2.6.4.jar:2.6.4]
at com.example.demo.DemoApplication.main(DemoApplication.java:18) [classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.16.jar:5.3.16]
... 20 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1534) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.16.jar:5.3.16]
... 34 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:638) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1519) ~[spring-beans-5.3.16.jar:5.3.16]
... 45 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.16.jar:5.3.16]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.16.jar:5.3.16]
... 58 common frames omitted
Caused by: org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:595) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:431) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.getObject(MybatisSqlSessionFactoryBean.java:628) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration.sqlSessionFactory(MybatisPlusAutoConfiguration.java:214) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$1a37b21a.CGLIB$sqlSessionFactory$2(<generated>) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$1a37b21a$$FastClassBySpringCGLIB$$a0eb9858.invoke(<generated>) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.16.jar:5.3.16]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.16.jar:5.3.16]
at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$1a37b21a.sqlSessionFactory(<generated>) ~[mybatis-plus-boot-starter-3.3.1.jar:3.3.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_322]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_322]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_322]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_322]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.16.jar:5.3.16]
... 59 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95) ~[mybatis-3.5.5.jar:3.5.5]
at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:593) ~[mybatis-plus-extension-3.4.0.jar:3.4.0]
... 72 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:118) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.xml.XMLStatementBuilder.parseStatementNode(XMLStatementBuilder.java:76) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:138) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildStatementFromContext(XMLMapperBuilder.java:131) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:121) ~[mybatis-3.5.5.jar:3.5.5]
... 74 common frames omitted
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116) ~[mybatis-3.5.5.jar:3.5.5]
... 78 common frames omitted
Caused by: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:200) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.io.ClassLoaderWrapper.classForName(ClassLoaderWrapper.java:89) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.io.Resources.classForName(Resources.java:261) ~[mybatis-3.5.5.jar:3.5.5]
at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:116) ~[mybatis-3.5.5.jar:3.5.5]
... 80 common frames omitted
Cause analysis:
When I first saw this error report, I guessed that the bean was not successfully created. I also searched various answers on the Internet. Some said that @ service might not be added to the service layer. I looked at it for no reason, so I began to read the error information
Look directly at the error reported in the first line, because the first line is likely to be the main reason for the error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userMapper' defined in file [E:\IDEA Project\demo\target\classes\com\example\demo\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
I’ll take this long paragraph wrong and look at it in pieces
at first, I thought it was the problem of userController, then carefully check whether it was not, and then look back:
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl'
I went to see userServiceImpl again and didn’t find any problems, so I was wondering if I understood the error in this paragraph, so I searched the meaning of nest. It turned out that there was nesting besides nesting! That is to say, the error reporting in this paragraph is actually an exception nested with another exception ! In other words, it is the innermost error that causes the error of each layer above, thus throwing an exception! So I went straight to the back part:
nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\IDEA Project\demo\target\classes\mapper\VersionMapper.xml]'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'com.libv.entity.Version'. Cause: java.lang.ClassNotFoundException: Cannot find class: com.libv.entity.Version
Found to be VersionMapper.xml has a problem because of Error resolving class, That is to say, there is a problem with one class. Look at the last: Cannot find class: com.libv.entity.Version.
I went to see XML again:
<mapper namespace="com.libv.mapper.VersionMapper">
<insert id="release" parameterType="com.libv.entity.Version">
insert into version(id,version,download_url,release_time)
values (#{id},#{version},#{downloadUrl},NOW())
</insert>
</mapper>
Now I understand, because I don’t have com.libv.entity this bag! That is, the wrong path of my Version class leads to errors in XML, resulting in layer-by-layer exceptions.
Solution:
Change the directory path of the corresponding class of parameterType in XML
<mapper namespace="com.example.demo.mapper.VersionMapper">
<insert id="release" parameterType="com.example.demo.Entity.Version">
insert into version(id,version,download_url,release_time)
values (#{id},#{version},#{downloadUrl},NOW())
</insert>
</mapper>
Run again, success!
This article takes Java code as an example to introduce how to convert a color PDF file into a grayscale (black and white) PDF file, that is, convert the color image or text in the PDF document into gray by calling the PdfGrayConverter.toGrayPdf() method. It can reduce the size of the document by adjusting the document without color effect. The following is the program running environment and code samples.
About how to import jar files:
1. Download from the Maven repository and configure Pom.xml as follows:
<repositories> <repository> <id>com.e-iceblue</id> <url>https: // repo.e-iceblue.cn/repository/maven-public/</url> </repository> </repositories > <dependencies> <dependency> <groupId> e-iceblue </groupId> <artifactId>spire.pdf</artifactId> <version>5.3.1</version> </dependency> </dependencies>
2. Manually add the jar
Download the jar package locally, then unzip it, and find Spire.Pdf.jar in the lib folder. Then open the following interface in IDEA, and add the jar file in the local path to the Java program.
This conversion requires only the following two steps:
Java
import com.spire.pdf.conversion.* ; public class ToGrayPDF { public static void main(String[] args) { // Create a PdfGrayConverter instance and load the PDF document PdfGrayConverter converter = new PdfGrayConverter("Booklet.pdf" ); / / Convert color PDF to grayscale converter.toGrayPdf("ToGray.pdf" ); converter.dispose(); } }
Conversion result:
Translated from https://www.cnblogs.com/Yesi/p/16038524.html
Many images pulled down from docker hub can be customized to suit their own images by modifying configuration files and other operations. You can use your own images in the future. Therefore, you need to upload them to docker hub, and you can manage and maintain your own docker images like code in the future.
Created successfully as shown below:
docker local login
docker login
docker tag <existing-image> <hub-user>/<repo-name>[:<tag>]
docker commit 277e80820516 jerrymouseli/wvp_lirj:0322
The tag here is not specified is latest.
sha256 is the check code of the image file.
docker push<hub-user>/<repo-name>:<tag>
docker push jerrymouseli/wvp_lirj:0322
docker inspect jerrymouseli/wvp_lirj:0322
Translated from this article: https://www.cnblogs.com/JerryMouseLi/p/16040807.html
Error in idea startup item: error running ‘XXXXXX’: command line is too long Shorten command line for xxxxxx or also for Spring Boot default configuration?
Error reason: this error may be reported when the newly pulled code is started after the idea is opened
Solution: just find the following line in workspace.xml file of the .idea folder:
< component name="PropertiesComponent"> ······</component>
Add a line in the middle
< property name="dynamic.classpath" value="true" />
The problem can be solved
This bug should only appear in idea2020
Error:(3, 46) java: Program Package org.springframework.context.annotation does not exist
First, open the file in the upper left corner of the idea, and then click settings
Then click build, execution, deployment > Build Tools > Maven > Runner
check delegate ide build/run actions to Maven
The problem will be solved easily
in addition, warm tips: only idea2020 will have this error, and there are many hidden bugs in 2020. It is recommended to upgrade to idea2021 as soon as possible