Tag Archives: Exception resolution

[Solved] java: Internal error in the mapping processor: java.lang.NullPointerException

1. Background description

Project background: IDEA (2020.3)+Springboot (2.1.5. RELEASE) + maven

Error content: java: Internal error in the mapping processor: java.lang.NullPointerException

2. Error cause

The cause of the error has not been found

3. Solutions

When using mapstruct, IDEA version 2020.3 gives an error when building the project: java: Internal error in the mapping processor: java.lang.NullPointerException

Solution: Modify editor configuration

Path: Setting —> Build,Execution,Deployment –> Compiler –> User-local build process VM options (overrides Shared options)

Configuration content: – Djps.track.ap dependencies=false

As shown in the figure below:

end!

[Solved] Python Error: asyncio RuntimeError: This event loop is already running

In case of an error, the following diagram is given:

Solution:

# download nest_asyncio
pip3 install nest_asyncio

Add the following two lines at the beginning of the asynchronous collaboration code, or in the code:

import nest_asyncio

nest_asyncio.apply()

After consulting the data, it is found that using the Jupiter notebook environment, it is connected to the IPython kernel, and the IPython kernel itself runs on the event loop, while asyncio does not allow nesting of its event loop, so the error message as shown in the above figure will appear.

nest_asyncio exists as a patch for asynchronous operations.

[Solved] Spark Error: ERROR StatusLogger No log4j2 configuration file found

I. introduction

When running Kafka related procedures of spark # project, it was warned that although it did not affect the operation, OCD looked very uncomfortable, so it was cleared immediately.

ERROR StatusLogger No log4j2 configuration file found. 
Using default configuration: logging only errors to the console.

II. Problem-solving

1. Add log4j2.xml

Level can be configured in loggers

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
        </Console>

        <RollingFile name="RollingFile" filename="log/test.log"
                     filepattern="${logPath}/%d{YYYYMMddHHmmss}-fargo.log">
            <PatternLayout pattern="%d{YYYY-MM-dd HH:mm:ss} [%t] %-5p %c{1}:%L - %msg%n" />
            <Policies>
                <SizeBasedTriggeringPolicy size="10 MB" />
            </Policies>
            <DefaultRolloverStrategy max="20" />
        </RollingFile>

    </Appenders>
    <Loggers>
        <Root level="info">
            <AppenderRef ref="Console" />
            <AppenderRef ref="RollingFile" />
        </Root>
    </Loggers>
</Configuration>

2. Add location

Add it to the Src/main/Resources folder and execute MVN install

3. Display

Since the level in the file is set to info, you can see many related logs and modify them yourself

[Solved] org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot

09:06:12.163 [http-nio-9207-exec-6] ERROR c.s.p.c.GlobalExceptionHandler - [exceptionHandler,90] - 发生其他异常,原因是;{}
org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
 at [Source: (PushbackInputStream); line: 1, column: 2] (through reference chain: java.lang.Object[][0])
	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:285)
	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:243)
	at org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:205)
	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:158)
	at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:131)
	at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)
	at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at com.signature.pc.config.HttpServletRequestReplacedFilter.doFilter(HttpServletRequestReplacedFilter.java:35)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token
 at [Source: (PushbackInputStream); line: 1, column: 2] (through reference chain: java.lang.Object[][0])
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1468)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1242)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1148)
	at com.fasterxml.jackson.databind.deser.std.StdDeserializer._parseString(StdDeserializer.java:615)
	at com.fasterxml.jackson.databind.deser.std.StringArrayDeserializer.deserialize(StringArrayDeserializer.java:157)
	at com.fasterxml.jackson.databind.deser.std.StringArrayDeserializer.deserialize(StringArrayDeserializer.java:21)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4526)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3521)
	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:274)
	... 58 common frames omitted

Interface input parameter format:

Front end parameter transfer format

[{"id":"26a0eac8-edb1-43be-9869-4f7c45c0693a"},
{"id":"E3ECF542585749B996EC0C13907E7D94"}]

.
.
.
the problem is obvious. The format of the value passed by the front end is incorrect. What we need is an array of string type, while the data passed by the front end is object type data.

The front-end transmission parameter is changed to:

[
    "30lkbc2b-1c80-46c3-857e-e934e9842c08",
    "E3ECF542585749B996EC0C13907E7D94"
]

That’s it

[Solved] Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerExcepti

 

1、 Background description

Project architecture: spring boot (v2.0.0. Release) + mybatis plus (v3.1.1)

Today, I developed a new function on an old project (running normally). Before adding new functions, the project started and ran normally. As a result, after the development, the project couldn’t start and the background didn’t report any error information. The key is that I didn’t even have a log. For a moment, I couldn’t start it.

2、 Cause analysis

According to the situation analysis, the project can’t be started. Thinking that there must be a problem in starting, a try… Catch… Block is added to the line of starting the project in the starting class (that is, the following code plus).

SpringApplication.run(DailyApplication.class, args);

See if there is an error log.

@Slf4j
@EnableScheduling
@EnableFeignClients(basePackages = "com.iot")
@SpringBootApplication(scanBasePackages={"com.iot"})
@MapperScan({"com.iot.daily.*.dao"})
public class DailyApplication implements ApplicationRunner {

    public static void main(String[] args) {
        try {
            SpringApplication.run(DailyApplication.class, args);
        } catch (Exception e) {
            e.printStackTrace();
            log.error("error: ============== ", e);
        }
    }

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("The daily report system was successfully launched!......");
    }
}

Start the project, and then, as expected, the console displays the error log with the following error message:

Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat

The specific error information will be supplemented later, but now it can’t be reproduced.

3、 Solutions

Here is my project solution, very simple, Maven clean once, and then restart.

end!

Error: could not create the Java virtual machine

Today, I suddenly encountered a very strange error report. Running Java program on the command line reported an error:

Error:Could not create the Java Virtual Machine.
Error:A Fatal exception has occurred,Program will exit.

Baidu later found that it deleted the java.exe 、 javaw.exe 、 javaws.exe These three running files can be deleted.

The specific reason is unknown.

Error:Could not create the Java Virtual Machine.
Error:A Fatal exception has occurred,Program will exit.

Yarn: runtime.ContainerExecutionException : launch container failed

introduction:

After the spark submit submits the task, the code of the dirver side is executed normally, but the program gets stuck in the exciter stage and frequently reports errors until the task fails

 

location:

The log failed location prints a lot of warning:

The initial job did not accept any resources. Please check the cluster UI to make sure that the worker process is registered and has enough resources. The initial analysis is about resources. Then yarn logs pull down the logs to see:

The initial heap size of the JVM exceeds the maximum heap size. Check the task environment to find out the truth

 

solve:

The initial memory of the JVM – XMS (the minimum heap value of heap memory) requires 13g, but Excutor.memory Only 12g is given, so the above problem appears. Modify the script to keep it stable excutor.mermory =The size of – XMS is OK, the problem is solved~

Tips: generally – XMS – Xmx (the maximum heap value of heap memory) can be set the same.

Oracle recommends setting the minimum heap size (-Xms)equal to the maximum heap size (-Xmx) to minimize garbage collections.

 

glassfish:Resource temporarily unavailable in tsStartJavaThread

Today the test server (using glassfish3.1.1) suddenly reported the following exception while deploying the application. -bash: fork: retry: Resource permanently unavailable. If you have no further questions, then you have no further questions.

[ERROR] [ERROR][thread ] Could not start thread Keep-Alive-Timer. Resource temporarily unavailable
[ERROR] Exception in thread "Main Thread" java.lang.OutOfMemoryError: Resource temporarily unavailable in tsStartJavaThread (lifecycle.c:1096).
[ERROR] Java heap 3G reserved, 64M committed
[ERROR] Paged memory=18014398505034060K/18389412K.
[ERROR] Your Java heap size might be set too high.
[ERROR] Try to reduce the Java heap size using -Xmx:<size> (e.g. "
[ERROR]         at java.lang.Thread.start0(Native Method)
[ERROR]         at java.lang.Thread.start(Thread.java:597)
[ERROR]         at sun.net.www.http.KeepAliveCache$1.run(KeepAliveCache.java:89)
[ERROR]         at sun.net.www.http.KeepAliveCache.put(KeepAliveCache.java:75)
[ERROR]         at sun.net.www.http.HttpClient.putInKeepAliveCache(HttpClient.java:370)
[ERROR]         at sun.net.www.http.HttpClient.finished(HttpClient.java:358)
[ERROR]         at sun.net.www.http.ChunkedInputStream.closeUnderlying(ChunkedInputStream.java:196)
[ERROR]         at sun.net.www.http.ChunkedInputStream.processRaw(ChunkedInputStream.java:428)
[ERROR]         at sun.net.www.http.ChunkedInputStream.readAheadNonBlocking(ChunkedInputStream.java:493)
[ERROR]         at sun.net.www.http.ChunkedInputStream.readAhead(ChunkedInputStream.java:584)
[ERROR]         at sun.net.www.http.ChunkedInputStream.available(ChunkedInputStream.java:698)
[ERROR]         at java.io.FilterInputStream.available(FilterInputStream.java:142)
[ERROR]         at java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:196)
[ERROR]         at com.sun.enterprise.util.io.FileUtils.copy(FileUtils.java:915)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteResponseManager.<init>(RemoteResponseManager.java:79)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.handleResponse(RemoteAdminCommand.java:1056)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.handleResponse(RemoteAdminCommand.java:1045)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.access$600(RemoteAdminCommand.java:101)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand$1$1.handleReport(RemoteAdminCommand.java:526)
[ERROR]         at org.glassfish.admin.payload.PayloadFilesManager.processReport(PayloadFilesManager.java:473)
[ERROR]         at org.glassfish.admin.payload.PayloadFilesManager.access$900(PayloadFilesManager.java:93)
[ERROR]         at org.glassfish.admin.payload.PayloadFilesManager$DataRequestType$4.processPart(PayloadFilesManager.java:776)
[ERROR]         at org.glassfish.admin.payload.PayloadFilesManager.processPartsExtended(PayloadFilesManager.java:624)
[ERROR]         at org.glassfish.admin.payload.PayloadFilesManager.processParts(PayloadFilesManager.java:643)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand$1.useConnection(RemoteAdminCommand.java:531)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.doHttpCommand(RemoteAdminCommand.java:700)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.doHttpCommand(RemoteAdminCommand.java:543)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.executeRemoteCommand(RemoteAdminCommand.java:482)
[ERROR]         at com.sun.enterprise.admin.remote.RemoteAdminCommand.executeCommand(RemoteAdminCommand.java:419)
[ERROR]         at com.sun.enterprise.admin.cli.remote.RemoteCommand.executeCommand(RemoteCommand.java:335)
[ERROR]         at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:264)
[ERROR]         at com.sun.enterprise.admin.cli.AsadminMain.executeCommand(AsadminMain.java:306)
[ERROR]         at com.sun.enterprise.admin.cli.AsadminMain.main(AsadminMain.java:238)
[ERROR] [ERROR][thread ] Could not start thread Thread-0. Resource temporarily unavailable
[ERROR] Deployment of /home/javadev/codes/*****************.war failed.
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option 
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".

We first analyzed the abnormal, see “Paged memory = 18014398505034060 k/18389412 k.” immediately startled, thought who is boring and the change of configuration information. Looking at the configuration parameters for the GlassFish startup JVM in the GlassFish console, I found nothing unusual and nothing changed compared to the other configurations. The same configuration worked well on the other test servers, initially eliminating GlassFish and JVM parameter configuration issues.
= “-bash: fork: retry: Resource permanently” (check the number of processes :

 [javadev@snaqi-test3 ~]$ ps -ef|wc -l
 1025

But in the/etc/security/limits the conf javadev user configuration

    javadev             soft    nproc   1024
    javadev             hard    nproc   16384
    javadev             soft    nofile  2048
    javadev             hard    nofile  65536

Obviously the number of user processes has reached the limit of the limit. Change line 1 from 1024 to 2048. Problem solved. In addition, the third line 2048 can be enlarged to prevent the “too many file litres” of the program.

Command not found: ADB appears on Mac

Method one:

    open the MAC terminal, enter CD ~ enter touch.bash_profile [if you don’t have .bash_profile , create this file] enter open.bash_profile [open the file we created, a text edit box should pop up, if this is the first time to configure the environment, Write the following code in the open text editor:
• export ANDROID_HOME=/usr/local/opt/android-sdk
• export PATH=${PATH}:${ANDROID_HOME}/tools
• export PATH=${PATH}:${ANDROID_HOME}/platform-tools
    note that in [4] ANDROID_HOME should be filled in according to its own SDK path, the rest can be copied directly. As for the SDK path, you can open Android Studio and view in the Preference [Android SDK] and enter source.bash_profile in the terminal and enter adb [verify that the configuration is complete and if not show adb: command not found that the configuration is complete]

Method 2:

    make sure whether to install the adb, /Library/Android/SDK/platform - the tools/adb if there is, if there is a skip the following steps, directly to the last step 5; Open [Android Studio]; Open the SDK Manager check 】 【 SDK Platform - the Tools), run the following command on the Mac
    echo export "PATH = ~/Library/Android/SDK/Platform - the Tools: $PATH" & gt; > ~/. Bash_profile
    6. Restart the terminal

after completing the above steps
Note: if ZSH is used, replace .bash_profile with .zshenv
Quote from: https://stackoverflow.com/questions/10303639/adb-command-not-found/45063101#45063101?newreg=f632609fe6154f9580a49153cb0387e5