当前位置: 首页 > 知识库问答 >
问题:

Mulesoft安全属性配置键不读取变量

左丘曦
2023-03-14

我试图构建一个使用安全属性配置的Mulesoft应用程序。我创建了一个settings.unencrypted.yaml文件,如下所示:

sftp_username: "unencryptedUsername"
sftp_password: "unencryptedPassword"
sftpUrl: "unencryptedUrl"

单击“测试连接”时,出现以下错误:

org.mule.tooling.client.api.exception.DeploymentException: Couldn't deploy the application
  org.mule.tooling.client.api.exception.DeploymentException: Couldn't deploy the application
  org.mule.tooling.agent.rest.client.exceptions.ToolingServiceAPIException: HTTP 500 Internal Server Error. org.mule.tooling.agent.rest.client.exceptions.model.ErrorEntity@5cbbc3ae[errorType=class java.lang.RuntimeException,errorMessage=Failed to deploy tooling artifact: [application(0feb8b7f-cd8c-46d9-aa0f-f1a746676a39)(C:\StudioWorkspace\.tooling\sftp-monitor8c572465-009e-48e7-9fdf-8cc690b44827)]. Cause: org.mule.runtime.deployment.model.api.DeploymentInitException: PropertyNotFoundException: Couldn't find configuration property value for key ${encryptionKey} from properties provider environment properties provider - within resolver Deployment properties trying to process key encryptionKey - within resolver global-properties configuration attributes trying to process key encryptionKey - within resolver environment properties provider trying to process key encryptionKey,errorDetail=java.lang.RuntimeException: Failed to deploy tooling artifact: [application(0feb8b7f-cd8c-46d9-aa0f-f1a746676a39)(C:\StudioWorkspace\.tooling\sftp-monitor8c572465-009e-48e7-9fdf-8cc690b44827)]. Cause: org.mule.runtime.deployment.model.api.DeploymentInitException: PropertyNotFoundException: Couldn't find configuration property value for key ${encryptionKey} from properties provider environment properties provider - within resolver Deployment properties trying to process key encryptionKey - within resolver global-properties configuration attributes trying to process key encryptionKey - within resolver environment properties provider trying to process key encryptionKey
    at com.mulesoft.agent.services.tooling.MuleAgentToolingService.deployToolingArtifact(MuleAgentToolingService.java:426)
    at com.mulesoft.agent.services.tooling.MuleAgentToolingService.deployToolingApplication(MuleAgentToolingService.java:260)
    at com.mulesoft.agent.external.handlers.tooling.ToolingRequestHandler.lambda$deployToolingApplication$4(ToolingRequestHandler.java:203)
    at com.mulesoft.agent.util.ResponseHelper.response(ResponseHelper.java:88)
    at com.mulesoft.agent.external.handlers.tooling.ToolingRequestHandler.deployToolingApplication(ToolingRequestHandler.java:202)
    at sun.reflect.GeneratedMethodAccessor66.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1028)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:372)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:876)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
    at com.mulesoft.agent.rest.RequestLoggingFilter.doFilter(RequestLoggingFilter.java:95)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1711)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1347)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1678)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1249)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:505)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:781)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:917)
    at java.lang.Thread.run(Thread.java:748)
  Caused by: com.google.common.util.concurrent.UncheckedExecutionException: org.mule.runtime.deployment.model.api.DeploymentInitException: PropertyNotFoundException: Couldn't find configuration property value for key ${encryptionKey} from properties provider environment properties provider - within resolver Deployment properties trying to process key encryptionKey - within resolver global-properties configuration attributes trying to process key encryptionKey - within resolver environment properties provider trying to process key encryptionKey
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2050)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4870)
    at com.mulesoft.agent.services.tooling.MuleAgentToolingService$ApplicationArtifactDeployer.deploy(MuleAgentToolingService.java:613)
    at com.mulesoft.agent.services.tooling.MuleAgentToolingService$ApplicationArtifactDeployer.deploy(MuleAgentToolingService.java:574)
    at com.mulesoft.agent.services.tooling.MuleAgentToolingService.deployToolingArtifact(MuleAgentToolingService.java:416)
    ... 56 more
  Caused by: org.mule.runtime.deployment.model.api.DeploymentInitException: PropertyNotFoundException: Couldn't find configuration property value for key ${encryptionKey} from properties provider environment properties provider - within resolver Deployment properties trying to process key encryptionKey - within resolver global-properties configuration attributes trying to process key encryptionKey - within resolver environment properties provider trying to process key encryptionKey
  Caused by: org.mule.runtime.core.api.config.ConfigurationException: Couldn't find configuration property value for key ${encryptionKey} from properties provider environment properties provider - within resolver Deployment properties trying to process key encryptionKey - within resolver global-properties configuration attributes trying to process key encryptionKey - within resolver environment properties provider trying to process key encryptionKey
  Caused by: org.mule.runtime.config.internal.dsl.model.config.PropertyNotFoundException: Couldn't find configuration property value for key ${encryptionKey} from properties provider environment properties provider - within resolver Deployment properties trying to process key encryptionKey - within resolver global-properties configuration attributes trying to process key encryptionKey - within resolver environment properties provider trying to process key encryptionKey
  ,additionalProperties={}]
    at org.mule.tooling.agent.rest.client.exceptions.ToolingServiceAPIException.newToolingServiceAPIException(ToolingServiceAPIException.java:82)
    at org.mule.tooling.agent.rest.client.exceptions.ToolingServiceAPIException.newToolingServiceAPIException(ToolingServiceAPIException.java:67)
    at org.mule.tooling.agent.rest.client.tooling.applications.Applications.put(Applications.java:101)
    at org.mule.tooling.agent.rest.client.RestAgentToolingService.lambda$deployApplication$5(RestAgentToolingService.java:211)
    at org.mule.tooling.agent.rest.client.service.ServiceFunction.serviceCallWrapper(ServiceFunction.java:28)
    at org.mule.tooling.agent.rest.client.RestAgentToolingService.deployApplication(RestAgentToolingService.java:210)
    at org.mule.tooling.agent.RuntimeToolingService.deployApplication(RuntimeToolingService.java:106)
    at org.mule.tooling.client.internal.metadata.AbstractRuntimeToolingServiceDecorator.deployApplication(AbstractRuntimeToolingServiceDecorator.java:75)
    at org.mule.tooling.client.internal.application.FileSystemArtifactDeployer.lambda$new$2(FileSystemArtifactDeployer.java:61)
    at org.mule.tooling.client.internal.application.FileSystemArtifactDeployer.doInternalDeploy(FileSystemArtifactDeployer.java:81)
    at org.mule.tooling.client.internal.application.AbstractArtifactDeployer.deploy(AbstractArtifactDeployer.java:59)
    at org.mule.tooling.client.internal.application.DefaultApplication.evaluateWithRemoteApplication(DefaultApplication.java:118)
    at org.mule.tooling.client.internal.ApplicationConnectivityTestingService.doTestConnection(ApplicationConnectivityTestingService.java:45)
    at org.mule.tooling.client.internal.AbstractConnectivityTestingService.testConnection(AbstractConnectivityTestingService.java:44)
    at org.mule.tooling.client.internal.AbstractConnectivityTestingService.invokeMethod(AbstractConnectivityTestingService.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mule.tooling.client.bootstrap.internal.reflection.Dispatcher$ToolingCallable.call(Dispatcher.java:241)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
  
    at org.mule.tooling.agent.rest.client.RestAgentToolingService.deployApplication(RestAgentToolingService.java:226)
    at org.mule.tooling.agent.RuntimeToolingService.deployApplication(RuntimeToolingService.java:106)
    at org.mule.tooling.client.internal.metadata.AbstractRuntimeToolingServiceDecorator.deployApplication(AbstractRuntimeToolingServiceDecorator.java:75)
    at org.mule.tooling.client.internal.application.FileSystemArtifactDeployer.lambda$new$2(FileSystemArtifactDeployer.java:61)
    at org.mule.tooling.client.internal.application.FileSystemArtifactDeployer.doInternalDeploy(FileSystemArtifactDeployer.java:81)
    at org.mule.tooling.client.internal.application.AbstractArtifactDeployer.deploy(AbstractArtifactDeployer.java:59)
    at org.mule.tooling.client.internal.application.DefaultApplication.evaluateWithRemoteApplication(DefaultApplication.java:118)
    at org.mule.tooling.client.internal.ApplicationConnectivityTestingService.doTestConnection(ApplicationConnectivityTestingService.java:45)
    at org.mule.tooling.client.internal.AbstractConnectivityTestingService.testConnection(AbstractConnectivityTestingService.java:44)
    at org.mule.tooling.client.internal.AbstractConnectivityTestingService.invokeMethod(AbstractConnectivityTestingService.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mule.tooling.client.bootstrap.internal.reflection.Dispatcher$ToolingCallable.call(Dispatcher.java:241)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

当我在安全属性配置中硬编码密钥时,一切正常。为什么我不能访问传入的变量作为密钥?

共有2个答案

杜霍英
2023-03-14

不幸的是,无法将运行配置与测试连接一起使用。

测试连接只适用于纯文本,因为它是一个简单的设计时工具。

如果您正常运行该应用程序,它应该可以正常工作。

我所知道的唯一解决方法是使用所需属性的环境变量启动Studio。但即便如此,当使用测试连接时,应用程序本身并未启动,因此无法访问安全属性等上下文。

韩宏朗
2023-03-14

早些时候我们都相信这一点。当在测试连接期间作为属性参数传递时,属性文件键值不受支持。加密的安全属性配置也是如此。

我最近观察到,您不必通过运行时部署应用程序来实现测试连接。您可以测试连接并获取元数据,而无需实际部署应用程序。

要完成此操作,请尝试在全局元素中的全局属性中添加属性键和值。

在XML全局元素部分中搜索全局属性

在您的情况下,您需要添加加密密钥作为密钥名称,你的密钥作为全局属性的加密密钥。任何其他键值属性都应遵循相同的方法。

此外,您不必总是在global属性中传递加密密钥。只需编辑Studio exe文件夹中的anypointstudio.ini文件,并添加-D加密密钥=你的密钥。您也可以在运行配置中的环境属性选项卡中传递它。但这最后一种方法不能总是得到保证。

Cheers ! It's gonna work fine.

大多数骡子工作室版本,让它是骡子3. x. x或4. x. x,不太支持像测试连接自动运行数据感知等功能。

 类似资料:
  • These are used to override or specify the security settings when security is enabled. These are the possible settings: 用于当启动安全变量时覆盖或另行指定安全配置.有以下几种可能的配置: PHP_HANDLING - true/false. If set to true, the

  • 若要配置安全性设置,请前往“配置”->“安全性”。 你可以更改用户密码的复杂性要求以提高密码强度,以及强制注销所有其他用户会话。 如果要在 Navicat Monitor 和客户端之间使用加密连接(HTTPS 会话),你可以将 Navicat Monitor 配置为使用 SSL/TLS 协议。请点击“+ 添加证书”并配置以下信息: 名 輸入证书的名。 证书 粘贴证书文件的内容。 私钥 粘贴私钥文件

  • 问题内容: 我正在尝试从我的wildfly配置文件夹中的属性文件中读取特定于部署的信息。我尝试了这个: 但是显然这不起作用,因为配置文件夹不再位于类路径中。现在我找不到一种简单的方法。我最喜欢的是这样的: 到目前为止,我在网上找到的唯一解决方案是制作自己的OSGi模块,但是我相信必须有一种更简单的方法来实现(一个没有OSGi!)。谁能告诉我如何? 问题答案: 如果要从配置目录(例如或)中显式读取文

  • 我在Scala中使用Spring Boot。我想通过@ConfigurationProperties注释读取带有Scala类型的case类的属性。我已经知道我将无法注释Scala case类,因为Spring Boot不支持基于构造的属性注入。但至少我希望将集合(列表和映射)从配置映射到基于Scala的类型。这样我就可以编写一个配置类: 并编写一个配置文件application.yml如下: 这有

  • 我正在使用Java的发送SMS。我已经加载了log4j jar文件,并将文件放置在正确的位置,但它仍然无法读取它,并得到以下异常: 例外文本:

  • 在TIBCO中有全局变量的概念,在Mulesoft中有相同的概念吗? 类似于设置全局变量,以便在运行时或基于环境的部署期间。穆勒索夫有类似的案例吗