Tag Archives: jar

How to Solve Git Error: error: unable to unlink old ‘***.jar‘

1 problem description

When a new branch code (GIT fetch + git checkout – b) is pulled to operate a new local branch, there is a problem (GIT rebase, GIT stash, GIT checkout old branches will not prompt this error, and the same error will be reported on rollback on idea)

2 problem solving

Stop the application (the project is running, and the jar package is referenced, which makes git unable to access). Rollback the jar package in the idea, select the jar package, and click the button

3 problem analysis

The project is running, the jar package is referenced, and git cannot be updated

[Solved] Docker Error: Error response from daemon: driver failed programming external connectivity on endpoint

Error Message:

docker: Error response from daemon: driver failed programming external connectivity on endpoint kibana (16b783b436c6fc895f51866efea8a25c5748f7b3a78db1ec2cb0364e28e7feef): (iptables failed: iptables –wait -t nat -A DOCKER -p tcp -d 0/0 –dport 5601 -j DNAT –to-destination 172.17.0.4:5601 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1)).

Solution:
Docker reboot
You can register the iptables chain
Restart the Docker container

systemctl restart docker

How to Solve JAR pack error: Error resolving template [/userInfo], template might not exist or might not be accessib

This error did not appear when I was running in idea, but it appeared after I typed the project into a jar package and executed the jar package. This error means that the template page cannot be found, but the template page actually exists in my project. The solution to this error is to skip the template page in the controller without starting with “/”.

Example

@Controller
public class userController {

    @Autowired
    private userServiceImpl userService;

    @RequestMapping("/userInfo/{nickname}")
    public Object showBlog(@PathVariable("nickname") String nickname,
                           Model model, HttpServletRequest request){

        User userInfo = userService.getUserInfo(nickname);
        model.addAttribute("userInfo",userInfo);
        return "userInfo";
    }
}

[Solved] Error:Cannot determine path to ‘tools.jar‘ library for 17

Error: cannot determine path to ‘tools. Jar’ library for 17 solution

The error shown above occurs when running a java project. The essence is that the current idea version does not support Java 17.
Solution:
1. Download the JDK supported by the current idea version, such as 14
2. Uninstall the current version of idea and download the latest version of idea

I choose 2.
go to the official website of idea to download the latest version of idea
running the project again succeeds

Failed to get the resources path in the jar package, reporting an error null pointer

Background

The springboot project calls the method of a local jar package and needs the file path under the project resources. The file is stored under resources.

Trial and error process

1. Original code:

First use classloader.getsystemresource ("file name") , and the local operation is normal. However, an error null pointer is reported after the jar package is typed.

2. First modification:

Most people on the Internet say that they use this. Getclass(). Getclassloader(). Getresource() , but they still can’t. the two principles are the same.

3. Second modification:

Another method is to use the file stream to obtain the file, this. Getclass(). Getclassloader(). Getresourceasstream() , but this is to obtain the file directly. It needs to be the file path, but it can’t.

4. Finally:

Use string filepath = system. Getproperty ("user. Dir") + "\ \ file name" , get the path of the jar package, add the file name to get the file address, but you need to put the file in the same file directory as the jar package.

dot
system. Getproperty (“user. Dir”) + “\ double slash in file name” is in Windows environment. If it needs to be changed to “/” in Linux environment.

(at present, we haven’t found a way not to put the documents outside. There is a solution. I hope the bosses will give us their advice!)

When Jenkins deploys the project, GIT reports an error fatal: index file smaller than expected

@When Jenkins deploys the project, GIT reports an error fatal: index file smaller than expectedtoc

Recently, when learning to deploy Jenkins, microservice construction has been reporting errors:

Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://gitee.com/xxx +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout: 
stderr: fatal: index file smaller than expected

	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2450)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2051)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
	at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:573)
	at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:994)
	... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE

The GIT problem found on the Internet is solved as follows:

View links

Because Jenkins uses git deployed on the server to pull the remote warehouse, I handle it according to the above method and re push it. It still doesn’t work.

Later, it was found that the workspace in Jenkins should be cleaned up first, and Jenkins should be pulled from the remote warehouse again. The problem was solved. As shown in the figure:

Interpreter error /com.fasterxml.jackson.databind.JavaType

In the process of rabbitmq docking, after importing the jar package, errors such as mismatch of jar package version and lack of method are reported during compilation;

Processing method: import the missing jar package

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-annotations</artifactId>
  <version>2.9.7</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.9.8</version>
</dependency>
<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.9.8</version>
</dependency>

Failed to read artifact descriptor for com.google.errorprone:javac:jar:9+181-r4173-1

Build failure occurs when Java Maven project is executed.

Full text of error report:

[ERROR] Failed to execute goal com.microsoft.azure:azure-webapp-maven-plugin:1.12.0:config (default-cli) on project spring-petclinic: 
Execution default-cli of goal com.microsoft.azure:azure-webapp-maven-plugin:1.12.0:config failed: Plugin com.microsoft.azure:azure-webapp-maven-plugin:1.12.0 or one of its dependencies could not be resolved: 
Failed to collect dependencies at com.microsoft.azure:azure-webapp-maven-plugin:jar:1.12.0 -> com.microsoft.azure:azure-maven-plugin-lib:jar:1.4.0 -> com.microsoft.azure:azure-tools-common:jar:0.9.0 -> com.google.errorprone:error_prone_core:jar:2.4.0 -> com.google.errorprone:error_prone_check_api:jar:2.4.0 -> com.google.errorprone:javac:jar:9+181-r4173-1: 
Failed to read artifact descriptor for com.google.errorprone:javac:jar:9+181-r4173-1: Could not transfer artifact com.google.errorprone:javac:pom:9+181-r4173-1 from/to aliyunmaven (https://maven.aliyun.com/repository/public): 
Access denied to: https://maven.aliyun.com/repository/public/com/google/errorprone/javac/9+181-r4173-1/javac-9+181-r4173-1.pom -> [Help 1]

resolvent:

reach   https://mvnrepository.com/   Find javac-9 + 181-r4173-1 in and download it   Error Prone Javac

Download in files   Javac-9 + 181-r4173-1.jar to local// Attempted to add dependency in pom.xml, invalid.

Then, execute the following command in CMD:

mvn install:install-file -DgroupId=com.google.errorprone -DartifactId=javac -Dversion=9+181-r4173-1 -Dpackaging=jar -Dfile=C:\Users\Administrator\Downloads\javac-9+181-r4173-1.jar

It can be installed normally.

reference:

https://www.freesion.com/article/74941283048/

When Maven hits the jar package, an error is reported when executing install, and the symbol cannot be found in a line

Record the problems encountered:

Since the problem has been solved before posting, there is no picture, please watch and think patiently!

Today, when preparing to deploy a project with a jar package, an error is reported in install. According to the idea prompt, it is locked in a line of a class

According to the error prompt, I found that I created a new class in package B, and the jar package I am typing is package a,

1. So I checked pom.xml in project a to see if the dependency of package B was introduced. It was confirmed that it had been introduced

2. I thought it might be that I didn’t print jar package for project B, so I tried to package project B first and then print package a