Category Archives: Error

[Solved] error: ‘gets’ was not declared in this scope; did you mean ‘fgets’?

Cause of problem

Gets () is no longer supported by the C + + compiler of the submission platform,

Solution:

Method 1: use C language instead

However, the C speech compiler is not affected. Change the header file to C language format and use the C speech compiler to pass.

Method 2: use cin.getline instead

/* Read a line (can contain spaces) until the end of the newline character
 /* Store the first num-1 characters in the array a and end with the character c */
cin.getline(a, num, c);

be careful:

You can also pass in the third parameter C, which ends with ‘\0’ by default

If num is greater than the number of characters read in, it is directly stored in the whole line of string, and then the end of character c is added at the end

Kernel panic: VFS: Unable to mount root fs on 08:08 [How to Solve]

When starting the qcow2 image with QEMU, the virtual machine will give an error prompt

/lib/sym53c8xx.o: init_module: No such device
insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters
ERROR: /bin/insmod exited abnormally!
VFS: Cannot open root device "808" or 08:08
please append a correct "root=" boot option
Kernel panic: VFS: Unable to mount root fs on 08:08

I searched the Internet and couldn’t find a solution

The main problem is that the format of the boot disk is incorrect. If you change it to SCSI format, you can start normally

[Solved] SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.

Recently, log4f was used to integrate SSM, and the added dependencies are as follows:

        <!-- log -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

However, during operation, an error is reported:

Baidu has a lot of problems, most of which are that the jar package of slf4f is not introduced, lack of dependency or scope, but these solutions have no effect on my mistakes. The website inadvertently found the compatibility problem, so it took the compatibility problems of log4j and sl4f as a breakthrough, and finally solved the problem.

Solution: if you try to import dependencies and modify the scope is invalid, it should be a compatibility problem

https://mvnrepository.com Search slf4j-log4j12

Select a log4j version. I choose version 1.7.30 here. After entering, you can see the corresponding log4j version below.

Here: log4j version 1.2.17 corresponds to slf4j version 1.7.30

Import dependencies are as follows

        <!-- log -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.30</version>
        </dependency>

Problem solved!

Failed to execute goal org.apache…….. [How to Solve]

Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project Springboot_03_web: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources failed.

 

Solution:

Modify the springboot configuration file, if it is application.yaml, modify it to application.yml and it can start normally!

[Solved] DOM Add Element to HTML Error: Failed to execute ‘appendChild’ on ‘Node’: parameter 1 is not of type ‘Node’

DOM adds element failed to execute ‘appendChild’ on ‘node’ to HTML: parameter 1 is not of type ‘node’ problem

Problem: failed to execute ‘appendChild’ on ‘node’: parameter 1 is not of type ‘node’

Cause: the parameter of appendChild is a node node, which leads to such a problem. It indicates that the current parameter is not a node, but may be a string.

For example:

In this case, DOM is a string

Solution:

var dom=document.createElement('p');
dom.className='book';
dom.innerHTML='hello world';
document.body.appendChild(dom);

At this point, the DOM is node.

If the added element is a string, create a node using document. Createtextnode().

var dom=document.createTextNode('hello world');

Effect in HTML:

[Solved] System.Data.Entity.Core.EntityException: ‘The underlying provider failed on Open.’

I have a strange problem using EF today

A simple EF query results in an error:

Exception:

System.Data.Entity.Core.EntityException: ‘The underlying provider failed on Open.’

Internal exception 1:

Transactionmanagercommunicationexception: communication with underlying transaction manager failed.

Internal exception 2:

Comexception: the transaction manager is not available. (exception from HResult: 0x8004d01b)

Solution 1:

The permissions given to the current database by the user NT authority\network service of the database.

After the permissions are configured, the query will not report errors.

[Solved] Andriod Studio Run kotlin main Error: Manifest merger failed with multiple errors

Exception prompt:

Manifest merger failed with multiple errors

Android studio version-   Arctic fox

Android Studio Arctic Fox | 2020.3.1 Patch 3

Processing method: modify the default Android SDK version number of the app module – build.gradle build script

My default is 31 – you can download 30 or 29, 28 first

Set setting – Download Android SDK 9 – the corresponding API version number is 28

Modify the API version number of the app module build script, and then synchronize it

Click run again to execute the KT script function

Browser Console Error: Failed to load resource: the server responded with a status of 404()

Today, when learning about the spring MVC framework, we need JSON when making a small demo, so we introduce jQuery files to transmit JSON in the form of Ajax, but the background cannot receive data. After viewing the browser console, the following information is displayed:

This is strange. I clearly introduced jQuery, and the file path is not wrong. Why do you say I didn’t introduce it?After some inspection, it is found that the access mapping of static resources should be configured in the configuration file of spring MVC so that it will not be intercepted by the front-end controller

After adding the mapping, run it again. The background successfully receives the data and returns to the foreground!

[Solved] Hyperledger Fabric Execute assetTransfer.go Error: UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]

In fact, I built the fabric environment in August, but recently I want to build it again under Ubuntu for various reasons. Everything was going well until go run assettransfer.go

Occurrence

Execute the following instructions in sequence:

1 ./network.sh up createChannel
2 ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
3 docker ps   //Can be ignored, mainly to view the current container
4 cd ..
5 cd asset-transfer-basic/application-go
6 go run assetTransfer.go

The following message will appear:

2021/11/26 09:12:03 ============ application-golang starts ============
 [fabsdk/core] 2021/11/26 01:12:03 UTC - cryptosuite.GetDefault -> INFO No default cryptosuite found, using default SW implementation
2021/11/26 09:12:13 Failed to get network: Failed to create new channel client: event service creation failed: could not get chConfig cache reference: QueryBlockConfig failed: QueryBlockConfig failed: queryChaincode failed: Transaction processing for endorser [localhost:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection on target [localhost:7051]: waiting for connection failed: context deadline exceeded
exit status 1

Solution:

Open the application go folder, delete the keystore and wallet folders under the folder, and then re execute go run assettransfer.go.

After re execution, the results are as follows.

You can see that the problem has been solved!

Cause of occurrence

The reason for this problem may be that I ran once before and he generated these two folders. Just delete these two folders.

reminder

In the assettransfer.go code given by fabric, the file name of a place is wrong and needs to be manually changed, otherwise an error will be reported. The place to change is in line 130 of the code. After modification, as shown in the figure.

certPath := filepath.Join(credPath, "signcerts", "[email protected]")

Of course, you can also run again, find the corresponding file name under the error folder, and then change it.

Finally, I would like to thank the author of “fabric appears when trying to use application call: Unknown: access denied: Channel [mychannel] creator org [org1msp]” for enabling me to solve this problem early in the morning.

SpringBoot2.6 Use springfox Error: documentationPluginsBootstrapper

After using Swagger in the latest SpringBoot 2.6 and introducing springfox-swagger2 (version 2.9.2), the project starts reporting that the documentationPluginsBootstrapper cannot be loaded:

ERROR [main][org.springframework.boot.SpringApplication]:819 - Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1290)
at com.ikang.mis.sms.MisSmsApplication.main(MisSmsApplication.java:10)
Caused by: java.lang.NullPointerException: null
at springfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.java:112)
at springfox.documentation.spi.service.contexts.Orderings$8.compare(Orderings.java:109)
at com.google.common.collect.ComparatorOrdering.compare(ComparatorOrdering.java:37)
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.base/java.util.TimSort.sort(TimSort.java:220)
at java.base/java.util.Arrays.sort(Arrays.java:1442)
at com.google.common.collect.Ordering.sortedCopy(Ordering.java:855)
at springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider.requestHandlers(WebMvcRequestHandlerProvider.java:57)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:138)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper$2.apply(DocumentationPluginsBootstrapper.java:135)
at com.google.common.collect.Iterators$7.transform(Iterators.java:750)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47)
at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:47)
at com.google.common.collect.MultitransformedIterator.hasNext(MultitransformedIterator.java:52)
at com.google.common.collect.MultitransformedIterator.hasNext(MultitransformedIterator.java:50)
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:249)
at com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209)
at com.google.common.collect.FluentIterable.toList(FluentIterable.java:614)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.defaultContextBuilder(DocumentationPluginsBootstrapper.java:111)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.buildContext(DocumentationPluginsBootstrapper.java:96)
at springfox.documentation.spring.web.plugins.DocumentationPluginsBootstrapper.start(DocumentationPluginsBootstrapper.java:167)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
... 14 common frames omitted
Process finished with exit code 1

The above error is caused by a bug in Springfox, which is assuming how SpringMVC is built, but this does not always hold true. Specifically, it assumes that MVC’s path matching will use an Ant-based path matcher, rather than a PathPattern-based matcher. PathPattern-based matching is already an option, and is the default option in SpringBoot 2.6.
As described in the Spring Boot 2.6 release notes, you can restore the configuration that Springfox assumes will be used by setting Spring.mvc.pathmatch.matching-strategy to ant path matcher in the application.properties file. Note that this feature only works when Spring Boot’s executor is not used. The executor always uses path pattern-based parsing, regardless of the configured match strategy. If you want to use it with Spring Boot 2.6 and later with the executor, you will need to make changes to Springfox.