Tag Archives: servlet

[Solved] error Unable to find the ncurses libraries

When you enter the kernel directory, compile the kernel, and execute make menuconfig, you are prompted as follows:

*** Unable to find the ncurses libraries or the
 *** required header files.
 *** 'make menuconfig' requires the ncurses libraries.
 ***
 *** Install ncurses (ncurses-devel) and try again.
 ***
scripts/kconfig/Makefile:202: recipe for target 'scripts/kconfig/dochecklxdialog' failed
make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
Makefile:520: recipe for target 'menuconfig' failed
make: *** [menuconfig] Error 2

 

How to Solve:

1. Check out .bashrc

2… Solve according to the error: apt-get install ncurses-devel , again with the error.

E: Unable to locate package ncurses-devel

3. The above reason is because the system lacks libncurses library, so install it: sudo apt-get install libncurses-dev

4. Make menuconfig again, successfully: sudo apt-get install libncurses-dev

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

Error Messages:

java: Internal error in the mapping processor: java.lang.NullPointerException  	
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.createManifestUrl(DefaultVersionInformation.java:182)  	
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.openManifest(DefaultVersionInformation.java:153)  	
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.getLibraryName(DefaultVersionInformation.java:129)  	
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.getCompiler(DefaultVersionInformation.java:122)  	
at org.mapstruct.ap.internal.processor.DefaultVersionInformation.fromProcessingEnvironment(DefaultVersionInformation.java:95)  	
at org.mapstruct.ap.internal.processor.DefaultModelElementProcessorContext.<init>(DefaultModelElementProcessorContext.java:50)  
at org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:218)  	
at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:156)  	
at org.jetbrains.jps.javac.APIWrappers$ProcessorWrapper.process(APIWrappers.java:109)  	
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.jetbrains.jps.javac.APIWrappers$1.invoke(APIWrappers.java:213)  	
at org.mapstruct.ap.MappingProcessor.process(Unknown Source)  	
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)  	
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)  
at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)  	
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)  	
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)  	
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)  	
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)  	
at com.sun.tools.javac.main.Main.compile(Main.java:523)  	
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)  	
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)  	
at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:231)  	
at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:501)  	
at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:353)  	
at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:277)  	
at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:231)  	
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1441)  	
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1100)  	at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1224)  	at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066)  	at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:832)  	at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:419)  	at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)  	at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:132)  	at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)  	at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:132)  	at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:219)  	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  	at java.lang.Thread.run(Thread.java:748)  

In the use of MapStruct, idea2020.3 version in the build project error: java: Internal error in the mapping processor: java.lang.NullPointerException

Solution:
Setting –>Build,Execution,Deployment –>Compiler –>User-local build Add the parameter:
-Djps.track.ap.dependencies=false

show dbs Error: [js] uncaught exception: Error: listDatabases failed

When mongo is built with replica set cluster.
If you log into one of the SECONDARY nodes and execute the command show dbs, you will get an error:

2022-08-16T15:20:00.606+0800 E  QUERY    [js] uncaught exception: Error: listDatabases failed:{
    "operationTime" : Timestamp(1660634399, 2),
    "ok" : 0,
    "errmsg" : "not master and slaveOk=false",
    "code" : 13435,
    "codeName" : "NotMasterNoSlaveOk",
    "$clusterTime" : {
        "clusterTime" : Timestamp(1660634399, 2),
        "signature" : {
            "hash" : BinData(0,"NPF356c5NKl0PqHLlmiQ9vey9e4="),
            "keyId" : NumberLong("7101680539345616897")
        }
    }
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs/<@src/mongo/shell/mongo.js:147:19
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:99:12
shellHelper.show@src/mongo/shell/utils.js:906:13
shellHelper@src/mongo/shell/utils.js:790:15
@(shellhelp2):1:1

 

This is because the SECONDARY node does not have the permission to execute the show dbs command.
In this case, there are two solutions
1. Login to the PRIMARY node
2. Use the cluster connection method
mongo –host  testmongo/ip:port,ip:port,ip:port -uusername -p’passwd’ –authenticationDatabase admin

[Solved] Error running tomcat8: Address localhost:80 is already in use

Error running tomcat8: Address localhost:80 is already in use

1. Problems

Tomcat startup error: Error running tomcat8: Address localhost:80 is already in use

2. Solution

2.1 port 8080 is modified

Modify the server.xml file in E:\software\apache-tomcat-8.5.81\conf back.

TomcatJSON parse error: Invalid UTF-8 [How to Solve]

After deployment on the server, it is found that many places report 400 error, which has a unified feature of transmitting Chinese to the back-end interface

Solution:

1. configure the Tomcat server transmission encoding format specification:

Edit the tomcat/conf/server.xml file and add the encoding attribute: URIEncoding=”UTF-8″ to the Connector tag

2. Edit the tocmat/bin/catalina.bat file and add the following attribute: set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8

3. the most important step is to restart through shutdown and startup under the bin directory of Tomcat

How to Solve SSM JSON Chinese Messy Code Issue

Solution:

Add the configuration <mvc:message-converters register-defaults=“true”> in mvc:annotation-driven of sprinmvc-servlet.xml.

The codes are as below:

Unified solution to json Chinese messy code problem<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop
        https://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        https://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <!--springmvc 统一解决json中文乱码问题-->
    <mvc:annotation-driven>
        <mvc:message-converters register-defaults="true">
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <constructor-arg value="UTF-8"/>
            </bean>
            <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
                <property name="objectMapper">
                    <bean class="org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean">
                        <property name="failOnEmptyBeans" value="false"/>
                    </bean>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

</beans>

[Solved] Hive Run SQL error: mapreduce failed to initiate a task

When running sql in hive, mapreduce fails to launch the task, check the log that APPmaster cannot find the hadoop path.
Solution:
Add the following codes in mapred-site.xml, the error will be solved.

<configuration>
<property>
  <name>yarn.app.mapreduce.am.env</name>
  <value>HADOOP_MAPRED_HOME=/opt/apps/hadoop-3.1.1</value>
</property>
<property>
  <name>mapreduce.map.env</name>
  <value>HADOOP_MAPRED_HOME=/opt/apps/hadoop-3.1.1</value>
</property>
<property>
  <name>mapreduce.reduce.env</name>
  <value>HADOOP_MAPRED_HOME=/opt/apps/hadoop-3.1.1</value>
</property>
 
</configuration>

[Solved] BASE64Encoder Error: Cannot resolve symbol ‘BASE64Encoder’

Question:

Cannot resolve symbol ‘BASE64Encoder’

reason:

After jdk9, the official does not support Import sun.misc.Base64encoder.

Solution:

Method 1: reduce the JDK version to less than 1.8. (not recommended)
Method 2: use the official new jar package import java.util Base64.

The purpose of the following Java class is to modify the corresponding coding format of the file name in different browsers to make it display Chinese correctly.

This is done with sun.misc.BASE64Encoder;

Set BASE64Encoder base64encoder = new BASE64Encoder(); Modify to Base64.Encoder encoder = Base64.getencoder();

And change the encode() method to encodeToString(). Nothing else needs to be modified.

In this way, IDEA will not report an error.

[Solved] org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is

Error Messages: org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.setContentLengthLong(J)V

Problem Description

type Exception report

message Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.setContentLengthLong(J)V

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.setContentLengthLong(J)V
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1082)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
   <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>5.2.10.RELEASE</version>
    </dependency>

Solution:

Import the coordinates of javax.servlet-api and spring-webmvc to the same version
Or change it to the version in the image above

IDEA Import Servlet Package Error [How to Solve]

When we use idea to import packages related to servlets, we sometimes encounter errors, which leads to the problem that servlets cannot recognize. In fact, the reason for the problem is very simple, that is, we can’t find packages related to servlets in JDK

Solution:
1. Find the installation directory of Tomcat, here is C:\Program Files\Apache Software Foundation\Tomcat 8.5\lib (Note: not everyone’s directory is this, need to be based on the actual situation of your computer’s installation directory), find the Servlet-api.jar This file, copy it

2. then go to the JDK installation directory: C:\Program Files\Java\jdk1.8.0_241\jre\lib\ext, find the ext folder, and then copy the Servlet-api.jar file just copied to this folder

3. Back to the idea, the problem is solved, if the idea is still reporting errors, restart the idea refresh

[Solved] Error running ‘TomEE 10.0.121‘: The selected directory is not a TomEE hom

Today, I watched the video of Lao Du’s servlet and tried to start the Tomcat server after typing the code. I found this: error running ‘tomee 10.0.121 ‘: the selected directory is not a tomee Hom error.

Then I didn’t look at the error carefully. Subconsciously, I thought my Tomcat path was wrong. I looked it up and found that there was no problem

Finally, take a closer look at the good guy Tomcat created to tomcatee. No wonder it can’t be started.

Solution:

Just change back to normal Tomcat

Finally, click the servlet according to the old Du code

[Solved] Tomcat runs JavaWeb servlet Error 404

Problem description

A new server template project is built with idea. After Tomcat is configured, the access report 404
is accessed

reason

Tomcat cannot load message 404 because war is not loaded

Solution:

An error occurs because the war artifact of this project is not loaded. You need to import this project as a artifact

and then select war_ Compared with war, the structure of the artifact will be consistent with the source directory for easy development

now the URL is the home page of the artifact by default

access