尝试编译与包含单个代理的ESB项目相关的.car应用程序时,为什么会收到此Maven错误?

时间:2018-10-12 09:27:18

标签: maven java-ee wso2 wso2esb wso2ei

我正在研究 VFS 概念,并且正在尝试实施本教程: https://docs.wso2.com/pages/viewpage.action?pageId=87712181

但我对此有一些疑问:

使用此示例配置启动ESB(如此处说明:https://docs.wso2.com/display/EI620/Setting+Up+the+ESB+Samples#SettingUptheESBSamples-Startingasample),效果很好:

wso2ei-samples.bat -sn 254

因此,基本上,我的PC上有此文件中定义的 254 示例:

C:\WSO2\EI\6.3.0\samples\service-bus\synapse_sample_254.xml

我认为从上一个 -sn 253 参数开始EI将执行此流程。究竟如何运作?我的想法是将代理放入此文件 synapse_sample_254.xml 中,并在启动EI之后自动部署它。但是,我对此表示不确定。

这样就可以了。

问题是我试图在创建代理的ESB项目中实现此行为,在这种情况下,它不起作用。

我做了什么:

1)我创建一个 ESB配置项目(名为 VFSTest )。

2)在该项目中,我创建一个自定义代理。新建->代理服务->创建新的代理服务。我将“代理服务名称”设置为 VFSProxy 。然后,我选择自定义代理作为代理服务类型下拉列表的值。这样就创建了我的新代理。

3)我为此代理插入以下代码(使用 Source 标签):

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <proxy name="StockQuoteProxy" startOnLoad="true" transports="vfs">
        <target>
            <endpoint>
                <address format="soap12" uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
            <inSequence/>
            <outSequence>
                <property expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.xml')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
                <property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
                <send>
                    <endpoint>
                        <address uri="vfs:file://C:\Users\nobil\OneDrive\Documenti\WSO2\RESOURCES\VFSTest\out"/>
                    </endpoint>
                </send>
            </outSequence>
            <faultSequence/>
        </target>
        <publishWSDL preservePolicy="true" uri="file:samples/service-bus/resources/proxy/sample_proxy_1.wsdl"/>
        <parameter name="transport.PollInterval">15</parameter>
        <parameter name="transport.vfs.FileURI">file://C:\Users\nobil\OneDrive\Documenti\WSO2\RESOURCES\VFSTest\in</parameter>
        <parameter name="transport.vfs.ContentType">text/xml</parameter>
        <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
        <parameter name="transport.vfs.MoveAfterFailure">file://C:\Users\nobil\OneDrive\Documenti\WSO2\RESOURCES\VFSTest\failure</parameter>
        <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
        <parameter name="transport.vfs.FileNamePattern">.*\.xml</parameter>
        <parameter name="transport.vfs.MoveAfterProcess">file://C:\Users\nobil\OneDrive\Documenti\WSO2\RESOURCES\VFSTest\success</parameter>
    </proxy>
</definitions>

(我只替换了上一个示例中与我的PC上的目录和端点有关的同一行,它是相同的代码)。

所以现在我有一个包含此代理的ESB项目。

然后,我创建一个名为 VFSTestCAP 的新复合应用程序项目,然后将以前的 VFSTest ESB项目添加为依赖项。

最后,我选择该 VFSTestCAP 项目的 pom.xml 文件,然后执行运行方式-> Maven安装必须部署在我的服务器上的 .car 应用程序。

问题在于以这种方式执行Maven失败,这是我的堆栈跟踪:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building VFSTestCAP 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml
[INFO] Downloading: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml
[INFO] Downloaded: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml (397 B at 0.3 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml (843 B at 0.6 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-resources-plugin/maven-metadata.xml (843 B at 0.6 KB/sec)
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
[INFO] Downloading: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml (2 KB at 1.4 KB/sec)
[INFO] Downloaded: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml (402 B at 0.5 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-compiler-plugin/maven-metadata.xml (2 KB at 1.3 KB/sec)
[INFO] Downloading: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml
[INFO] Downloaded: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml (491 B at 0.6 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml (2 KB at 2.0 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-surefire-plugin/maven-metadata.xml (2 KB at 2.0 KB/sec)
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
[INFO] Downloading: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
[INFO] Downloaded: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (366 B at 0.5 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (663 B at 0.8 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml (663 B at 0.8 KB/sec)
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
[INFO] Downloading: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml
[INFO] Downloaded: http://dist.wso2.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (394 B at 0.5 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (749 B at 0.9 KB/sec)
[INFO] Downloaded: http://maven.wso2.org/nexus/content/groups/wso2-public/org/apache/maven/plugins/maven-deploy-plugin/maven-metadata.xml (749 B at 0.9 KB/sec)
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/com/example/VFSTest/proxy-service/VFSProxy/1.0.0/VFSProxy-1.0.0.pom
[INFO] Downloading: http://dist.wso2.org/maven2/com/example/VFSTest/proxy-service/VFSProxy/1.0.0/VFSProxy-1.0.0.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/example/VFSTest/proxy-service/VFSProxy/1.0.0/VFSProxy-1.0.0.pom
[WARNING] The POM for com.example.VFSTest.proxy-service:VFSProxy:xml:1.0.0 is missing, no dependency information available
[INFO] Downloading: http://maven.wso2.org/nexus/content/groups/wso2-public/com/example/VFSTest/proxy-service/VFSProxy/1.0.0/VFSProxy-1.0.0.xml
[INFO] Downloading: http://dist.wso2.org/maven2/com/example/VFSTest/proxy-service/VFSProxy/1.0.0/VFSProxy-1.0.0.xml
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/example/VFSTest/proxy-service/VFSProxy/1.0.0/VFSProxy-1.0.0.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.597 s
[INFO] Finished at: 2018-10-12T11:21:42+02:00
[INFO] Final Memory: 20M/295M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project VFSTestCAP: Could not resolve dependencies for project com.example.VFSTestCAP:VFSTestCAP:carbon/application:1.0.0: Could not find artifact com.example.VFSTest.proxy-service:VFSProxy:xml:1.0.0 in wso2-nexus (http://maven.wso2.org/nexus/content/groups/wso2-public/) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

您可以看到错误似乎是:

[ERROR] Failed to execute goal on project VFSTestCAP: Could not resolve dependencies for project com.example.VFSTestCAP:VFSTestCAP:carbon/application:1.0.0: Could not find artifact com.example.VFSTest.proxy-service:VFSProxy:xml:1.0.0 in wso2-nexus (http://maven.wso2.org/nexus/content/groups/wso2-public/) -> [Help 1]

为什么要尝试从Nexus检索VFSProxy?它被定义为XML流在我的ESB项目中。

可能是什么问题?我想念什么?如何修复它并创建我的汽车可部署应用程序?

2 个答案:

答案 0 :(得分:1)

首先,您必须以与capp项目相同的方式构建代理项目。现在,如果您尝试构建capp,它将成功,因为相关的依赖项将在本地maven存储库中。

PS:如果要使用maven生成car文件,则最好使用maven多模块项目。这将首先安装工件,然后相应地安装capp。否则,只需导出capp就足够了。

答案 1 :(得分:1)

您为新代理提供的名称与使用示例代理中的代码复制的名称之间可能存在名称不匹配的情况(如您的帖子中所示)。

当您生成新代理时,Eclipse会自动在artifacts.xml文件中创建一个条目。如果名称与代理代码中的名称不同,则当行家试图解析CAR项目的依赖项时,可能会导致问题。

最好的检查方法是将pom文件中的依赖项与ESB项目中的artifacts.xml进行比较。而且,如果您更改名称,请确保您与实际的代理定义中的名称匹配(以防止将来出现混淆)