Tag Archives: Web development

[Solved] VUE3 Error: Error: ENOSPC: System limit for number of file watchers reached

(env) [root@VM-20-16-centos vue_test2]# npm run serve

> [email protected] serve
> vue-cli-service serve

 INFO  Starting development server...
[10%] building (0/0 modules)
node:internal/errors:464
    ErrorCaptureStackTrace(err);
    ^

Error: ENOSPC: System limit for number of file watchers reached, watch '/root/work/vue3/vue_test2/public'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2251:34)
    at createFsWatchInstance (/root/work/vue3/vue_test2/node_modules/chokidar/lib/nodefs-handler.js:119:15)
    at setFsWatchListener (/root/work/vue3/vue_test2/node_modules/chokidar/lib/nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (/root/work/vue3/vue_test2/node_modules/chokidar/lib/nodefs-handler.js:331:14)
    at NodeFsHandler._handleDir (/root/work/vue3/vue_test2/node_modules/chokidar/lib/nodefs-handler.js:567:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async NodeFsHandler._addToNodeFs (/root/work/vue3/vue_test2/node_modules/chokidar/lib/nodefs-handler.js:617:16)
    at async /root/work/vue3/vue_test2/node_modules/chokidar/index.js:451:21
    at async Promise.all (index 0)
Emitted 'error' event on FSWatcher instance at:
    at FSWatcher._handleError (/root/work/vue3/vue_test2/node_modules/chokidar/index.js:647:10)
    at NodeFsHandler._addToNodeFs (/root/work/vue3/vue_test2/node_modules/chokidar/lib/nodefs-handler.js:645:18)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /root/work/vue3/vue_test2/node_modules/chokidar/index.js:451:21
    at async Promise.all (index 0) {
  errno: -28,
  syscall: 'watch',
  code: 'ENOSPC',
  path: '/root/work/vue3/vue_test2/public',
  filename: '/root/work/vue3/vue_test2/public'
}

Solution:

Execute the following command

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

[Solved] Error in registering Eureka for spring cloud micro service: classnotfoundexception: org.apache.http.conn.scheme.schemeregistry

1. Problem description

As mentioned above, it is normal to start the Eureka server alone. When you start the micro service module and register the service with Eureka, an error is reported.

My microservice module POM depends on the following:

<dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.1.1</version>
        </dependency>

    </dependencies>

Microservice module configuration file:

eureka.client.service-url.defaultZone=http://localhost:8000/eureka

The total POM of the project is as follows:

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>Greenwich.SR5</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

2. Solution

See a similar problem on stack overflow:

https://stackoverflow.com/questions/28217891/java-lang-classnotfoundexception-org-apache-http-config-registrybuilder

It is speculated that there may also be a problem with the dependent package under D: \ D1 \ Java \ maven \ repo \ ORG \ Apache \ httpcomponents

According to the time of the file modification date, the following package should be called for the use of Eureka

Delete these folders and reintroduce the POM dependency of microservice module and Eureka server

Start the microservice here and the problem is solved

16:31:17.183- INFO 38700 --- [           main]com.netflix.discovery.DiscoveryClient    :Getting all instance registry info from the eureka server
16:31:17.460- INFO 38700 --- [           main]com.netflix.discovery.DiscoveryClient    :The response status is 200
16:31:17.462- INFO 38700 --- [           main]com.netflix.discovery.DiscoveryClient    :Starting heartbeat executor: renew interval is: 30
16:31:17.465- INFO 38700 --- [           main]c.n.discovery.InstanceInfoReplicator     :InstanceInfoReplicator onDemand update allowed rate per min is 4
16:31:17.470- INFO 38700 --- [           main]com.netflix.discovery.DiscoveryClient    :Discovery Client initialized at timestamp 1628843477468 with initial instances count: 0
16:31:17.472- INFO 38700 --- [           main]o.s.c.n.e.s.EurekaServiceRegistry        :Registering application COURSE-LIST with eureka with status UP
16:31:17.472- INFO 38700 --- [           main]com.netflix.discovery.DiscoveryClient    :Saw local status change event StatusChangeEvent [timestamp=1628843477472, current=UP, previous=STARTING]
16:31:17.475- INFO 38700 --- [nfoReplicator-0]com.netflix.discovery.DiscoveryClient    :DiscoveryClient_COURSE-LIST/LAPTOP-LMMPH4VI:course-list:8080: registering service...
16:31:17.523- INFO 38700 --- [           main]o.s.b.w.embedded.tomcat.TomcatWebServer  :Tomcat started on port(s): 8080 (http) with context path ''
16:31:17.524- INFO 38700 --- [           main].s.c.n.e.s.EurekaAutoServiceRegistration :Updating port to 8080
16:31:17.567- INFO 38700 --- [nfoReplicator-0]com.netflix.discovery.DiscoveryClient    :DiscoveryClient_COURSE-LIST/LAPTOP-LMMPH4VI:course-list:8080 - registration status: 204
16:31:19.133- INFO 38700 --- [           main]com.fanyu.course.CourseListApplication   :Started CourseListApplication in 13.313 seconds (JVM running for 14.906)

Mybatis Error: Result Maps collection already contains value

1.Problem description

An inexplicable error occurred when mybatis started under idea

org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\idea_work\2021-04-06\xxxx\test-web\target\classes\mapper\demo\ExampleAsyncTreeMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\idea_work\2021-04-06\xxxx\test-web\target\classes\mapper\demo\ExampleAsyncTreeMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxxx.web.test.mapper.ExampleAsyncTreeMapper.ExampleAsyncTreeResult
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:595)
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.afterPropertiesSet(MybatisSqlSessionFactoryBean.java:431)
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.getObject(MybatisSqlSessionFactoryBean.java:628)
	at com.xxxx.common.db.collector.SqlSessionFactoryCreator.createSqlSessionFactory(SqlSessionFactoryCreator.java:274)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig.sqlSessionFactoryPrimary(SqlSessionFactoryConfig.java:46)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig$$EnhancerBySpringCGLIB$$916ae73.CGLIB$sqlSessionFactoryPrimary$0(<generated>)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig$$EnhancerBySpringCGLIB$$916ae73$$testClassBySpringCGLIB$$e60ba3c6.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
	at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
	at com.xxxx.common.core.config.SqlSessionFactoryConfig$$EnhancerBySpringCGLIB$$916ae73.sqlSessionFactoryPrimary(<generated>)
	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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:635)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1509)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at com.xxxx.testApplication.main(testApplication.java:38)
Caused by: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [D:\idea_work\2021-04-06\xxxx\test-web\target\classes\mapper\demo\ExampleAsyncTreeMapper.xml]'. Cause: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxxx.web.test.mapper.ExampleAsyncTreeMapper.ExampleAsyncTreeResult
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:123)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:95)
	at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.buildSqlSessionFactory(MybatisSqlSessionFactoryBean.java:593)
	... 56 common frames omitted
Caused by: java.lang.IllegalArgumentException: Result Maps collection already contains value for com.xxxx.web.test.mapper.ExampleAsyncTreeMapper.ExampleAsyncTreeResult
	at com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap.put(MybatisConfiguration.java:429)
	at com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap.put(MybatisConfiguration.java:399)
	at com.baomidou.mybatisplus.core.MybatisConfiguration.addResultMap(MybatisConfiguration.java:253)
	at org.apache.ibatis.builder.MapperBuilderAssistant.addResultMap(MapperBuilderAssistant.java:209)
	at org.apache.ibatis.builder.ResultMapResolver.resolve(ResultMapResolver.java:47)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:289)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:254)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:246)
	at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:119)
	... 58 common frames omitted

The returned error message: caused by: Java. Lang. illegalargumentexception: result maps collection already contains value for has been explained, there are duplicate!

2.Solutions

Global search of this class, there are indeed two, delete the irrelevant one on the line! Or clear it and recompile it

</ div>

Proguard Packaging Error: You have to specify ‘-keep‘ options if you want to write out kept elements with ‘-print

1.Problem description

Using Proguard to obfuscate the code and execute the package command, the following error is reported:

 [proguard] Error: You have to specify '-keep' options if you want to write out kept elements with '-printseeds'.
 [proguard] Note: you're ignoring all warnings!

2.Solutions

This is because when performing obfuscation in Proguard, you must specify a – keep. If you want to obfuscate all, fill in a nonexistent package name

<option>-keep public class com.aaaa.* {
  public protected *;
  }
</option>

Record an error that the Tomcat resource publication cannot be updated:

Record an error that the Tomcat resource publication cannot be updated:

When it is found that Tomcat information is not updated after it is published, it is still the same as before; restart tomcat, delete the generated war package, and then re open it, it is found that there is no effect. After checking the configuration, it is found that there is no error. Check the resources under the published war package, and all the resources of the project are successfully published

So, after repeated operations, we finally found the error – the browser’s cache data is not cleared, delete the browser’s cache, restart, OK! No problem, Laotie

I hope my question will help you

Spring boot prompt could not resolve placeholder in string value

1. Problem description

 

Spring boot refers to the configuration in YML in entity class

    @Value("${shiro.session.expireTime}")
    private final int expireTime = 30;

As soon as the project is started, an error is reported, indicating that could not resolve placeholder in string value. This error is basically caused by “configuration file not found”( application.yml )】

 

2. Solutions

 

Check whether the target / classes directory exists application.yml configuration file

If it exists, add the primary key of propertysource to the configuration class, and judge whether it exists according to the error log application.yml Configuration file.

@Configuration
@PropertySource("classpath:application.yml")
public class ShiroConfig {

 

You have not concluded your merge (MERGE_HEAD exists)

Problems with Using SourceTree Merge branches:

You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.

Then click Termianl on SourceTree and an error occurs:


The error may be caused by code that you pulled down before not merging automatically.
There are two solutions:
1. Keep your local changes

git merge --abort

git reset --merge

Be sure to commit the local merge after merging
Then get the online warehouse

git pull


2. Down the code version, discard local modifications
This is not recommended, but if you have small local changes, or if you have a backup copy of your own, you can overwrite it locally directly with the latest version on your line

git fetch --all

git reset --hard origin/master

git fetch

Of course, the dumbest option is to clone a piece of code and discard the working directory, which is clumsy but equally effective.

Java was started but returned exit code = 13

Java was started but returned exit code=13
As is shown in

The reason is that when you update the JRE through a third party, the third party installs a 32-bit JRE that doesn’t match the 64-bit Eclipse. (The error message — Launcher. Library has x86_64 to show that eclipse is 64-bit.)
After installation JDK8/JRE8 adds an environment variable C:\ProgramData\Oracle\Java\ Javapath
The environment variable is three shortcuts, java.exe.lnk javaw.exe.lnk javaws.exe.lnk. Every time you install the JDK/JRE, these three shortcuts will update the path to the last JRE path

Cause found, reinstall the 64-bit JDK to fix the problem
Attached is a comparison of the 1:32 bit 64-bit running java-Version commands
32 bit

C:\>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)

A 64 – bit

C:\>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

you can see that 64 is 64 Bit, 32 Bit is not
Annex 2: Determine whether Eclipse is 32-bit or 64-bit through eclipse directory specific files
The directory structure of eclipse32-bit and 64-bit is similar. We can look at the Eclipse.ini file after unziping and compare it with -launcher. Library to find if there is x86_64
As shown in the figure, the top is 32 bits and the bottom is 64 bits

Eclipse directory structure

Solving the problem of can’t create temporary directory of CVS under Windows


cvs [server aborted]:
Can’t create temporary Directory C:\WINDOWS\TEMP/ CVS-SERV1320: Permission Denied problem.

The solutions to this problem are as follows:

First, modify the temporary directory of the CVS server (to restart the service after modification)

Then modify the corresponding temporary folder permissions, as follows:

1. Open any folder, click Tools – Folder Options on the menu, and select View in the popup window. As shown, unselect Use Sharing Wizard (Recommended) and click OK to close the window.

2. Open the properties of the temporary folder and modify the corresponding permissions in the security options

That is ok.

Webpack 4 : ERROR in Entry module not found: Error: Can’t resolve ‘./src’

ERROR in Entry Module not found: ERROR: Can’t resolve ‘./ SRC ‘in’ E:\ Documents\VSCode files\WebPackProject ‘
Specify the inlet and outlet through the configuration file
Js (must be in the project root directory)

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
      path: path.resolve(__dirname, 'dist'),
    filename: 'bundle.js'
  }
};

Not packaged by configuration file
By default, Webpack4 does not need to create webpack.config.js to configure the packaged entry and exit.
By default,
The entry is ./ SRC /index.js file
Exit to ./dist/main.js file
Directory structure:

Js is in the correct position. Run the command in the project root directory:

webpack

You are ready to pack.


So now you can see that under the project directory, dist folder, you’ll see the packaged file main.js;
In the HTML file index. HTML which needs to be introduced, it can be correctly introduced.

You can also specify it manually using the following command:
webpack./SRC /index.js -- output-filename. /dist/main.js --output-path. --mode development
or
webpack ./src/index.js -o ./dist/main.js --mode development
note:
, --mode development is the specified development mode, without which warning will be reported;
Another mode is --mode production specifies the production mode. In this mode, the packaged js file will be compressed, but the former will not.
Webpack will prompt a warning when executing directly from above. Closing the warning can be packaged by the following command:
webpack --mode development
or
webpack --mode production
`