Category Archives: Error

Flask Startup Error: s.bind(server_address)PermissionError: [Errno 13] Permission denied

The contents of the error report are as follows:

File "xxx.py", line 4, in <module>  
  app.run(host='0.0.0.0' , port=80 , debug=true,threaded=False)
  File "/home/xxx/.local/lib/python3.6/site-packages/flask/app.py", line 922, in run
    run_simple(t.cast(str, host), port, self, **options)
  File "/home/xxx/.local/lib/python3.6/site-packages/werkzeug/serving.py", line 982, in run_simple
    s.bind(server_address)
PermissionError: [Errno 13] Permission denied

Looking up the relevant information on the Internet, I found that some people said that under the UNIX environment, ports smaller than 1024 can not be bound by ordinary users, and can only be bound by users with root authority, but using sudo command does not work, so it is necessary to bind a port larger than 1024, and the problem is finally solved

Set port to 8080

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

In the project, use gradle to build the project. When we want to change the version of the JDK, the following error is reported:

Information:Using javac 1.8.0_111 to compile java sources
Information:java: javacTask: source release 1.8 requires target release 1.8
Information:java: Errors occurred while compiling module’Spring_1_main’
Information:2018/1/4 18:46-Compilation completed with 1 error and 0 warnings in 3s 768ms
Error:java: Compilation failed: internal java compiler error

In fact, there are a few things that need to be changed:

1. Change the build.gradle file

    sourceCompatibility = 1.8

2. Change the .idea/compiler.xml file

< bytecodeTargetLevel > 
      < module name ="common_main" target ="1.8"  /> 
      < module name ="common_test" target ="1.8"  /> 
      < module name ="questionnaire_main" target ="1.8"  /> 
      < module name =" questionnaire_test" target ="1.8"  /> 
</ bytecodeTargetLevel >

3. Change File->Project Structure->Project Settings->Modules->Project name->Dependencies->Module SDK on the right

4. Set the Target bytecode version of Module in Settings->Buile, Execution, Deployment->Compiler->Java Compiler

Quartz: ERROR threw an unhandled Exception [How to Solve]

The detailed error message is as follows:

 1  2016 - 06 - 28  . 17 : 18 is : 13.366 [DefaultQuartzScheduler_Worker- . 1 ] ERROR org.quartz.core.JobRunShell: 211 - the Job group1.job1 threw AN Unhandled Exception: 
 2  java.lang.NullPointerException
 3      AT com.starunion.java. service.timer.JobEndConference.execute(JobEndConference.java: 45 ) ~[bin/:? ]
 4      at org.quartz.core.JobRunShell.run(JobRunShell.java: 202 ) [quartz- 2.2 . 1 .jar:? ]
 5     org.quartz.simpl.SimpleThreadPool $ WorkerThread.run AT (SimpleThreadPool.java: 573 ) [quartz- 2.2 . . 1 .jar :? ]
 6  2016 - 06 - 28  . 17 : 18 is : 13.374 [DefaultQuartzScheduler_Worker- . 1 ] ERROR org.quartz .core.ErrorLogger: 2425 - Job (group1.job1 threw an exception.
 7  org.quartz.SchedulerException: Job threw an unhandled exception.
 8      at org.quartz.core.JobRunShell.run(JobRunShell.java: 213 ) [quartz- 2.2 . 1 .jar:?]
 9      at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java: 573 ) [quartz- 2.2 . 1 .jar:? ]
 10  Caused by: java.lang.NullPointerException
 11      at com.starunion.java.service .timer.JobEndConference.execute(JobEndConference.java: 45 ) ~[bin/:? ]
 12      at org.quartz.core.JobRunShell.run(JobRunShell.java: 202 ) ~[quartz- 2.2 . 1 .jar:?]

Talk about my solution process:

1. The reason is obvious: the null object is called.

According to the log information, locate the specified line of my Job object class, line 21 in the following figure:

1  @Component
2  public  class JobEndConference implements Job {
3  
4      @Autowired
5      CallableFsExecCmdProc procExecTask;
6  
7      @Override
8      public  void execute(JobExecutionContext JEContext) throws JobExecutionException {
9  
10          JobDataMap map = JEContext.getJobDetail().getJobDataMap();
11  
12          String meetName = (String) map. get ( " meetName " );
13  
14          StringBuffer buff = newStringBuffer();
15          buff.append( " bgapi conference " );
16          buff.append(meetName);
17          buff.append( " kick all " );
18          // buff.append(ConstantUtil.FS_CMD_TAIL); 
19          20          // SocketFsTcp4SendCMD.fsSendCommand(buff.toString()); 
21          procExecTask.setSendCmd(buff.toString());
22          Future<Integer> future = StarProxy.executor.submit(procExecTask);
23          try {
24              future. get ( 5000, TimeUnit.MILLISECONDS);
25          } catch (InterruptedException | ExecutionException | TimeoutException e) {
26              e.printStackTrace();
27          }
28  
29      }
30  
31 }

This object is empty, which means that it has not been properly initialized through Spring annotations.

Make sure that this annotation is written correctly, all other classes are written this way.

2. Where is the problem?

Check up to see how this class is called.

. 1  ......
 2 the JobDetail jobDetail = newJob (JobEndConference. Class ) .withIdentity ( " the jobs that job1 " , " named group1 " ) .setJobData (DM) .build ();
 . 3 ......

The reason is that the object parameter passed in by newJob is not the object loaded by the Spring annotation.

3. Solution:

Method 1. Obtain the JobEndConference object from Spring’s ApplicationContext.

Method 2. Cancel the annotation of JobEndConference itself and parameters, and initialize with new.

[How to Solve] Error: Invalid or corrupt jarfile…

After using IDEA to create a quickstart project through MAVEN and adding Artifacts, it was found that the generated jar package could not be run, and the following error occurred:

Error: Invalid or corrupt jarfile D:\WorkSpace\JavaStudy\*\out\artifacts\*_jar\*.jar

So I tried a lot of methods first, and found that there is no META_INF folder in the jar package at all through comparison, which is the root cause of the jar’s inability to run;

Solutions:

Make sure your MANIFEST.MF is  in : 
src /main/resources/META_INF/ 

NOT 
src /main/java/META_INF/


Problem Analysis:
IDEA, when adding artifacts in File\Project Structure\Artifacts\, the default will be to create a directory under src/main/java/META_INF/, but this directory (src/main/java/) has been marked as Sources Root, compile only.
So you should cut src/main/java/META_INF to src/main/resources/META_INF/, src/main/resources/ is Resources Root and will copy to the out directory

[Solved] Redis startup error Creating Server TCP listening socket 127.0.0.1:6379: bind: No error

When installing Redis under windows, an error is reported at the first startup:

[2368] 21 Apr 02:57:05.611 # Creating Server TCP listening socket 127.0.0.1:6379: bind: No error

Solution: Run in the command line

redis-cli.exe

127.0.0.1:6379>shutdown

not connected>exit

Then re-run redis-server.exe redis.windows.conf, the startup is successful!

Start Redis

Open the command window directly in the directory above, and run:

  1. redis – server redis windows conf

The results on the tragedy, QForkMasterInit: system error caught. error code=0x000005af, message=VirtualAllocEx failed.: unknown error tips: . The reason is the memory allocation problem (if your computer is powerful enough, it may not be a problem). There are two solutions. First: Use --maxmemory commands to limit Redis memory at startup :

  1. redis – server redis windows conf  – maxmemory  200m

The second method is to modify the configuration file redis.windows.conf :

  1. maxmemory  209715200

Note that the unit is byte, after the change is as follows:

Then run redis-server redis.windows.conf it to start:

But here comes the problem again. Redis will be closed when the cmd window is closed. Is it necessary to keep the server open? This is obviously unscientific, let’s see how to deploy on the server.

Deploy Redis

In fact, Redis can be installed as a windows service. It starts automatically after booting. The command is as follows:

  1. redis – server  – service – install redis windows conf

After the installation is complete, you can see that Redis has been used as a windows service:

But after the installation, Redis did not start, the startup command is as follows:

  1. redis – server  – service – start

Stop command:

  1. redis – server  – service – stop

Solution for Visual Studio 2012 compilation error [error C4996:’scanf’: This function or variable may be unsafe.]

When compiling a C language project in VS 2012, if the scanf function is used, the following error will be prompted when compiling:

error C4996:’scanf’: This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

The reason is that Visual C++ 2012 uses more secure run-time library routines. For the new Security CRT functions (that is, those with the “_s” suffix), see:

” Security Enhanced Version of CRT Function “

The solution to this problem is given below:

Method 1: Replace the original old functions with new Security CRT functions.

Method 2: Use the following methods to block this warning:

    1. Define the following macros in the precompiled header file stdafx.h (note: it must be before including any header files):

#define _CRT_SECURE_NO_DEPRECATE

    2. Or declare #pragma warning(disable:4996)

    3. Change the preprocessing definition:

        Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definition, add:

_CRT_SECURE_NO_DEPRECATE

Method three: Method two does not use the more secure CRT function, which is obviously not a good method worth recommending, but we don’t want to change the function names one by one. Here is an easier method:

Define the following macros in the precompiled header file stdafx.h (also before including any header files):

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1

When linking, it will automatically replace the old functions with Security CRT functions.

Note : Although this method uses a new function, it cannot eliminate the warning (see the red letter for the reason). You have to use method two (-_-) at the same time. In other words, the following two sentences should actually be added to the precompiled header file stdafx.h:

#define _CRT_SECURE_NO_DEPRECATE

#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1


Explanation of the cause of the error:

This kind of warning from Microsoft is mainly because of the functions of the C library. Many functions do not perform parameter detection (including out-of-bounds). Microsoft is worried that using these will cause memory exceptions, so it rewrites the functions of the same function. The function of has carried out parameter detection, and it is safer and more convenient to use these new functions. You don’t need to memorize these rewritten functions specifically, because the compiler will tell you the corresponding safe function when it gives a warning for each function. You can get it by checking the warning message. You can also check MSDN for details when you use it.

[Solved] HTTP Error 405.0-Method Not Allowed occurs in the Put operation of the REST service on IIS7.5

WebDAV is a set of extensions of the Hypertext Transfer Protocol (HTTP), which provides a standard for editing and file management between computers on the Internet. Using this protocol, users can perform remote basic file operations through the Web, such as copy, move, delete, etc. . In IIS 7.0, WebDAV is used as an independent extension module and needs to be downloaded separately. In IIS 7.5, WebDAV will be integrated. However, WebDav clicks Put and Delete. So the RESTful services (WCF Data Service, WCF Rest Service, ASP.NET Web API, ASP.NET MVC) deployed on IIS 7.5 are tragic. When a Put request is sent, an HTTP Error 405.0-Method Not Allowed error will occur. Solve The method is also very simple, add the following settings in Web.config:

<system.webServer>
  <modules>
    <remove name="WebDAVModule" />
  </modules>
  <handlers>
    <remove name="WebDAV" />
  </handlers>
</system.webServer>

[Solved] Webpack compilation Error: Cannot find module’webpack-cli/bin/config-yargs’

Problems encountered during operation npm run dev: Error: Cannot find module’webpack-cli/bin/config-yargs’

// package.json
​
"devDependencies": {
    "webpack": "^5.2.0",
    "webpack-cli": "^4.1.0",
    "webpack-dev-server": "^3.11.0"
}

 

Problem solving reference: Error: Cannot find module’webpack-cli/bin/config-yargs’ #1948

If you upgrade webpack to 5. *, and webpack cli to 4. *, an error will be reported:

Error: Cannot find module 'webpack-cli/bin/config-yargs'

Temporary solution: Back off webpack cli to version 3. * for example:

"webpack-cli": "^ 3.3.12"

  Solution:

  1. Uninstall the current webpack-cli npm uninstall webpack-cli

  2. Install webpack-cli 3.* version npm install webpack-cli@3 -D

// package.json
​
"devDependencies": {
    "webpack": "^5.2.0",
    "webpack-cli": "^3.3.12",
    "webpack-dev-server": "^3.11.0"
}

[Solved] (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk.

n error occurred while running Redis today. The error message is as follows:

(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

Redis is configured to save database snapshots, but it currently cannot be persisted to the hard disk. The command used to modify the collection data cannot be used. Please check the detailed error information in the Redis log.

 

the reason:

Forcibly shutting down Redis snapshots results in inability to persist.

 

solution:

After running the config set stop-writes-on-bgsave-error no command , close the configuration item stop-writes-on-bgsave-error to solve the problem.

root@ubuntu:/usr/local/redis/bin# ./redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> lpush myColour “red”
(integer ) 1

[Solved] NDK JNI DETECTED ERROR IN APPLICATION: use of deleted local reference

error reason

Most of the job objects created by jnienv are local variables, which can no longer be used after they are out of function scope

So be sure to turn these variables into global variables, pass them to external pointers or references, and release them when they are used up

correct code


	//char Arrays to jstring
	void toString(const char *charArray, jstring &string) {
	    JNIEnv *env = nullptr;
	    bool detached = JNI::jvm->GetEnv((void **) &env, JNI_VERSION_1_6) == JNI_EDETACHED;
	    if (detached) JNI::jvm->AttachCurrentThread(&env, nullptr);
	    jstring localString = env->NewStringUTF(charArray);
	    string = (jstring) env->NewGlobalRef(localString);
	    if (detached) JNI::jvm->DetachCurrentThread();
	}

	//Calling Methods
	jstring string = nullptr;
	toString(charArray, string);
	//use
	env->CallVoidMethod(interface, onErrorMethod, code, string);
	//release
	env->DeleteGlobalRef(string);
	string = nullptr;

[Solved] Error: The slice reducer for key “auth“ returned undefined during initialization. If the state pas

Error: The slice reducer for key “auth” returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don’t want to set a value for this reducer, you can use null instead of undefined.

Cause: switch (action.type) is not set default

export default function authReducer(state, action) {
    switch (action.type) {
        case SIGNUP:
            return {
                ...state,
                signup: {
                    loaded: false,
                    success: false,
                }
            }
        default:
            return state;    
     }
}

[Solved] Error: Cannot run with sound null safety, because the following dependenciesdon‘t support null safe

Today, I use flutter SDK 2.2.2   +  fish_ Redux: ^ 0.3.4 to encode this error, as shown in the following figure:

After checking, it is caused by the wrong selection of the SDK version,

sdk: ">=2.12.0 <3.0.0" Change to   sdk: ">=2.8.0 <3.0.0"

OK, the version above 2.12 has empty security requirements

pubspec.yaml

name: fish_redux_demo02
description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  #sdk: ">=2.12.0 <3.0.0"
  sdk: ">=2.8.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

  fish_redux: ^0.3.4
  #Demo list of libraries to be used
  dio: ^3.0.9 #network request framework
  json_annotation: ^2.4.0 #json serialization and deserialization for

dev_dependencies:
  flutter_test:
    sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #   - images/a_dot_burr.jpeg
  #   - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages