Tag Archives: java

[Solved] python-sutime Error: the JSON object must be str, bytes or bytearray, not ‘java.lang.String‘

Problems arising

The JSON object must be STR, bytes or byte array, not ‘Java.lang.String’

Solution:

The last in sutime.py is this:

	return json.loads(self._sutime.annotate(input_str, reference_date))
return json.loads(self._sutime.annotate(input_str))

Replace it with:

	return json.loads(str(self._sutime.annotate(input_str, reference_date)))
return json.loads(str(self._sutime.annotate(input_str)))

 

Test sutime package (this part is also referred to the above website)

import json
import os
from sutime import SUTime

if __name__ == '__main__':
    test_case = "I need a desk for tomorrow from 2pm to 3pm"
    # D:/python_projects/SPARQA/common_resources/resources_sutime/python-sutime-master/jars
    jar_files = os.path.join(os.path.dirname('D:/python_projects/SPARQA/common_resources/resources_sutime/python-sutime-master/jars'),'jars')
    sutime = SUTime(jars=jar_files, include_range=True)
    print(json.dumps(sutime.parse(test_case), sort_keys=True, indent=4))

The operation result is:

[
    {
        "end": 26,
        "start": 18,
        "text": "tomorrow",
        "type": "DATE",
        "value": "2021-12-31"
    },
    {
        "end": 35,
        "start": 32,
        "text": "2pm",
        "type": "TIME",
        "value": "2021-12-30T14:00"
    },
    {
        "end": 42,
        "start": 39,
        "text": "3pm",
        "type": "TIME",
        "value": "2021-12-30T15:00"
    }
]

Qdox parseexception: syntax error [How to Solve]

preface

Recently, I saw several open source Maven plug-ins that generate Yapi documents. The basic operation is to read the comments in Java code, sort them into corresponding JSON according to the format required by Yapi, and then push them to Yapi server. On a whim, I pulled an open source code library, and then encountered many problems in the process of use, This article talks about how the code parsing library Qbox handles parsing exceptions when parsing code

Open joint

Qbox code base address: https://github.com/paul-hammant/qdox
Exception information thrown

Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error @[10,1] in file:/*****/A.java
    at com.thoughtworks.qdox.parser.impl.Parser.yyerror (Parser.java:1963)
    at com.thoughtworks.qdox.parser.impl.Parser.yyparse (Parser.java:2085)
    at com.thoughtworks.qdox.parser.impl.Parser.parse (Parser.java:1944)
    at com.thoughtworks.qdox.library.SourceLibrary.parse (SourceLibrary.java:232)
    at com.thoughtworks.qdox.library.SourceLibrary.parse (SourceLibrary.java:209)
    at com.thoughtworks.qdox.library.SourceLibrary.addSource (SourceLibrary.java:159)
    at com.thoughtworks.qdox.library.SortedClassLibraryBuilder.addSource (SortedClassLibraryBuilder.java:174)
    at com.thoughtworks.qdox.JavaProjectBuilder.addSource (JavaProjectBuilder.java:151)
    at com.thoughtworks.qdox.JavaProjectBuilder$2.visitFile (JavaProjectBuilder.java:224)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:103)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk (DirectoryScanner.java:91)
    at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan (DirectoryScanner.java:81)
    at com.thoughtworks.qdox.JavaProjectBuilder.addSourceTree (JavaProjectBuilder.java:218)
    at com.thoughtworks.qdox.JavaProjectBuilder.addSourceTree (JavaProjectBuilder.java:205)

Parse exception code file

//package com.example.test.proxy;
//
///**
// *  MyClass
// *
// * @author you_name 2021-12-21 20:02
// */
//public class A {
//}  // line 9  line 10 is blank line

 

Solution:

        JavaProjectBuilder builder = new JavaProjectBuilder();
        builder.setErrorHandler((e) -> log.warn(e.getMessage()));

Optimize it.

		JavaProjectBuilder builder = new JavaProjectBuilder();
        builder.setErrorHandler((e) -> {
            if (e.getClass().isAssignableFrom(ParseException.class)) {
                log.warn(e.getMessage());
                return;
            }
            throw e;
        });

SpringBoot :Error parsing HTTP request header [How to Solve]

Most of these problems are container problems. There are two solutions:

1. Maybe the header cache in Tomcat is not enough

  tomcat:
    # URI encoding of tomcat
     uri-encoding: UTF-8
     # tomcat maximum number of threads, the default is 200
     max-threads: 800
     # Tomcat starts the number of threads to initialize, the default value is 25
    min-spare-threads: 30
    max-http-form-post-size: 2MB
    max-http-header-size: 8096

2. If it hasn’t been solved

@Configuration
public class TomcatConfigurer {

    @Bean
    public TomcatServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
        factory.addConnectorCustomizers((Connector connector) -> {
            connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
            connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
        });
        return factory;
    }

}

Dubbo Frame Write Junit Error: ERROR org.springframework.test.context.Testcontextmanager

Solution:

Since the Dubbo framework is used, on the premise that we confirm that there is no problem with JUnit unit test environment:

First, check whether the Dubbo service is enabled; Secondly, if the test class is written in the consumer module, you need to check whether the provider service is enabled;

Start the corresponding service to solve the problem.


Detailed error reporting information is as follows:

[main] ERROR org. springframework. test. context. TestContextManager – Caught exception while allowing TestExecutionListener [org.springframework.test.context.support. DependencyInjectionTestExecutionListener@333398f ] to prepare test instance [com.yangdaxian.test. MyTest@103c97ff ]

Some detailed error messages are as follows:

19:51:44.947 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@333398f] to prepare test instance [com..test.MyTest@103c97ff]
java.lang.IllegalStateException: Failed to load ApplicationContext
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:108) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:246) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:227) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:246) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190) [spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137) [junit-4.12.jar:4.12]
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) [junit-rt.jar:?]
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33) [junit-rt.jar:?]
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221) [junit-rt.jar:?]
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54) [junit-rt.jar:?]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'newsController': Injection of @DubboReference dependencies is failed; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com..service.NewsService. No provider available for the service com..service.NewsService from the url dubbo://192.168.66.1/com.yangziqiang.service.NewsService?application=demo-consumer&dubbo=2.0.2&init=false&interface=com.yangziqiang.service.NewsService&metadata-type=remote&methods=count1,listNews,showMsg&pid=17984&register.ip=192.168.66.1&release=2.7.10&side=consumer&sticky=false&timestamp=1640001099664 to the consumer 192.168.66.1 use dubbo version 2.7.10
	at com.alibaba.spring.beans.factory.annotation.AbstractAnnotationBeanPostProcessor.postProcessPropertyValues(AbstractAnnotationBeanPostProcessor.java:149) ~[spring-context-support-1.0.10.jar:?]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1400) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:849) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:275) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:243) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:99) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:117) ~[spring-test-5.1.5.RELEASE.jar:5.1.5.RELEASE]
	... 24 more
Caused by: java.lang.IllegalStateException: Failed to check the status of the service 

[Solved] Unable to connect to a as user root com.jcraft.jsch.JSchException: Auth failUnable to connect

The specific errors encountered in building Hadoop HA are as follows

com.jcraft.jsch.JSchException: Auth fail
	at com.jcraft.jsch.Session.connect(Session.java:452)
	at org.apache.hadoop.ha.SshFenceByTcpPort.tryFence(SshFenceByTcpPort.java:100)
	at org.apache.hadoop.ha.NodeFencer.fence(NodeFencer.java:97)
	at org.apache.hadoop.ha.ZKFailoverController.doFence(ZKFailoverController.java:532)
	at org.apache.hadoop.ha.ZKFailoverController.fenceOldActive(ZKFailoverController.java:505)
	at org.apache.hadoop.ha.ZKFailoverController.access$1100(ZKFailoverController.java:61)
	at org.apache.hadoop.ha.ZKFailoverController$ElectorCallbacks.fenceOldActive(ZKFailoverController.java:892)
	at org.apache.hadoop.ha.ActiveStandbyElector.fenceOldActive(ActiveStandbyElector.java:902)
	at org.apache.hadoop.ha.ActiveStandbyElector.becomeActive(ActiveStandbyElector.java:801)
	at org.apache.hadoop.ha.ActiveStandbyElector.processResult(ActiveStandbyElector.java:416)
	at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:599)
	at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)
2021-12-27 11:07:20,846 WARN org.apache.hadoop.ha.NodeFencer: Fencing method org.apache.hadoop.ha.SshFenceByTcpPort(null) was unsuccessful.
2021-12-27 11:07:20,846 ERROR org.apache.hadoop.ha.NodeFencer: Unable to fence service by any configured method.
2021-12-27 11:07:20,846 WARN org.apache.hadoop.ha.ActiveStandbyElector: Exception handling the winning of election
java.lang.RuntimeException: Unable to fence NameNode at a/192.168.0.149:8020
	at org.apache.hadoop.ha.ZKFailoverController.doFence(ZKFailoverController.java:533)
	at org.apache.hadoop.ha.ZKFailoverController.fenceOldActive(ZKFailoverController.java:505)
	at org.apache.hadoop.ha.ZKFailoverController.access$1100(ZKFailoverController.java:61)
	at org.apache.hadoop.ha.ZKFailoverController$ElectorCallbacks.fenceOldActive(ZKFailoverController.java:892)
	at org.apache.hadoop.ha.ActiveStandbyElector.fenceOldActive(ActiveStandbyElector.java:902)
	at org.apache.hadoop.ha.ActiveStandbyElector.becomeActive(ActiveStandbyElector.java:801)
	at org.apache.hadoop.ha.ActiveStandbyElector.processResult(ActiveStandbyElector.java:416)
	at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:599)
	at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)
2021-12-27 11:07:20,846 INFO org.apache.hadoop.ha.ActiveStandbyElector: Trying to re-establish ZK session
2021-12-27 11:07:20,851 INFO org.apache.zookeeper.ZooKeeper: Session: 0x37df9b417310059 closed
2021-12-27 11:07:21,852 INFO org.apache.zookeeper.ZooKeeper: Initiating client connection, connectString=a:2181,b:2181,c:2181 sessionTimeout=5000 watcher=org.apache.hadoop.ha.ActiveStandbyElector$WatcherWithClientRef@44a90199
2021-12-27 11:07:21,853 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server b/192.168.0.150:2181. Will not attempt to authenticate using SASL (unknown error)
2021-12-27 11:07:21,854 INFO org.apache.zookeeper.ClientCnxn: Socket connection established to b/192.168.0.150:2181, initiating session
2021-12-27 11:07:21,859 INFO org.apache.zookeeper.ClientCnxn: Session establishment complete on server b/192.168.0.150:2181, sessionid = 0x27df9b3aaf60068, negotiated timeout = 5000
2021-12-27 11:07:21,860 INFO org.apache.zookeeper.ClientCnxn: EventThread shut down
2021-12-27 11:07:21,861 INFO org.apache.hadoop.ha.ActiveStandbyElector: Session connected.
2021-12-27 11:07:21,862 INFO org.apache.hadoop.ha.ActiveStandbyElector: Checking for any old active which needs to be fenced...
2021-12-27 11:07:21,862 INFO org.apache.hadoop.ha.ActiveStandbyElector: Old node exists: 0a096d79636c757374657212026e311a016120d43e28d33e
2021-12-27 11:07:21,864 INFO org.apache.hadoop.ha.ZKFailoverController: Should fence: NameNode at a/192.168.0.149:8020
2021-12-27 11:07:22,866 INFO org.apache.hadoop.ipc.Client: Retrying connect to server: a/192.168.0.149:8020. Already tried 0 time(s); retry policy is RetryUpToMaximumCountWithFixedSleep(maxRetries=1, sleepTime=1000 MILLISECONDS)
2021-12-27 11:07:22,867 WARN org.apache.hadoop.ha.FailoverController: Unable to gracefully make NameNode at a/192.168.0.149:8020 standby (unable to connect)
java.net.ConnectException: Call From b/192.168.0.150 to a:8020 failed on connection exception: java.net.ConnectException: Connection refused; For more details see:  http://wiki.apache.org/hadoop/ConnectionRefused
	at sun.reflect.GeneratedConstructorAccessor26.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.apache.hadoop.net.NetUtils.wrapWithMessage(NetUtils.java:792)
	at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:732)
	at org.apache.hadoop.ipc.Client.call(Client.java:1480)
	at org.apache.hadoop.ipc.Client.call(Client.java:1407)
	at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
	at com.sun.proxy.$Proxy9.transitionToStandby(Unknown Source)
	at org.apache.hadoop.ha.protocolPB.HAServiceProtocolClientSideTranslatorPB.transitionToStandby(HAServiceProtocolClientSideTranslatorPB.java:112)
	at org.apache.hadoop.ha.FailoverController.tryGracefulFence(FailoverController.java:172)
	at org.apache.hadoop.ha.ZKFailoverController.doFence(ZKFailoverController.java:514)
	at org.apache.hadoop.ha.ZKFailoverController.fenceOldActive(ZKFailoverController.java:505)
	at org.apache.hadoop.ha.ZKFailoverController.access$1100(ZKFailoverController.java:61)
	at org.apache.hadoop.ha.ZKFailoverController$ElectorCallbacks.fenceOldActive(ZKFailoverController.java:892)
	at org.apache.hadoop.ha.ActiveStandbyElector.fenceOldActive(ActiveStandbyElector.java:902)
	at org.apache.hadoop.ha.ActiveStandbyElector.becomeActive(ActiveStandbyElector.java:801)
	at org.apache.hadoop.ha.ActiveStandbyElector.processResult(ActiveStandbyElector.java:416)
	at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:599)
	at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:498)
Caused by: java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at org.apache.hadoop.net.SocketIOWithTimeout.connect(SocketIOWithTimeout.java:206)
	at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:531)
	at org.apache.hadoop.net.NetUtils.connect(NetUtils.java:495)
	at org.apache.hadoop.ipc.Client$Connection.setupConnection(Client.java:609)
	at org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:707)
	at org.apache.hadoop.ipc.Client$Connection.access$2800(Client.java:370)
	at org.apache.hadoop.ipc.Client.getConnection(Client.java:1529)
	at org.apache.hadoop.ipc.Client.call(Client.java:1446)
	... 14 more

Here are two possible reasons for this error. You are also welcome to point out the shortcomings and discuss with us.

The first is that SSH secret login is not configured. You can try to report an error and log in with other machines to see if you can successfully log in without secret.

The second is because the parameter of dfs.ha.fencing.methods is sshence, and needs to use fuser command; maybe you do not install  fuser (required for each namenode node)
installation command: Yum - y install psmisc

[Solved] The main method caused an error: Could not deploy Yarn job cluster.

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Could not deploy Yarn job cluster.

Caused by: org.apache.flink.client.deployment.ClusterDeploymentException: Could not deploy Yarn job cluster.

Caused by: org.apache.flink.yarn.YarnClusterDescriptor$YarnDeploymentException: The YARN application unexpectedly switched to state FAILED during deployment.

Diagnostics from YARN: Application application_1640140324841_0003 failed 1 times (global limit =4; local limit is =1) due to AM Container for appattempt_1640140324841_0003_000001 exited with  exitCode: 1
Failing this attempt.Diagnostics: [2021-12-22 11:23:34.422]Exception from container-launch.
Container id: container_e44_1640140324841_0003_01_000001
Exit code: 1
Shell output: main : command provided 1
main : run as user is etl_admin
main : requested yarn user is etl_admin
Getting exit code file…
Creating script paths…
Writing pid file…
Writing to tmp file /data1/yarn/nm/nmPrivate/application_1640140324841_0003/container_e44_1640140324841_0003_01_000001/container_e44_1640140324841_0003_01_000001.pid.tmp
Writing to cgroup task files…
Creating local dirs…
Launching container…

 

Solution:
Look is the flink version of the idea is 1.11.0, the flink version on the cluster is 1.13.1
Directly upgrade the flink version in the idea to 1.13.1, done!

[Solved] Eclipse Update Error: An error occurred while uninstalling session context was…

When updating Eclipse, the following error was reported:

An error occurred while uninstalling session context was:
(profile=D__…_…_eclipse_jee-2021-09_eclipse, phase=org.eclipse.equinox.internal.p2.engine.phases.Uninstall, operand=[R]org.eclipse.platform.ide.executable.win32.win32.x86_64 4.21.0.I20210906-0500 --> null, action=org.eclipse.equinox.internal.p2.touchpoint.natives.actions.CleanupzipAction).
Backup of file D:…eclipse.exe failed.
Can not remove : D:…eclipse.exe

 

Solution:

    1.Run eclipse and Rename eclipse.exe to eclipse.exe.back
    2.Run updates
    3.Updates executed successfully

简而言之就是在启动eclipse后,再把eclipse exe重命名为eclipse.exe.back然后更新。
希望能帮到更新时也有报此错误的童鞋!

[Solved] Error creating bean with name ‘mvcContentNegotiationManager‘: Lookup method resolution failed

Recently, I encountered various strange exceptions when I used idea to build an aggregation project. Here is an exception reported by the operation of its sub module:

The prompt of exception information is:

Error creating bean with name ‘mvcContentNegotiationManager’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean] from ClassLoader [sun.misc.Launcher$ AppClassLoader@18b4aac2 ]

Solution 1:

Check whether the POM file of the sub module depends on the parent class. Of course, many people will find that when wearing the submodule, the POM file of the sub module will automatically depend on the parent class (as shown in the figure below)

If the dependency in the above figure is not automatically generated after inspection, and you have the same exception as me, then the parent project dependency is added to solve the exception with a high probability

After consulting relevant posts on the Internet and repeated experiments for many times, I found that:

This bug is because we created a module with the same name before, and then we removed it. Then we automatically generate webapp module through the skeleton, so that the module generated by the skeleton will completely overwrite your original POM file!!!

Unfortunately, you need the parent project dependency to start the project, then you will have this bug!

The safest and most reliable solution to avoid problem reproduction: check the dependency of POM file every time you create a sub module. If not, solve it manually

Of course, there are various online solutions, but I have tried and found that it can temporarily solve the problem, but it will still be overwritten the next time I use the skeleton to generate a module with the same name

Solution 2 (slightly reliable):

Setting — build — Maven — ignored files, cancel the ignored POM file, and the parent project dependency will be automatically added!

Summary:

The root cause is that we have created modules with the same name before, but they are not really removed There is still a lot of information about deleting modules in the idea, so when creating a new module, the idea will automatically ignore the new module with the same name we wrote

Of course, a large part of the impact is because we use automatic skeleton generation!

[Solved] Error running ‘tomcat:run‘: Cannot run program “tomcat:run“

Error running ‘Tomcat: run’: cannot run program “Tomcat: run” (in directory “D: \ myideaproject \ springmvc \ spring \ Web”): CreateProcess error = 2, the system cannot find the specified file.

reason:

You need to use the MVN Tomcat: run command.

The following problems may occur during operation

The reason may be that there is a problem with Maven’s default Tomcat. The solution is to add a Tomcat plug-in

Add the following codes to pom.xml

<plugin>
  <groupId>org.apache.tomcat.maven</groupId>
  <artifactId>tomcat7-maven-plugin</artifactId>
  <version>2.2</version>
  <configuration>
    <port>8080</port>
    <path>/</path>
  </configuration>
</plugin>

Then start with the MVN tomcat7: run command

[Solved] Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration

org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in mappers/user.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'mappers/user.xml'. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ''.  Cause: java.lang.ClassNotFoundException: Cannot find class: 

This error occurs in the mybatis test for many reasons,
1: it may be the header information error of the mapping file. Correct:
2: there may also be an error in the label of the mapping file. Most of the errors reported in the mapping file are code errors. Just check the code
3: I made an error today because I wrote an extra tag, but the content in the tag was not written

4: The same type of error I encountered yesterday is because I wrote a comment in the where tag

<select>
	<where>
		Write comment here. This error has been encountered twice, as soon as a comment is written inside a tag, an error is reported
	</where>
</select>

These are the mistakes and solutions I met in learning mybatis.