函数运行时无法启动-无法加载类型'Microsoft.Azure.ServiceBus.Management.ManagementClient'

时间:2019-12-02 22:55:58

标签: java azure azure-functions spring-cloud-function

我基于Java部署了新版本的Azure函数。现在在Azure门户中特定功能的我的Azure功能资源下有以下错误消息:

Error: The function runtime is unable to start. Microsoft.Azure.WebJobs.ServiceBus: Could not load type 'Microsoft.Azure.ServiceBus.Management.ManagementClient' from assembly 'Microsoft.Azure.ServiceBus, Version=3.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'. Session Id: a9f3c42dbb524ceca2c5158df9460c97 Timestamp: 2019-12-02T18:21:46.680Z

对我来说听起来像是:https://github.com/Azure/azure-functions-host/issues/3363

有趣的是,除了最后一次部署之前对Java的一些小改动外,我什么都没做。功能应用程序版本是否自动更新?

我还通过kudu和日志流(应用程序日志)检查了日志。

日志:

2019-12-02T11:08:04.412 [Information] Starting JobHost 2019-12-02T11:08:04.415 [Information] Starting Host (HostId=functionapp-dtw-worker-dp-master, InstanceId=aaab65a2-acef-4e4c-a8be-c3a1b13a795c, Version=2.0.12888.0, ProcessId=6860, AppDomainId=1, InDebugMode=True, InDiagnosticMode=False, FunctionsExtensionVersion=~2) 2019-12-02T11:08:04.467 [Information] Loading functions metadata 2019-12-02T11:08:04.495 [Information] 3 functions loaded 2019-12-02T11:08:04.812 [Information] Generating 3 job function(s) 2019-12-02T11:08:05.126 [Information] Found the following functions: Host.Functions.lastWillCronJobProcessor Host.Functions.serviceBusDeadLetterProcessor Host.Functions.serviceBusProcessor 2019-12-02T11:08:05.351 [Error] A host error has occurred during startup operation '7c3d76bc-730c-401a-86cb-27d04231d515'. System.TypeLoadException : Could not load type 'Microsoft.Azure.ServiceBus.Management.ManagementClient' from assembly 'Microsoft.Azure.ServiceBus, Version=3.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'. at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusScaleMonitor..ctor(String functionId,EntityType entityType,String entityPath,String connectionString,Lazy1 receiver,ILoggerFactory loggerFactory)
at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener.<.ctor>b__18_0()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication,Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at Microsoft.Azure.WebJobs.ServiceBus.Listeners.ServiceBusListener.GetMonitor() at Microsoft.Azure.WebJobs.Host.Listeners.HostListenerFactory.RegisterScaleMonitor(IListener listener,IScaleMonitorManager monitorManager) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\HostListenerFactory.cs : 107 at async Microsoft.Azure.WebJobs.Host.Listeners.HostListenerFactory.CreateAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\HostListenerFactory.cs : 69 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Host.Listeners.ListenerFactoryListener.StartAsyncCore(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\ListenerFactoryListener.cs : 45 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Host.Listeners.ShutdownListener.StartAsync(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Listeners\ShutdownListener.cs : 29 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.JobHost.StartAsyncCore(CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\JobHost.cs : 101 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.ScriptHost.StartAsyncCore(CancellationToken cancellationToken) at C:\azure-webjobs-sdk-script\src\WebJobs.Script\Host\ScriptHost.cs : 249 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.WebJobsScriptHostService.UnsynchronizedStartHostAsync(ScriptHostStartupOperation activeOperation,Int32 attemptCount,JobHostStartupMode startupMode) at C:\azure-webjobs-sdk-script\src\WebJobs.Script.WebHost\WebJobsScriptHostService.cs : 235

日志流:

与kudu日志文件中的日志相同

您知道为什么它停止工作了吗?我没有诚实的计划。服务总线的任何配置是否触发更改?

在Azure门户中检查解决方案 对于生产中的问题,请在打开错误之前检查Azure门户中常见问题的解决方案。在Azure门户中,导航至功能应用程序=>平台功能=>在打开问题之前,诊断并解决问题和相关的仪表板。

调查信息 请提供以下内容:

时间戳记:2019-12-02T18:21:46.680Z 功能应用程式版本(1.0或2.0):2.0.12888.0(〜2) 功能应用名称:functionapp-dtw-worker-dp-master 应用程序设置: FUNCTIONS_WORKER_RUNTIME:Java 函数名称(适当):serviceBusProcessor 会话ID:a9f3c42dbb524ceca2c5158df9460c97 地区:西欧 相关信息 提供任何相关信息

使用的编程语言:带有Spring Boot的Java,Spring Cloud Functions 链接到源 使用的绑定:ServiceBusTrigger,TimeTrigger

补充:我从这里将本地依赖项(如.NET Core版本)更新为最新的v2.2.8:https://dotnet.microsoft.com/download/dotnet-core/2.2

此更新不会更改错误消息。当我使用maven插件“ azure-functions-maven-plugin” 1.3.4在本地启动该功能时,会遇到相同的错误异常,如下所示:

[12/2/2019 10:44:26 PM] Starting JobHost [12/2/2019 10:44:26 PM] Starting Host (HostId=n900b368-1683948780, InstanceId=889e113f-9129-4a24-8fbf-9b560addd68e, Version=2.0.12888.0, ProcessId=2368, AppDomainId=1, InDebugMode=False, InDiagnosticMode=False, FunctionsExtensionVersion=(null)) [12/2/2019 10:44:26 PM] Loading functions metadata [12/2/2019 10:44:26 PM] 3 functions loaded [12/2/2019 10:44:26 PM] Generating 3 job function(s) [12/2/2019 10:44:26 PM] Found the following functions: [12/2/2019 10:44:26 PM] Host.Functions.lastWillCronJobProcessor [12/2/2019 10:44:26 PM] Host.Functions.serviceBusDeadLetterProcessor [12/2/2019 10:44:26 PM] Host.Functions.serviceBusProcessor [12/2/2019 10:44:26 PM] [12/2/2019 10:44:26 PM] A host error has occurred during startup operation '03187631-f70a-45f5-9c3e-008568c4c6a4'. [12/2/2019 10:44:26 PM] Microsoft.Azure.WebJobs.ServiceBus: Could not load type 'Microsoft.Azure.ServiceBus.Management.ManagementClient' from assembly 'Microsoft.Azure.ServiceBus, Version=3.0.2.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'. [12/2/2019 10:44:26 PM] Stopping JobHost

GitHub问题报告:https://github.com/Azure/azure-functions-host/issues/5317

您对解决这些问题有什么建议吗?

2 个答案:

答案 0 :(得分:0)

似乎部署以某种方式删除了已安装的扩展。从VSCode部署后,TS函数出现相同的错误。作为一种解决方法,我开始使用与用于该应用程序中其他功能的模板相同的模板在同一功能应用程序中创建新功能(例如,Azure Service Bus Topic触发器)。就我而言,这触发了所需扩展名的新安装,并且错误消失了。

答案 1 :(得分:0)

感谢您的提示和技巧!我通过删除错误的bin目录解决了它。有关更多详细信息,请参见:https://github.com/Azure/azure-functions-host/issues/5317

该解决方案的摘录来自:https://github.com/Azure/azure-functions-host/issues/5317

我将“应用程序设置”“ WEBSITE_RUN_FROM_PACKAGE”设置为1,因此我部署了没有bin目录的新版本,现在它又可以正常工作了。非常感谢。

Azure函数(Windows,代码,Java)的详细过程:

  1. mvn全新安装或mvn全新软件包
  2. 从/ target / azure_function //
  3. 中删除bin目录
  4. mvn azure-functions:部署

PS:我正在将Maven插件用于Azure Functions。

pom.xml:

<plugin>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>azure-functions-maven-plugin</artifactId>
        <version>1.3.4</version>
<plugin>