我正在尝试从Mule流中将SSH连接到远程计算机。在Mule 4中,我找不到SSH连接器组件。 参照ule子博客上描述的SSH Connector,我尝试如下创建SSH连接器:
<?xml version="1.0" encoding="UTF-8"?><mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:ssh="http://www.mulesoft.org/schema/mule/ssh"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/ssh http://www.mulesoft.org/schema/mule/ssh/1.2.1/mule-ssh.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd"><ssh:config host="myhost" port="22" timeout="6000" callbackFlowName="callback" shellMode="true" /><http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" doc:id="de27f2e8-04f3-439f-a422-327029a784b2" >
<http:listener-connection host="localhost" port="8081" />
</http:listener-config>
<flow name="exampleFlow">
<http:listener doc:name="Listener" doc:id="e3ba6e70-67cb-40bc-9017-9e036ba74c9a" config-ref="HTTP_Listener_config" path="/"/>
<ssh:send username="myuser" password="mypass" content="pwd" breakLine="true" />
</flow></mule>
这会出现以下错误:
ERROR 2018-07-04 19:49:22,608 [WrapperListener_start_runner] org.mule.runtime.module.deployment.internal.DefaultArchiveDeployer:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Failed to deploy artifact 'ssh1', see below +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
org.mule.runtime.deployment.model.api.DeploymentException: Failed to deploy artifact [ssh1]
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: org.mule.runtime.deployment.model.api.DeploymentInitException: MuleRuntimeException: Can't resolve http://www.mulesoft.org/schema/mule/ssh/1.2.1/mule-ssh.xsd, A dependency or plugin might be missing
Caused by: org.mule.runtime.deployment.model.api.DeploymentInitException: MuleRuntimeException: Can't resolve http://www.mulesoft.org/schema/mule/ssh/1.2.1/mule-ssh.xsd, A dependency or plugin might be missing
Caused by: org.mule.runtime.core.api.config.ConfigurationException: Error loading: ssh1.xml, Can't resolve http://www.mulesoft.org/schema/mule/ssh/1.2.1/mule-ssh.xsd, A dependency or plugin might be missing
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: Error loading: ssh1.xml, Can't resolve http://www.mulesoft.org/schema/mule/ssh/1.2.1/mule-ssh.xsd, A dependency or plugin might be missing
Caused by: org.mule.runtime.api.exception.MuleRuntimeException: Can't resolve http://www.mulesoft.org/schema/mule/ssh/1.2.1/mule-ssh.xsd, A dependency or plugin might be missing
系统规格
不确定我是否缺少任何物品。
有人可以指导如何做到这一点吗?预先感谢。
答案 0 :(得分:0)
虽然我尝试使用许多路由将SSH连接到远程计算机,但有效的方法是用Java构建自定义类。 该Java类是使用JSch库构建的。可以在LINK
查看示例代码。SSH的流程如下:
答案 1 :(得分:0)
这将永远无法进行。本文提到的Mule连接器适用于Mule 3的较旧版本,并且与Mule 4不兼容。它还是一个开源连接器,未由MuleSoft正式维护。
M子4提供了SFTP connector。如果您需要SSH连接器,则需要从头开始创建它,或者像Nagesh答案中那样调用自定义Java代码。您可以使用Java Module来调用Java代码。