Tag Archives: java

[Solved] Minio Error: javax.xml.stream.XMLStreamException: ParseError

Invocation of init method failed; nested exception is javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,3]
Message: The tags preceding the root element in the document must be properly formatted.
Caused by: io.minio.errors.XmlParserException: null

Configuration file outgoing error
the 127.0.0.1:9001 port in the configuration is changed to 9000
the 9001 port is a command line operation, so this error is caused

Generate configDataContextRefres Error: Error creating bean with name ‘configDataContextRefresher‘

I have been tortured by this problem for a long time. My solution is as follows. I advise you to read the official documents that should be read, but don’t do it foolishly
first write bootstrap.properties, and then write in the following:

these basic configurations

Then check whether you have introduced this dependency:

I read the error message. One of the error messages is springcloud context. After reading it for a long time, I think I should not have introduced it. However, I see a saying that it is useless to introduce context dependency in the version after 2020. It is necessary to quote the dependency in the above figure to read the configuration of Nacos from here.

Finally, the versions of boot and cloud are posted, and the pro test can run:


org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testApplicat

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testApplication’: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.nos.test.TestApplication$$EnhancerBySpringCGLIB$$c1828724]: Constructor threw exception; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: Invalid numeric type, found: STRING; nested exception is org.bson.BsonInvalidOperationException: Invalid numeric type, found: STRING

Question request: List all the course names that appear in the STUDENT collection (distinct)

 

 public List<String> test6_01(){
        Query query = new Query();
        List<Integer> list_course = mongoTemplate.findDistinct(query,"CID","student_course",Integer.class);
        System.out.println(list_course);
        List<String> list = new ArrayList<>();
        for(Integer i:list_course){
            Query query1 = new Query(Criteria.where("CID").is(i));
            Course course = mongoTemplate.findOne(query1,Course.class,"course");
            list.add(course.getNAME());
        }
        return list;
    }

Org.bson.bsoninvalidoperationexception: invalid numeric type, found: String prompts me to find the wrong data type. Only when the CID found is of string type can I find the data imported in the data. The CID is automatically set to string type.

Then let’s look at the specific usage of finddistinct() in mongodb: you can re query, but you can’t sort.

The method receives 4 or 5 parameters, respectively:

1 query criteria
2 fields to be de duplicated filed
3 collection database table to be queried
4 POJO instance corresponding to collection to be queried
5 return result class (return list of filed fields to be de duplicated)

After modification:

  public List<String> test6_01(){
        Query query = new Query();
        List<String> list_course = mongoTemplate.findDistinct(query,"CID","student_course",String.class);
        System.out.println(list_course);
        List<String> list = new ArrayList<>();
        for(String i:list_course){
            Query query1 = new Query(Criteria.where("CID").is(i));
            Course course = mongoTemplate.findOne(query1,Course.class,"course");
            list.add(course.getNAME());
        }
        return list;
    }

Query results:

[Solved] ERROR org.springframework.boot.SpringApplication – Application run failed org.yaml.snakeyaml.scanner

 ERROR org.springframework.boot.SpringApplication - Application run failed
org.yaml.snakeyaml.scanner.ScannerException: while scanning a tag
 in 'reader', line 7, column 15:
        password: !QAZ2wsx#EDC
                  ^
expected ' ', but found '#' (35)
 in 'reader', line 7, column 23:
        password: !QAZ2wsx#EDC
                          ^

	at org.yaml.snakeyaml.scanner.ScannerImpl.scanTag(ScannerImpl.java:1544)
	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchTag(ScannerImpl.java:954)
	at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:372)
	at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:227)
	at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:586)
	at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:158)
	at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148)
	at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:136)
	at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:257)
	at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:248)
	at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:236)
	at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:162)
	at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:257)
	at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:248)
	at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:236)
	at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:162)
	at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:257)
	at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:248)
	at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:236)
	at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:162)
	at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:95)
	at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:134)
	at org.springframework.boot.env.OriginTrackedYamlLoader$OriginTrackingConstructor.getData(OriginTrackedYamlLoader.java:99)
	at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:512)
	at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:200)
	at org.springframework.beans.factory.config.YamlProcessor.process(YamlProcessor.java:164)
	at org.springframework.boot.env.OriginTrackedYamlLoader.load(OriginTrackedYamlLoader.java:84)
	at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:50)
	at org.springframework.boot.context.config.StandardConfigDataLoader.load(StandardConfigDataLoader.java:48)
	at org.springframework.boot.context.config.StandardConfigDataLoader.load(StandardConfigDataLoader.java:34)
	at org.springframework.boot.context.config.ConfigDataLoaders.load(ConfigDataLoaders.java:102)
	at org.springframework.boot.context.config.ConfigDataImporter.load(ConfigDataImporter.java:118)
	at org.springframework.boot.context.config.ConfigDataImporter.resolveAndLoad(ConfigDataImporter.java:82)
	at org.springframework.boot.context.config.ConfigDataEnvironmentContributors.withProcessedImports(ConfigDataEnvironmentContributors

Check whether there are special characters in the YML configuration file
Username: root
password: “! Qaz2wsx#edc”
add double quotation marks to the password. Because the special characters caused by coding problems cannot be recognized, the database cannot be connected

[Modified] ANTLR4 line 1:14 token recognition error at ‘(‘

Explore the errors reported by antlr4 by yourself:
line 1:14 token recognition error at '('
means that: (the column number needs to be + 1) the symbol recognition error ‘(‘) in 1 row and 14 columns; it means that the symbol ‘(‘) not recognized by G4 rules does not affect the operation
line 1:0 token recognition error at: '7'
in 1 row and 1 column: ‘7’ symbols have no matching rules

[Solved] memcached Install Error: failed to ignore SIGHUP: no error

Memcached installs version 1.4.5
the administrator runs CMD with the following error:

Solution:
on the command line, enter schtasks/create/SC OnStart/TN memcached/TR "'c:\memcached\memcached. Exe '- M 512" , enter
note: C:\memcached\memcached.exe replace your installation address, Please refer to memcached installation for more installation details

See below:

cuda_error_launch_failed: unspecified launch failure [How to Solve]

Problem: error polling for event status: failed to query event: CUDA_error_launch_failed: unspecified launch failure

Troubleshooting: in the past, when my computer was in-depth learning, it automatically quit the program after training several epochs at a time. It can’t continue training. It can’t be a problem with the code, because the code can run directly on Ubuntu. Some people say that the video memory of the graphics card is insufficient, but sometimes it can train the whole network, query the GPU memory and find that the memory is not used during training.

Solution: through consulting the data, it is found that it may be the problem of the graphics card version. The driver version of my computer’s graphics card was 457 before, but there was no such problem after it was upgraded to 471.

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

Idea version 2121.2.1

1. JDK configuration problem

Setting project jdk

Setting module jdk

During the setting of compiler jdkthe clean operation was performed after several settings, resulting in @override error. Later, it was found that the compiler was not checked

use compiler from module target JDK when possible

2. Add in POM file

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>8</source>
                <target>8</target>
            </configuration>
        </plugin>
    </plugins>
</build>

Done!

log4j:WARN Error during default initialization [How to Solve]

Error generation environment

Generated when mybatis sets log4j log

Error description

log4j:ERROR Category option " 1 " not a decimal integer.
java.lang.NumberFormatException: For input string: " 1 "

Error reason

In the log4j.properties file, there are more spaces in the log4j.appender.console.layout.conversionpattern attribute

Solution:

Before modification:

log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{ 1 }:%L - %m%n

After modification:

log4j.appender.console.layout.ConversionPattern =  %d{ABSOLUTE} %5p %c{1}:%L - %m%n

Error: DL failure on line 893 [How to Solve]

In the centos system, after installing jdk-8u60- linux- i586.tar.gz, after configuring the java environment variables in .bash_profile and /etc/profile, restart the server, enter java, and the error message is displayed;

Error: dl failure on line 893
Error: failed /usr/local/java/jdk1.8.0_60/jre/lib/i386/client/libjvm.so, because /usr/local/java/jdk1.8.0_60/jre/lib/i386/client/libjvm.so: cannot restore segment prot after reloc: Permission denied

This is caused by the security mechanism of selinux. To edit the configuration file of selinux, the command is: vim /etc/selinux/config, modify SELINUX=enforcing to SELINUX=disabled reboot the server, and then check it again, and it will be OK.