[Solved] NPM Error: gyp: No Xcode or CLT version detected!

problem

Recently, using npm to install modules in macOS Catalina, the following errors often occur:


> node-gyp rebuild

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.

No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.

gyp: No Xcode or CLT version detected!
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yangjian/Documents/temp/test001/node_modules/fsevents
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
  • Screenshot below

1

solution

1. Try to repair with the following command

$ xcode-select --install

The system prompts the following information:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

In fact, there is no so-called “Software Update” to update

2. Correct posture

When I was unable to do anything, I found the following solution:

$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install

[Solved] ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

In order to strengthen security, MySQL 5.7 randomly generates a password for the root user. In the error log, regarding the location of the error log, if the RPM package is installed, the default is /var/log/mysqld.log.

Generally can be set by log_error

mysql >  select  @@log_error ;
 + - -------------------+ 
|  @@log_error          | 
+ - ------------ -------+ 
|  / var / log / mysqld. log  | 
+ - -------------------+ 
1 row in  set ( 0.00 sec)

The MySQL temporary password can be obtained through the # grep “password” /var/log/mysqld.log command

2016 - 01 - 19T05: 16 : 36 .218234Z . 1  [ Note ] A Temporary password IS Generated for the root @localhost : WAQ, qR % BE2 ( . 5

After logging in to the server with this password, the password must be changed immediately, otherwise the following error will be reported:

mysql >  select  user ();
ERROR 1820 (HY000): You must reset your password using ALTER  USER statement before executing this statement.

If you just change it to a simple password, the following error will be reported:

mysql >   ALTER  USER  USER () IDENTIFIED BY  ' 12345678 ' ;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

This is actually related to the value of validate_password_policy.

The validate_password_policy has the following values:

Policy Tests Performed
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters; dictionary file

The default is 1, which is MEDIUM, so the password set at the beginning must meet the length, and must contain numbers, lowercase or uppercase letters, and special characters.

Sometimes, just for my own testing, I don’t want to set the password so complicated. For example, I just want to set the root password to 123456.

Two global parameters must be modified:

First, modify the value of the validate_password_policy parameter

mysql >  set global validate_password_policy = 0 ;
Query OK, 0 rows affected ( 0.00 sec)

In this way, the criterion for determining the password is based on the length of the password. This is determined by the validate_password_length parameter.

mysql >  select  @@validate_password_length ;
 + - --------------------------+ 
|  @@validate_password_length  | 
+ - ----- ---------------------+ 
|                           8  | 
+ - ---------------------- ----+ 
1 row in  set ( 0.00 sec)

The validate_password_length parameter defaults to 8, which has a minimum limit, the minimum value is:

validate_password_number_count
 + validate_password_special_char_count
 + ( 2  * validate_password_mixed_case_count)

Among them, validate_password_number_count specifies the length of data in the password, validate_password_special_char_count specifies the length of special characters in the password, and validate_password_mixed_case_count specifies the length of upper and lower letters in the password.

The default value of these parameters is 1, so the minimum value of validate_password_length is 4. If you explicitly specify that the value of validate_password_length is less than 4, although no error will be reported, the value of validate_password_length will be set to 4. As follows:

mysql >  select  @@validate_password_length ;
 + - --------------------------+ 
|  @@validate_password_length  | 
+ - ----- ---------------------+ 
|                           8  | 
+ - ---------------------- ----+ 
1 row in  set ( 0.00 sec)

mysql >  set global validate_password_length = 1 ;
Query OK, 0 rows affected ( 0.00 sec)

mysql >  select  @@validate_password_length ;
 + - --------------------------+ 
|  @@validate_password_length  | 
+ - ----- ---------------------+ 
|                           4  | 
+ - ---------------------- ----+ 
1 row in  set ( 0.00 sec)

If any value of validate_password_number_count, validate_password_special_char_count, validate_password_mixed_case_count is modified, validate_password_length will be modified dynamically.

mysql >  select  @@validate_password_length ;
 + - --------------------------+ 
|  @@validate_password_length  | 
+ - ----- ---------------------+ 
|                           4  | 
+ - ---------------------- ----+ 
1 row in  set ( 0.00 sec)

mysql >  select  @@validate_password_mixed_case_count ;
 + - ------------------------------------+ 
|  @@ validate_password_mixed_case_count  | 
+ - ------------------------------------+ 
|                                     1  | 
+ - - ----------------------------------+ 
1 row in  set ( 0.00 sec)

mysql >  set global validate_password_mixed_case_count = 2 ;
Query OK, 0 rows affected ( 0.00 sec)

mysql >  select  @@validate_password_mixed_case_count ;
 + - ------------------------------------+ 
|  @@ validate_password_mixed_case_count  | 
+ - ------------------------------------+ 
|                                     2  | 
+ - - ----------------------------------+ 
1 row in  set ( 0.00 sec)

mysql >  select  @@validate_password_length ;
 + - --------------------------+ 
|  @@validate_password_length  | 
+ - ----- ---------------------+ 
|                           6  | 
+ - ---------------------- ----+ 
1 row in  set ( 0.00 sec)

Of course, the premise is that the validate_password plug-in must have been installed, and MySQL 5.7 is installed by default.

So how to verify whether the validate_password plugin is installed? You can check the following parameters, if it is not installed, the output will be empty.

mysql > SHOW VARIABLES LIKE  ' validate_password% ' ;
 + - ------------------------------------+ -------+ 
| Variable_name                         | Value | 
+ - ---------------------------------- --+-------+ 
| validate_password_dictionary_file     |        | 
| validate_password_length              |  6      | 
| validate_password_mixed_case_count    |  2      | 
| validate_password_number_count        |  1      |
| validate_password_policy              | LOW    | 
| validate_password_special_char_count |  1      | 
+ - ------------------------------------+ -------+ 
6 rows in  set ( 0.00 sec)

dubbo 2.5.4-SNAPSHOT dubbo-admin [How to Solve]

Error:

RROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uriBrokerService': Cannot create inner bean '(inner bean)' of type [com.alibaba.citrus.service.uribroker.impl.URIBrokerServiceImpl$URIBrokerInfo] while setting bean property 'brokers' with key [0]; nested excepti
on is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#25': Cannot create inner bean 'server' of type [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker] while setting constructor argument; nested exception is org.springframework.beans.fact
ory.BeanCreationException: Error creating bean with name 'server': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'URIType' of bean class [com.alibaba.citrus.service.uribroker.uri.GenericURIBroker]: Bean property 'URIType'
is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287)


I am using JDK 1.8.0_05, dubbo-admin version is 2.5.4-SNAPSHOT, and I have the same problem. Solutions such as:

1. The dependency of webx is changed to version 3.1.6;

   <dependency>
        <groupId>com.alibaba.citrus</groupId>
        <artifactId>citrus-webx-all</artifactId>
        <version>3.1.6</version>
    </dependency>

 

2. Add the dependency of velocity, I used 1.7;

 <dependency>
        <groupId>org.apache.velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.7</version>
    </dependency>

 

3. Add exclusion to the dependency dubbo to avoid introducing the old spring

 <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>dubbo</artifactId>
        <version>${project.parent.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

4. webx already has spring 3 or higher dependency, so comment out the spring dependency in dubbo-admin

 <!--<dependency>-->
        <!--<groupId>org.springframework</groupId>-->
        <!--<artifactId>spring</artifactId>-->
    <!--</dependency>-->

 

After decompressing the war package, make sure that the lib directory does not have any dependencies below spring 3. Then it runs normally.

 

5. Dubbo-admin must be placed under the ROOT of TOMCAT, directly delete the system’s own files under the original ROOT, and copy all the files of dubbo-admin into it. The dubbo-admin folder cannot be used. Otherwise, you cannot check if you enter, and an error will be reported.

The pip installation package under Windows reports an error: Microsoft Visual C++ 9.0 is required Unable to find vcvarsall.bat

I just installed pip in the windows environment on the machine to use it later when installing the package. Who knows that the first time I use pip to install asyncio, I get an error.

When using pip installation package under Windows 7×64, it prompts an error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat)

Environment: windows7 x64, python2.7, VS2012

The reason: the windows when using pip installation package requires a machine equipped with vs2008, VS2012 does not work, you do not want VS2008 installed, you can install a Micorsoft Visual C ++ Compiler for Python 2.7 packages

[Solved] throw new Error(“‘output.filename’ is required, either in config file or as –output-filename”);

throw new Error(“‘output.filename’ is required, either in config file or as –output-filename”); Why

Reason: module.exports is written as module.export

 

Module build failed: TypeError: loaderContext.getResolve is not a function when configuring the less file

An error will be reported because the version is too high. Manually change the version of less to 3.9.0 and less-loaderl to 5.0.0 in the configuration file, then re-download with npm install, and then npm rub build

[Solved] emulator: glteximage2d: got err pre :( 0x502 internal 0x1908 format 0x1908 type 0x1401

emulator: glteximage2d: got err pre 🙁 0x502 internal 0x1908 format 0x1908 type 0x1401

 

How to Solve this error:

Go to Tools > AVD Manager > Virtual device configuration > Show advanced settings > Boot option > Cool boot

Then run again your project with that AVD. Close the session and set again Quick boot in Boot option.

[Solved] Error in inherits(x, “theme”): argument “e2” is missing, with no default

Run the code in Rstudio

p<-ggplot(outfile,aes(x = type,y = log2FoldChange))+geom_bar(stat = ' identity ' ,fill = ' #FF9999 ' )+geom_text(label=sig,colour = ' blue ' ,vjust = 1 ,check_overlap = TRUE,size = 7 )
 +theme(axis.text = element_text(size = 14 ))

An error occurred

Error in inherits(x, " theme " ): argument " e2 "  is missing, with no default

This is because the + is at the beginning, and the theme() statement cannot be connected to the previous statement. Just put + at the end of the previous statement

[Solved] Maven log jar package conflict error: Class path contains multiple SLF4J bindings

Error performance:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/learn/Java/maven/repository_taotao/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/learn/Java/maven/repository_taotao/org/apache/activemq/activemq-all/5.11.2/activemq-all-5.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

The console error is shown in the figure below:

The cause of the error:
a jar package conflict occurred:
respectively:

SLF4J: Found binding in [jar:file:/D:/learn/Java/maven/repository_taotao/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/learn/Java/maven/repository_taotao/org/apache/activemq/activemq-all/5.11.2/activemq-all-5.11.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]

solution:

You can go to pom.xml, open Dependency Hierarchy and find the slf4j entry . Except by right-clicking “exclude maven artifact” to exclude the remaining entries.

Run mvn dependency:tree and search for which dependencies have implementations of slf4j you don’t want, then use dependency exclusion to exclude them, for example:

        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.sgroschupf</groupId>
            <artifactId>zkclient</artifactId>
        </dependency>
        <!-- Configure dependency jar packages for the ActiveMQ client -->
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-all</artifactId>
        </dependency>
        <dependency>
            <groupId>com.taotao</groupId>
            <artifactId>taotao-common</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

 

How to Solve Spring MVC upload file error

Error code:

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.web.multipart.MultipartFile]: Specified class is an interface 
    org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java: 101 )
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveModelAttribute(HandlerMethodInvoker.java: 762 )
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.resolveHandlerArguments(HandlerMethodInvoker.java: 356 )
    org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java: 171 )
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java: 426 )
    org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java: 414 )
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java: 790 )
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java: 719 )
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java: 644 )
    org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java: 560 )
    javax.servlet.http.HttpServlet.service(HttpServlet.java: 646 )
    javax.servlet.http.HttpServlet.service(HttpServlet.java: 727 )
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java: 52 )
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java: 88 )
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 76 )
    org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java: 198 )
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java: 76)

 

Solution: Add @RequestParam in front of the Controller’s MultipartFile parameter to solve it!

Git error bad signature [How to Solve]

When submitting the file to the warehouse, the following error is thrown:

Report an error

Roc@DESKTOP-AF552U2 MINGW64 /e/note/Git (master)
$ git add git_GitHub.md
error: bad signature
fatal: index file corrupt

Cause Analysis

Because index file generally refers to the file .git/index in git. This file saves the information in the temporary storage area (index information). You can use git ls-files –stage to view the contents of the staging area. This file is very important! But now it reports index file corrupt, indicating that this file has been damaged. Fortunately, we have a way to regenerate this file: git read-tree or directly git reset.

Solution

  1. Enter the project directory: cd /path/to/dir
  2. Delete or rename the .git/index file: rm -f .git/index or mv .git/index{,.bak}
  3. Rebuild .git/index: git read-tree or directly git reset
Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ mv .git/index .git/index.bak

Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git reset
Unstaged changes after reset:
M       Git/git_use.md
M       Git/git_para.md

Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   "Git/git\347\232\204\345\210\235\346\254\241\344\275\277\347\224\250.md"
        modified:   "Git/git\347\232\204\351\200\211\351\241\271\345\217\202\346\225\260.md"

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        Git/git failed to push some refs to github.md
        "Git/git \346\212\245\351\224\231 index file corrupt.md"
        "Git/git\350\277\236\346\216\245GitHub\344\273\245\345\217\212\346\216\250\351\200\201\350\207\263\344\273\223\345\272\223.md"

no changes added to commit (use "git add" and/or "git commit -a")

Roc@DESKTOP-AF552U2 MINGW64 /e/note (master)
Done!

[Solved] Error: exception: java.lang.reflect.InvocationTargetException: null

Error background

Java code occasionally reports an error, but it will not report an error under normal circumstances.

Error

exception: java.lang.reflect.InvocationTargetException: null

2020-05-11 at 15:17:39 CST traceId:[] ERROR io.netty.util.internal.logging.AbstractInternalLogger 91 error-Unexpected exception: java.lang.reflect.InvocationTargetException: null 
    at sun.reflect.GeneratedMethodAccessor214. invoke(Unknown Source) ~[?:? ]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 43) ~[?:1.8 .0_192]
    at java.lang.reflect.Method.invoke(Method.java: 498) ~[?:1.8 .0_192]
    at org.yeauty.pojo.PojoEndpointServer.doOnClose(PojoEndpointServer.java: 121) [netty-websocket-spring-boot-starter-0.8.0.jar!/:? ]
    at org.yeauty.standard.WebSocketServerHandler.channelInactive(WebSocketServerHandler.java: 29) [netty-websocket-spring-boot-starter-0.8.0.jar!/:? ]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java: 257) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java: 243) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java: 236) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java: 393) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java: 358) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java: 257) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java: 243) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java: 236) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java: 1416) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java: 257) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java: 243) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java: 912) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.AbstractChannel$AbstractUnsafe$ 8.run(AbstractChannel.java:816) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java: 163) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java: 416) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java: 515) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$ 5.run(SingleThreadEventExecutor.java:918) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.util.internal.ThreadExecutorMap$ 2.run(ThreadExecutorMap.java:74) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java: 30) [netty-all-4.1.38.Final.jar!/:4.1.38 .Final]
    at java.lang.Thread.run(Thread.java: 748) [?:1.8 .0_192]
Caused by: java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextNode(HashMap.java: 1445) ~[?:1.8 .0_192]
    at java.util.HashMap$EntryIterator.next(HashMap.java: 1479) ~[?:1.8 .0_192]
    at java.util.HashMap$EntryIterator.next(HashMap.java: 1477) ~[?:1.8 .0_192]
    at com.jcdz.hbdservice.websocket.ServerWebSocket1.onClose(ServerWebSocket1.java: 38) ~[coalminehbdservice-1.0.jar!/:1.0 ]
    ... 25 more

Reason for error

There are many reasons for the error, I will only say the reason I came into contact:

(1) If (==) judgment statement is wrong

if( devMap. getOrDefault ( “locationcode”,”” ) == null )

devMap.get( “locationcode” ) : It is possible that a null is passed, and a null pointer will appear at this time

View the source code of getOrDefault()

1  /** 
2       * Returns the value to which the specified key is mapped, or
 3       * { @code defaultValue} if this map contains no mapping for the key.
 4       *
 5       * @implSpec
 6       * The default implementation makes no guarantees about synchronization
 7       * or atomicity properties of this method. Any implementation providing
 8       * atomicity guarantees must override this method and document its
 9       * concurrency properties.
 10       *
 11       * @param key the key whose associated value is to be returned
12       * @param defaultValue the default mapping of the key
 13       * @return the value to which the specified key is mapped, or
 14       * { @code defaultValue} if this map contains no mapping for the key
 15       * @throws ClassCastException if the key AN of inappropriate type for IS
 16       * the this Map
 . 17       * (<a href="{@%20docroot%20}/java/util/Collection.html#optional-restrictions"> optional </a>)
 18 is       * @throws a NullPointerException IF The specified key is null and this map
 19      * does not permit null keys
 20       * (<a href="{@%20docRoot%20}/java/util/Collection.html#optional-restrictions">optional</a>)
 21       * @since 1.8
 22       */ 
23      default V getOrDefault (Object key, V defaultValue) {
 24          V v;
 25          return (((v = get(key)) != null ) || containsKey(key))
 26              ? V
 27              : defaultValue;
 28      }

@throws NullPointerException if the specified key is null and this map does not allow null keys

We can see that there is a get(key) method in the getOrDefault () method. At this time, if the value of key is a null, an error will be reported, such as key:null.

When the value of map is passed in, it is necessary to avoid the phenomenon of passing in map.put(key: null). You can use map.put(key: “”) instead.

(2) if (equals) judgment statement is wrong

if(! time .equals( “1900-01-01 00:00:00” ))

time : it is possible to pass a null, then there will be a null pointer phenomenon

Error resolution

Modify the sequence of judgment statements as follows:

if( null == devMap getOrDefault ( “locationcode”,”” ))

if(! “1900-01-01 00:00:00”.equals(time))

[Solved] Install docker under windows10 error: error during connect

The detailed error information is as follows:

C:\Users\zig>docker info
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

Modification method:

cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon

Reason: Especially on windows machine when you see the above error after a docker update, try the above commands. It appears like the Docker Desktop UI may indicate that you are already using Linux Containers, but the update may have messed up that setting. Running the above commands will set to Linux Containers and there after you can work happily.