Java 功底 39 格外

在本土运转未有毛病,打包上传到服务器就有标题了,跪求大佬帮助肃清第叁个极度:

1.1足够的概述和继续体系

  1. 老大是什么样?
ErrorstartingApplicationContext.Todisplaytheauto-configurationreportre-runyourapplicationwith'debug'enabled.2019-10-1114:48:42.739ERROR3727---[main]o.s.boot.SpringApplication:Applicationstartupfailedjava.lang.IllegalStateException:FailedtoexecuteCommandLineRunneratorg.springframework.boot.SpringApplication.callRunner(SpringApplication.java:735)atorg.springframework.boot.SpringApplication.callRunners(SpringApplication.java:716)atorg.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:703)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:304)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1118)atorg.springframework.boot.SpringApplication.run(SpringApplication.java:1107)atcom.jdf.gateway.JdfGatewayApplication.main(JdfGatewayApplication.java:24)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atorg.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)atorg.springframework.boot.loader.Launcher.launch(Launcher.java:87)atorg.springframework.boot.loader.Launcher.launch(Launcher.java:50)atorg.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)Causedby:java.lang.RuntimeException:com.netflix.client.ClientExceptionatorg.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:71)atfeign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:97)atfeign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)atfeign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103)atcom.sun.proxy.$Proxy156.getUserPublicKey(UnknownSource)atcom.jdf.auth.client.runner.AuthClientRunner.run(AuthClientRunner.java:32)atorg.springframework.boot.SpringApplication.callRunner(SpringApplication.java:732)...14commonframesomittedCausedby:com.netflix.client.ClientException:nullatcom.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:123)atorg.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient.execute(LoadBalancerFeignClient.java:63)...20commonframesomittedCausedby:java.lang.NullPointerException:nullatcom.netflix.loadbalancer.LoadBalancerContext.reconstructURIWithServer(LoadBalancerContext.java:575)atorg.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancer.reconstructURIWithServer(FeignLoadBalancer.java:105)atorg.springframework.cloud.netflix.feign.ribbon.RetryableFeignLoadBalancer$1.doWithRetry(RetryableFeignLoadBalancer.java:86)atorg.springframework.cloud.netflix.feign.ribbon.RetryableFeignLoadBalancer$1.doWithRetry(RetryableFeignLoadBalancer.java:77)atorg.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)atorg.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164)atorg.springframework.cloud.netflix.feign.ribbon.RetryableFeignLoadBalancer.execute(RetryableFeignLoadBalancer.java:77)atorg.springframework.cloud.netflix.feign.ribbon.RetryableFeignLoadBalancer.execute(RetryableFeignLoadBalancer.java:48)atcom.netflix.client.AbstractLoadBalancerAwareClient$1.call(AbstractLoadBalancerAwareClient.java:109)atcom.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:303)atcom.netflix.loadbalancer.reactive.LoadBalancerCommand$3$1.call(LoadBalancerCommand.java:287)atrx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:231)atrx.internal.util.ScalarSynchronousObservable$3.call(ScalarSynchronousObservable.java:228)atrx.Observable.unsafeSubscribe(Observable.java:10211)atrx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.drain(OnSubscribeConcatMap.java:286)atrx.internal.operators.OnSubscribeConcatMap$ConcatMapSubscriber.onNext(OnSubscribeConcatMap.java:144)atcom.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:185)atcom.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180)atrx.Observable.unsafeSubscribe(Observable.java:10211)atrx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:94)atrx.internal.operators.OnSubscribeConcatMap.call(OnSubscribeConcatMap.java:42)atrx.Observable.unsafeSubscribe(Observable.java:10211)atrx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber$1.call(OperatorRetryWithPredicate.java:127)atrx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.enqueue(TrampolineScheduler.java:73)atrx.internal.schedulers.TrampolineScheduler$InnerCurrentThreadScheduler.schedule(TrampolineScheduler.java:52)atrx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:79)atrx.internal.operators.OperatorRetryWithPredicate$SourceSubscriber.onNext(OperatorRetryWithPredicate.java:45)atrx.internal.util.ScalarSynchronousObservable$WeakSingleProducer.request(ScalarSynchronousObservable.java:276)atrx.Subscriber.setProducer(Subscriber.java:209)atrx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:138)atrx.internal.util.ScalarSynchronousObservable$JustOnSubscribe.call(ScalarSynchronousObservable.java:129)atrx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)atrx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)atrx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)atrx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)atrx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)atrx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)atrx.Observable.subscribe(Observable.java:10307)atrx.Observable.subscribe(Observable.java:10274)atrx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:445)atrx.observables.BlockingObservable.single(BlockingObservable.java:342)atcom.netflix.client.AbstractLoadBalancerAwareClient.executeWithLoadBalancer(AbstractLoadBalancerAwareClient.java:117)...21commonframesomitted

1.1.1 非凡详明

特别是阻碍程序符合规律运维的东东,当有多个百般爆发时,程序管理将会终止,系统将会造成一些错误音信,对于极度的话,最棒的事情是她们力所能致被拍卖。

第三个要命:

1.1.2 案例代码

public class ExceptionDemo {
    public static void main(String[] args) {
        method();
    }

    public static void method() {
        int a = 10;
        int b = 5;
        //b = 0;
        System.out.println(a/b);
    }
}
  1. 怎样时候会发出格外?
org.springframework.beans.factory.BeanCreationNotAllowedException:Errorcreatingbeanwithname'eurekaAutoServiceRegistration':Singletonbeancreationnotallowedwhilesingletonsofthisfactoryareindestruction(DonotrequestabeanfromaBeanFactoryinadestroymethodimplementation!)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:216)atorg.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)atorg.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)atorg.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1078)atorg.springframework.context.event.ApplicationListenerMethodAdapter.getTargetBean(ApplicationListenerMethodAdapter.java:283)atorg.springframework.context.event.ApplicationListenerMethodAdapter.doInvoke(ApplicationListenerMethodAdapter.java:253)atorg.springframework.context.event.ApplicationListenerMethodAdapter.processEvent(ApplicationListenerMethodAdapter.java:177)atorg.springframework.context.event.ApplicationListenerMethodAdapter.onApplicationEvent(ApplicationListenerMethodAdapter.java:140)atorg.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)atorg.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)atorg.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)atorg.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:393)atorg.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:399)atorg.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:347)atorg.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:991)atorg.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)atorg.springframework.cloud.context.named.NamedContextFactory.destroy(NamedContextFactory.java:76)atorg.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:272)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)atorg.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)atorg.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:230)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)atorg.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)atorg.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1006)atorg.springframework.

1.2 JVM 针对十分的私下认可管理格局

那多少个能够生出在运营时(runtime exceptionsState of Qatar,也足以发生在编写翻译时(compile-time exception卡塔尔(قطر‎

1.2.1 JVM暗许如哪儿理特别?

处理方案:
    A:把异常的名称,异常的原因,异常出现的位置等信息在控制台输出
    B:让程序停止执行
  1. 拾壹分的因由

1.2.2 案例代码

public class ExceptionDemo2 {
    public static void main(String[] args) {
        System.out.println("程序开始执行");
        method();
        System.out.println("程序结束执行");
    }

    public static void method() {
        int a = 10;
        int b = 0;
        System.out.println(a/b);
    }
}


控制台:

    java.lang.ArithmeticException:异常的类名,包括包名
     / by zero:异常的原因,被0除
    at com.itheima.ExceptionDemo2.method(ExceptionDemo2.java:17):异常的位置

有一部分缘由会生出特别,例如,下边包车型大巴状态会生出分外,展开二个不设有的公文,互连网连接难点,

1.3 极度管理方案try_catch

操作已经超(Jing Chao卡塔尔过预订义的限制,类公事并未找到等等。

1.3.1 try..catch的格式和施行流程为

格式:
        try {
            可能出现异常的代码;
        }catch(异常类名  变量名) {
            异常的处理代码;
        }
  1. 谬误和特其余区分