Category Archives: JAVA

[Solved] IDEA Compile Error: java: Compilation failed: internal java compiler error

java: Compilation failed: internal java compiler error

1. view the project jdk(Ctrl+Alt+shift+S)
File ->Project Structure->Project Settings ->Project

2. view the project jdk(Ctrl+Alt+shift+S)
File ->Project Structure->Project Settings -> Modules -> (Name of the project to be modified) -> Sources ->

3. view Java configuration in idea
File ->Setting ->Build,Execution,Deployment -> Compiler -> Java Compiler

4.  Clear IDEA cache, restart IDEA
File -> Invalidate Caches/Restart

5. Reload All Maven Projects

[Solved] react native TypeError: Network request failed Unable to symbolicate stack trace: The stack is null

TypeError: Network request failed

Unable to symbolicate stack trace: The stack is null

Through the analysis, it can be seen that it is a network request problem. In react native, try to find the problem caused by the fetch sending request.

Code for fetch:

fetch('http://localhost:8083/user/getAllUser', {
    method: 'POST',
    headers: {
        "Accept": "application/json",
        "Content-Type": 'application/json',
        "Connection": "close",
        "type": "getUserData",
    },
    mode : "cors",
    body : JSON.stringify({
        page : 1,
        type :0
    })
}) .then((response) => response.json())
    .then((responseJson) => {
        console.log(responseJson);
        return responseJson.movies;
    })
    .catch((error) => {
        console.error(error);
    });
During the test, the error is prompted.
1. the http request received by the Android side must be an ip, i.e. the access address must be an IP address

2. The request header must contain the following

[Solved] Jenkins++:Jenkins Deploy war Pack to tomcat8 Error

The error information is as follows:

End of compilation and packaging
[DeployPublisher][INFO] Attempting to deploy 1 war file(s)
[DeployPublisher][INFO] Deploying /var/lib/jenkins/workspace/web_demo_boot_freestyle/target/web_demo_boot-0.0.1-SNAPSHOT.war to container Tomcat 8.x Remote with context null
ERROR: Build step failed with exception
org.codehaus.cargo.container.ContainerException: Failed to redeploy [/var/lib/jenkins/workspace/web_demo_boot_freestyle/target/web_demo_boot-0.0.1-SNAPSHOT.war]
    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:176)
    at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
    at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
    at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
    at hudson.FilePath.act(FilePath.java:1171)
    at hudson.FilePath.act(FilePath.java:1154)
    at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
    at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
    at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
    at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:47)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:755)
    at hudson.model.Build$BuildExecution.post2(Build.java:178)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:699)
    at hudson.model.Run.execute(Run.java:1913)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:99)
    at hudson.model.Executor.run(Executor.java:432)
Caused by: org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:710)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:882)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:895)
    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:161)
    ... 19 more
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://192.168.1.101:8886/manager/text/list
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:577)
    ... 22 more
org.codehaus.cargo.container.tomcat.internal.TomcatManagerException: The username you provided is not allowed to use the text-based Tomcat Manager (error 403)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:710)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.list(TomcatManager.java:882)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.getStatus(TomcatManager.java:895)
    at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:161)
    at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:81)
    at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:167)
    at hudson.plugins.deploy.CargoContainerAdapter$DeployCallable.invoke(CargoContainerAdapter.java:136)
    at hudson.FilePath.act(FilePath.java:1171)
    at hudson.FilePath.act(FilePath.java:1154)
    at hudson.plugins.deploy.CargoContainerAdapter.redeployFile(CargoContainerAdapter.java:133)
    at hudson.plugins.deploy.PasswordProtectedAdapterCargo.redeployFile(PasswordProtectedAdapterCargo.java:95)
    at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:113)
    at jenkins.tasks.SimpleBuildStep.perform(SimpleBuildStep.java:123)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:78)
    at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:47)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:806)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:755)
    at hudson.model.Build$BuildExecution.post2(Build.java:178)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:699)
    at hudson.model.Run.execute(Run.java:1913)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:99)
    at hudson.model.Executor.run(Executor.java:432)
Caused by: java.io.IOException: Server returned HTTP response code: 403 for URL: http://192.168.1.101:8886/manager/text/list
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at org.codehaus.cargo.container.tomcat.internal.TomcatManager.invoke(TomcatManager.java:577)
    ... 22 more
Build step 'Deploy war/ear to a container' marked build as failure
Finished: FAILURE

Solution:

The permission of the deployment user must be defined as “manager-script” before successful deployment.

You need to modify tomcat-xml.file under the conf files in tomcat.

Restart later

[Solved] Springboot Integrate Swagger2 3.0.0 Error: Failed to start bean ‘documentationPluginsBootstrapper’

Add dependency

<dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-boot-starter</artifactId>
  <version>3.0.0</version>
</dependency>

Write swagger2 configuration class

@Enablewebmvc annotation can solve

Failed to start bean ‘documentationpluginsbootstrapper’

@Configuration
@EnableWebMvc
public class Swagger2Config {
}

test

Start the project and enter the web address

Swagger2.2.x. The website of version x is

http://localhost:8080/swagger-ui.html

For versions of swagger2 after 3.0.0, the website is

http://localhost:8080/swagger-ui/index.html

[Solved] spark-shell Error: java.lang.IllegalArgumentException: java.net.UnknownHostException: namenode

When starting spark shell with spark on yarn, an error is found:

If the host named namenode cannot be found, there should be an error in the configuration file.

After checking, it is found that it is spark defaults The conf file is incorrectly configured. When configuring, the above file is copied directly, resulting in forgetting to modify it to node1, so you must be careful when configuring

Perfect solution after change

I’ve always made low-level mistakes recently. It’s hard 🤦 ‍

[Solved] Spring Error: Artifact spring:war exploded: Error during artifact deployment. See server log for details

Tomcat loading problem

After modifying the name of a class, use idea to automatically modify the name of this class. After modification, an error is reported:

Artifact storage:war exploded: Error during artifact deployment. See server log for details

Solution 1: regenerate the war package

1. In tomcat, delete the war package of the project

2. In idea -> Delete the war package in project settings and repackage it.

3. In tomcat, reload the war package

Method 2: regenerate the web xml

Check the log and find the web.inf under web-inf XML error. Delete web.XML, reconfigure XML

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">

    <servlet>
        <servlet-name>dispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:springmvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

[Solved] Visual Studio Error: Creation of the virtual directory http://localhost:62498/ failed with the error: Filename: \\?C:…………………………

The project is uploaded to the team foundation server, and the following errors occur after others take it out.

Error: Cannot write configuration file due to insufficient permissions.

You will need to manually create this virtual directory in IIS before you can open this project.

From the stack overflow}, I checked the solutions to the corresponding problems and roughly understood the causes.

Cause: the directory of the removed personnel is inconsistent with that of the uploader.

Solution:

In the project folder Vs folder, find the config folder, and open applicationhost.com under the config folder Config file, find the following code after opening, modify the following absolute path to the absolute path on the downloader’s computer, and then save it (all the project files of the child are stored in the visual management folder). It is completely normal after opening.

                <application path="/" applicationPool="Clr4IntegratedAppPool">
                    <virtualDirectory path="/" physicalPath="C:\ABC\IT.ABC\Global\WebApplication\VisualManagement\VisualManagement" />
                </application>

[Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field

This error is due to an error when generating code with mybatisplus codegenerator.

Specific contents:

 1 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mentalityExamServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.paper.demo.mapper.MentalityExamMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
 2     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.13.jar:5.3.13]
 3     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.13.jar:5.3.13]
 4     at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.13.jar:5.3.13]
 5     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.13.jar:5.3.13]
 6     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.13.jar:5.3.13]
 7     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.13.jar:5.3.13]
 8     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.13.jar:5.3.13]
 9     at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.13.jar:5.3.13]
10     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.13.jar:5.3.13]
11     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.13.jar:5.3.13]
12     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.13.jar:5.3.13]
13     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.13.jar:5.3.13]
14     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.13.jar:5.3.13]
15     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.13.jar:5.3.13]
16     at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.1.jar:2.6.1]
17     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[spring-boot-2.6.1.jar:2.6.1]
18     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) ~[spring-boot-2.6.1.jar:2.6.1]
19     at org.springframework.boot.SpringApplication.run(SpringApplication.java:302) ~[spring-boot-2.6.1.jar:2.6.1]
20     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.1.jar:2.6.1]
21     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290) ~[spring-boot-2.6.1.jar:2.6.1]
22     at com.paper.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
23     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
24     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
25     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
26     at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
27     at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.6.1.jar:2.6.1]
28 Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.paper.demo.mapper.MentalityExamMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
29     at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1790) ~[spring-beans-5.3.13.jar:5.3.13]
30     at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1346) ~[spring-beans-5.3.13.jar:5.3.13]
31     at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.13.jar:5.3.13]
32     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.13.jar:5.3.13]
33     ... 25 common frames omitted

Solution:

Just add the @mapper annotation on the interface that inherits the basemapper class

[Solved] SpringBoot Error: Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset.Malforme

Springboot error prompt application YML error

The main error messages are as follows:

Caused by: org. yaml. snakeyaml.error.YAMLException: java.nio.charset.Malforme

Caused by: org.yaml.snakeyaml.error.YAMLException: java.nio.charset. MalformedInputException: Input length = 1

I don’t understand the meaning of the second sentence now, but because I modify the application directly The suffix of the properties file has been changed to application yml

Solution:

Create a new file: application.yml, and then copy the old content, it is done!