Tag Archives: development language

[Solved] mvn -v error: Unsupported major. minor version 51.0

Mvn – v error: Unsupported major minor version 51.0

Error reason: Maven version and JDK version do not match

java.lang.UnsupportedClassVersionError: org/apache/lucene/store/Directory : Unsupported major.minor version 51.0
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher. Program will exit.

 

Solution:
J2SE 8=52,
J2SE 7=51,
J2SE 6.0=50,
J2SE 5.0=49,
JDK 1.4=48,
JDK 1.3=47,
JDK 1.2=46,
JDK 1.1=45

From the above correspondence can be seen from the jdk7 version error; because the maven version and jdk version is not compatible, I use the maven is 3.3.9, jdk is 1.6.0, and then replaced a jdk1.8.0 version will be able to; specific cmd use echo %JAVA_HOME% command to check their environment variables configured in the version;
Sometimes you will see version 1.8.0 with the java -version command, but you may see a different version of jdk with the echo %JAVA_HOME% command;
This phenomenon is mainly due to a bad personal habit of configuring multiple versions of jdk in environment variables and introducing only one of them in the path, which actually has disadvantages, for example, Tomcat will read the information in environment variables named JAVA_HOME by default, but not JAVA_HOME2;
So it is better to name the environment variable JAVA_HOME, and not to configure more than one jdk;

[Solved] Ubuntu Compile Rust Program Error: failed to run custom build command for openssl-sys v0.9.39

Compiling Rust program in Ubuntu environment reports an error:

failed to run custom build command for openssl sys v0.9.39

Ubuntu version: 20.04

Refer to GitHub’s discussion and there are two possible solutions:

  1. sudo apt install pkg-config
  2. sudo apt install libssl-dev

I use the second method to solve this problem.

[Solved] yii Frame Error: Warning!symlink() has been disabled for security reasons

Error Messages:

A symlink for "/www/wwwroot/www.atepaoutdoors.com/lib/web/mage/requirejs/mixins.js" can't be created and placed to "/www/wwwroot/www.atepaoutdoors.com/pub/static/frontend/Zemez/theme115/en_US/mage/requirejs/mixins.js". Warning!symlink() has been disabled for security reasons

When deploying the PHP project to the PHP environment on the new server, an error occurs: scandir() symlink() has been disabled for security reasons.

 

How to Solve:

In this case, just go to the PHP installation directory, find php.ini, ctrl+F and search for “disable_functions”, and find the following property configuration.

disable_functions = scandir,passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pls. restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen

Delete scandir and symlink from “disable_functions”, save the php.ini file, restart the service, and refresh the page. This will solve the error problem.

[Solved] RuntimeError: NCCL error in: XXX, unhandled system error, NCCL version 2.7.8

Project scenario:

This problem is encountered in distributed training,


Problem description

Perhaps parallel operation is not started???(


Solution:

(1) First, check the server GPU related information. Enter the pytorch terminal to enter the code

python
torch.cuda.is_available()# to see if cuda is available.
torch.cuda.device_count()# to see the number of gpu's.
torch.cuda.get_device_name(0)# to see the gpu name, the device index starts from 0 by default.
torch.cuda.current_device()# return the current device index.

Ctrl+Z Exit
(2) cd enters the upper folder of the file to be run

 CUDA_VISIBLE_DEVICES=0,1,2,3,4,5 python -m torch.distributed.launch --nproc_per_node=6 #启动并行运算

Plus files to run and related configurations

 CUDA_VISIBLE_DEVICES=0,1,2,3,4,5 python -m torch.distributed.launch --nproc_per_node=6  src_nq/create_examples.py --vocab_file ./bert-base-uncased-vocab.txt \--input_pattern "./natural_questions/v1.0/train/nq-train-*.jsonl.gz" \--output_dir ./natural_questions/nq_0.03/\--do_lower_case \--num_threads 24 --include_unknowns 0.03 --max_seq_length 512 --doc_stride 128

Problem-solving!

[Solved] RuntimeError: Error(s) in loading state dict for YOLOX:

After training the model, an error occurs when running the demo.py inference file in YOLOX, and the running code with the error is as follows:

Run Code

python tools/demo.py image -f exps/example/yolox_voc/yolox_voc_s.py -c YOLO_outputs/yolox_voc_s_1/best_ckpt.pth  --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device [cpu/gpu]

Note:

 -f exps/example/yolox_voc/yolox_voc_s.py

This command must match, not the yolox used for testing before training_s.py, which is configured by yourself. If you don’t correct it, you will always report the following errors.

Of course, if the above instructions are OK, this error still occurs, that is, the category corresponding error in the demo.

Take my own example, I use VOC format datasets, but the default in the demo file is COCO_CLASSES, so this will definitely report an error, so we have to change it in the demo.py file.

First, find the file yolox/data/datasets/_init_.py and add the following code to the file.

from .voc_classes import VOC_CLASSES

Then enter tools/demo.py file

About 15 lines, Modify

from yolox.data.datasets import COCO_CLASSES

to

from yolox.data.datasets import VOC_CLASSES

Modify about 100 lines of cls_names in Predictor:

to

Set the function of about 300 lines

Change to

No error will be reported during operation, successful! NICE!

[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!

Room DB Error: AppDatabase_Impl does not exist [How to Solve]

Kotlin tests the use of Android Room, and when calling Room.databaseBuilder in coroutine, it reports an error:

AppDatabase_Impl does not exist

After checking the developer documentation, you can configure it according to the documentation. After thinking deeply, you find that there is a problem with the developer documentation

dependencies {
    val room_version = "2.4.3"

    implementation("androidx.room:room-runtime:$room_version")
    annotationProcessor("androidx.room:room-compiler:$room_version")

    // To use Kotlin annotation processing tool (kapt)
    kapt("androidx.room:room-compiler:$room_version")
    // To use Kotlin Symbol Processing (KSP)
    ksp("androidx.room:room-compiler:$room_version")

    // optional - Kotlin Extensions and Coroutines support for Room
    implementation("androidx.room:room-ktx:$room_version")

    // optional - RxJava2 support for Room
    implementation("androidx.room:room-rxjava2:$room_version")

    // optional - RxJava3 support for Room
    implementation("androidx.room:room-rxjava3:$room_version")

    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation("androidx.room:room-guava:$room_version")

    // optional - Test helpers
    testImplementation("androidx.room:room-testing:$room_version")

    // optional - Paging 3 Integration
    implementation("androidx.room:room-paging:2.5.0-alpha03")
}

The above developer documents give, but when adding dependencies, one dependency is:

 kapt("androidx.room:room-compiler:$room_version")

So the problem lies here. There is a dependency of Kapt, but there is no plugin of Kapt

The final solution:

Modify the configuration of app gradle.build to add the plugin kotlin-kapt, as follows:

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
}

Then confirm the three dependency dependencies related to room:

  implementation("androidx.room:room-runtime:2.4.3")
    annotationProcessor("androidx.room:room-compiler:2.4.3")
    kapt("androidx.room:room-compiler:2.4.3")

Resin Failed to Startup Error: ERROR: transport error 202: bind failed: Address already in use: JVM_Bind Listenin (Two Resins in One PC)

Error content:

ERROR: transport error 202: bind failed: Address already in use: JVM_Bind Listening for transport dt_socket at addres

The cause of the error is obviously port occupation, but I have clearly changed the app_servers in the resin.properties file to a different port.

The reason
The reason is that I modified the jvm_args in the resin.properties file of one of the resins before in order to allow idea to debug the resin service remotely.

Original content

jvm_args  : -Xmx4000m -Xms4000m -XX:ParallelGCThreads=20 -XX:+UseConcMarkSweepGC -XX:-OmitStackTraceInFastThrow -XX:+UseParNewGC -XX:+DisableExplicitGC -javaagent:wagent.jar -javaagent:stophotdeploy.jar -Djdk.tls.ephemeralDHKeySize=2048 -Dfile.encoding=GBK -javaagent:rasp/rasp.jar

I changed it to

jvm_args  : -Xdebug -Xrunjdwp:transport=dt_socket,address=9081,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/resin_gc.log

The other resin service still keeps the original content, so the two services cannot be started, and an error will be reported that the address port is occupied.

 

Solution:

The solution is to configure address= for both resins and set the port differently, or use the original default jvm_args.

Here use the method of configuring address= for both.

The first file.

jvm_args  : -Xdebug -Xrunjdwp:transport=dt_socket,address=9081,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/resin_gc.log

Second file

jvm_args  : -Xdebug -Xrunjdwp:transport=dt_socket,address=9082,server=y,suspend=n -Dcom.sun.management.jmxremote -Xloggc:/var/log/resin_gc.log

[Solved] Frida-server Startup Error: syntax error: unexpected‘(‘

Problem description:

An error will be reported after frida-server-15.2.android-arm64.xz is installed, as follows:

�5�5�5�5�: inaccessible or not found
./fs152201[2]: �: inaccessible or not found
./fs152201[80]: syntax error: unexpected '('

Solution:

The correct way is to switch to root privileges first. Then use the following command . /filename. To summarize, there is a problem with the boot method. The correct one is: . /filename

For example.

redfin:/data/local/tmp # . /fs152201

verification:

1: Premise:

1.1: Install the corresponding version of frida on the PC side

pip  install frida
pip install frida-tools

1.2: Check the version of frida. The server should be installed to the matching version

frida –version

2: Start to verify whether the frida-server installation is successful or not. Execute the following commands in the cmd window. If a list appears, it indicates success.

 frida-ps -U

PHP php-config is not installed error in ubuntu 16 [How to Solve]

Environment

Ubuntu 16.04.1 LTSPHP 7.0.33

Question

When compiling and installing php extensions with php config, it is found that php-config does not exist.

Check whether php-config exists or not?

$ whereis php-config
php-config:

As above, it returns null, indicating that it does not exist.

Solution:

This problem occurs because the php-dev package is not installed. You can install it once.

Install php-dev

$ apt-get install php-dev

If php5 is version, run apt-get install php5-dev.

re-check php-config

$ whereis php-config
php-config: /usr/bin/php-config /usr/bin/php-config7.0 /usr/share/man/man1/php-config.1.gz

As shown above, the installation is successful.

[Solved] o2o Error: addShopImg error:null / character to be escaped is missing

Operating system: Window10

1. During the JUnit test of ShopServiceTest, an error message is reported:addShopImg error:null as follows:

Solution: Modify the configuration information of PathUtil.java.

Check whether the two separators ofprivate static String separator=System. getProperty ("file. separator")are consistent and spelled correctly.

As long as the two separators are consistent and spelled correctly, there will be no null error message

2. The win10 system pops up:addShopImg error: character to be escaped is missing as follows:

Solution: Modify the configuration information of PathUtil.java.

Change all separator in replaceAll to Matcher quoteReplacement(separator)

Finally, the completely correct PathUtil.java source code is attached:

package com.imooc.o2o.util;

import java.util.regex.Matcher;

public class PathUtil {
	private static String separator = System.getProperty("file.separator");
	
	public static String getImgBasePath() {
		String os = System.getProperty("os.name");
		String basePath = "";
		if (os.toLowerCase().startsWith("win")) {
			basePath = "E:/Work/o2o/image";
		} else {
			basePath = "/home/Work/o2o/image";
		}
		basePath = basePath.replaceAll("/", Matcher.quoteReplacement(separator));
		return basePath;
	}
	
	public static String getShopImagePath(long shopId) {
		String imagePath = "upload/item/shop/" + shopId + "/";
		return imagePath.replaceAll("/", Matcher.quoteReplacement(separator));
	}
}