目录
1.servicemix安装
2.eclipse创建webservice服务
3.eclipse创建集成插件(servicemix-cxf-bc和servicemix-service-assembly)
4.部署集成
5.遇到问题及总结
正文
1.servicemix安装
下载servicemix:
http://archive.apache.org/dist/servicemix/servicemix-3/3.4.1/apache-servicemix-3.4.1.zip
解压到某个路径下,如:D:\service\apache-servicemix-3.4.1
配置系统变量 SERVICEMIX_HOME=D:\service\apache-servicemix-3.4.1
进入bin目录下,运行servicemix.bat便可启动servicemix
[img]http://dl2.iteye.com/upload/attachment/0123/0951/041fde24-eac8-3817-bed1-b82ef5fb095a.png[/img]
2.eclipse创建webservice服务HelloWorld
具体见:http://newjava-sina-cn.iteye.com/blog/2358505
3.eclipse创建集成插件
本实例用到的maven版本为3.3.1,由于maven服务器在国外比较慢。这里首先将私服设置为阿里云,速度相比国外服务器快很多。
具体可见:http://newjava-sina-cn.iteye.com/blog/2358139
3.1 配置maven servicemix的archetype
如果没有servicemix的archetype,需配置本地archetype
配置servicemix的archetypes:
windows->Preferences->maven->archetypes 添加本地archetypes
具体配置内容见附件:[color=red]<servicemix的archetype配置>[/color]
[img]http://dl2.iteye.com/upload/attachment/0123/2086/25d013a8-ea4c-37b8-a19f-676f5ce21edc.png[/img]
默认情况下,servicemix-project-root版本只有最新版
取消勾选左下方的show the last version of archetype only即可看到其他版本
[img]http://dl2.iteye.com/upload/attachment/0123/2084/b052b46f-10a4-3cdd-87c8-6b753824e2a4.png[/img]
3.2 创建名为servicemix-cxf-bc-demo的servicemix-project-root
[img]http://dl2.iteye.com/upload/attachment/0123/2433/69d6845c-415e-3359-b22b-64fca404ee0f.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/2417/6194f823-07eb-3a6c-b4bd-398f32d4b388.png[/img]
3.3 在根项目下创建名为cxf-bc-su-demo的servicemix-cxf-bc-service-unit
3.3.1 创建servicemix-cxf-bc-service-unit
[img]http://dl2.iteye.com/upload/attachment/0123/2419/76bcbcce-e14c-3767-8463-133ad8c348e7.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/2421/610632ee-fd8e-3a7a-878d-70aa62c79ddc.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/2423/0283865a-aeaf-3534-bade-aaea91895fc9.png[/img]
如果出现以下错误:
Could not resolve archetype org.apache.servicemix.tooling:servicemix-cxf-bc-service-unit:2013.01 from any of the configured repositories
查看repo/org/apache/servicemix/tooling/servicemix-cxf-bc-service-unit/2013.01文件夹下面是否有未下载完或中断的文件,如下
[img]http://dl2.iteye.com/upload/attachment/0123/3425/617f88f2-ebda-31ad-a4f4-5dff2299f3e9.png[/img]
删除2013.01文件夹,重新创建maven module,成功下载jar
创建成功后,可能pom.xml的jbi-maven-plugin插件处肯能报:
Plugin execution not covered by lifecycle configuration: org.apache.servicemix.tooling:jbi-maven-plugin:3.2.3:generate-jbi-service-assembly-descriptor (execution: default-generate-jbi-service-assembly-descriptor, phase: generate-resources)
解决如下:
配置windows-preferences-maven-lifecycle mappings,打开文件设置如下,如果有其他内容,添加
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<goals>
<goal>generate-depends-file</goal>
<goal>generate-jbi-service-unit-descriptor</goal>
<goal>generate-jbi-service-assembly-descriptor</goal>
</goals>
<versionRange>[3.2.3,)</versionRange>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
配置完成后,点击"reload workspace lifecycle mapping metadata"
3.3.2 配置代理路径及属性
删除src/main/resources/service.wsdl文件,将HelloWorld项目下WebContent/wsdl/HelloWorld.wsdl文件拷贝到cxf-bc-su-demo/resources目录下,并修改如下:
原配置:
修改后:
修改resources目录下的xbean.xml文件如下
[color=red]并在xbean.xml中添加webservice的命名空间,否则启动时找不到服务
xmlns:ws="http://ws.bill.com" [/color]
[img]http://dl2.iteye.com/upload/attachment/0123/3518/57d15be0-03fa-31a0-b0df-a90500693a74.png[/img]
3.4 在根项目下创建名为cxf-bc-sa-demo的servicemix-service-assembly
3.4.1 创建servicemix-service-assembly
[img]http://dl2.iteye.com/upload/attachment/0123/3522/47befbdc-f707-3451-9e78-80821a77e3c2.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/3524/007f6dab-ac72-3723-ba2e-72893e818f76.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/3526/ed7d91f4-a59b-374d-9196-a8bdd686d869.png[/img]
3.4.2 配置pom.xml
添加如下依赖:
<dependency>
<groupId>org.apache.servicemix.samples</groupId>
<artifactId>cxf-bc-su-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jbi-service-unit</type>
</dependency>
4. 部署集成
在项目跟目录下,执行mvn install
如果BUILD SUCCESS 刷新后,将servicemix-cxf-bc-demo/cxf-bc-sa-demo/target/cxf-bc-sa-demo-0.0.1-SNAPSHOT.jar拷贝到ServiceMix-Home/hotdeloy目录下
右键压缩文件打开 cxf-bc-sa-demo-0.0.1-SNAPSHOT.jar ,如果里面只有一个zip文件。将servicemix-cxf-bc-demo/cxf-bc-su-demo/target/cxf-bc-su-demo-0.0.1-SNAPSHOT.jar拷贝至ServiceMix-Home/hotdeloy目录下,并拖入cxf-bc-sa-demo-0.0.1-SNAPSHOT.jar中
[img]http://dl2.iteye.com/upload/attachment/0123/3530/d9332c2c-28c3-3f94-a3ff-acff787bc243.png[/img]
启动servicemix.bat,并访问http://localhost:8193/HelloWorld/?wsdl
[img]http://dl2.iteye.com/upload/attachment/0123/3532/bbe65190-b29e-3d06-9d7d-e16fc531ab53.png[/img]
5.遇到问题及总结
1.Plugin execution not covered by lifecycle configuration
通过网上拼凑起来的知识点来看,是由于m2e不能识别第三方插件的goal(如:generate-jbi-service-unit-descriptor等),m2e能够自动识别一些常见的goal(如:compile,install等),所以不用在windows-preferences-maven-lifecycle mappings做配置
但是这个错,并不影响最终的mvn install。所以个人以为,不配置也可以,请读者自己调试
2.对于第一个问题,也可以在<plugins/>标签外,套一层<pluginManagement/>,此时pom.xml前面几行可能报org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration) pom.xml
具体解决方案可参看:
http://stackoverflow.com/questions/37555557/m2e-error-in-mavenarchiver-getmanifest
相关博客:
servicemix 7安装使用及camel-cxf代理webservice:
[url]http://newjava-sina-cn.iteye.com/blog/2359797[/url]
参考网站:
http://blog.csdn.net/xue1225go/article/details/4922018
http://blog.163.com/xh_ding/blog/static/1939032892015222368827
http://www.xuehuile.com/blog/c2505fa6aeb3417eae8b680df1d99ec5.html
http://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ
1.servicemix安装
2.eclipse创建webservice服务
3.eclipse创建集成插件(servicemix-cxf-bc和servicemix-service-assembly)
4.部署集成
5.遇到问题及总结
正文
1.servicemix安装
下载servicemix:
http://archive.apache.org/dist/servicemix/servicemix-3/3.4.1/apache-servicemix-3.4.1.zip
解压到某个路径下,如:D:\service\apache-servicemix-3.4.1
配置系统变量 SERVICEMIX_HOME=D:\service\apache-servicemix-3.4.1
进入bin目录下,运行servicemix.bat便可启动servicemix
[img]http://dl2.iteye.com/upload/attachment/0123/0951/041fde24-eac8-3817-bed1-b82ef5fb095a.png[/img]
2.eclipse创建webservice服务HelloWorld
具体见:http://newjava-sina-cn.iteye.com/blog/2358505
3.eclipse创建集成插件
本实例用到的maven版本为3.3.1,由于maven服务器在国外比较慢。这里首先将私服设置为阿里云,速度相比国外服务器快很多。
具体可见:http://newjava-sina-cn.iteye.com/blog/2358139
3.1 配置maven servicemix的archetype
如果没有servicemix的archetype,需配置本地archetype
配置servicemix的archetypes:
windows->Preferences->maven->archetypes 添加本地archetypes
具体配置内容见附件:[color=red]<servicemix的archetype配置>[/color]
[img]http://dl2.iteye.com/upload/attachment/0123/2086/25d013a8-ea4c-37b8-a19f-676f5ce21edc.png[/img]
默认情况下,servicemix-project-root版本只有最新版
取消勾选左下方的show the last version of archetype only即可看到其他版本
[img]http://dl2.iteye.com/upload/attachment/0123/2084/b052b46f-10a4-3cdd-87c8-6b753824e2a4.png[/img]
3.2 创建名为servicemix-cxf-bc-demo的servicemix-project-root
[img]http://dl2.iteye.com/upload/attachment/0123/2433/69d6845c-415e-3359-b22b-64fca404ee0f.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/2417/6194f823-07eb-3a6c-b4bd-398f32d4b388.png[/img]
3.3 在根项目下创建名为cxf-bc-su-demo的servicemix-cxf-bc-service-unit
3.3.1 创建servicemix-cxf-bc-service-unit
[img]http://dl2.iteye.com/upload/attachment/0123/2419/76bcbcce-e14c-3767-8463-133ad8c348e7.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/2421/610632ee-fd8e-3a7a-878d-70aa62c79ddc.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/2423/0283865a-aeaf-3534-bade-aaea91895fc9.png[/img]
如果出现以下错误:
Could not resolve archetype org.apache.servicemix.tooling:servicemix-cxf-bc-service-unit:2013.01 from any of the configured repositories
查看repo/org/apache/servicemix/tooling/servicemix-cxf-bc-service-unit/2013.01文件夹下面是否有未下载完或中断的文件,如下
[img]http://dl2.iteye.com/upload/attachment/0123/3425/617f88f2-ebda-31ad-a4f4-5dff2299f3e9.png[/img]
删除2013.01文件夹,重新创建maven module,成功下载jar
创建成功后,可能pom.xml的jbi-maven-plugin插件处肯能报:
Plugin execution not covered by lifecycle configuration: org.apache.servicemix.tooling:jbi-maven-plugin:3.2.3:generate-jbi-service-assembly-descriptor (execution: default-generate-jbi-service-assembly-descriptor, phase: generate-resources)
解决如下:
配置windows-preferences-maven-lifecycle mappings,打开文件设置如下,如果有其他内容,添加
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<goals>
<goal>generate-depends-file</goal>
<goal>generate-jbi-service-unit-descriptor</goal>
<goal>generate-jbi-service-assembly-descriptor</goal>
</goals>
<versionRange>[3.2.3,)</versionRange>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
配置完成后,点击"reload workspace lifecycle mapping metadata"
3.3.2 配置代理路径及属性
删除src/main/resources/service.wsdl文件,将HelloWorld项目下WebContent/wsdl/HelloWorld.wsdl文件拷贝到cxf-bc-su-demo/resources目录下,并修改如下:
原配置:
<wsdl:service name="HelloWorldService">
<wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorld">
<wsdlsoap:address location="http://localhost:8080/HelloWorld/services/HelloWorld"/>
</wsdl:port>
</wsdl:service>
修改后:
<wsdl:service name="HelloWorldServiceProxy">
<wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorldProxy">
<wsdlsoap:address location="http://localhost:8193/HelloWorld/"/>
</wsdl:port>
</wsdl:service>
修改resources目录下的xbean.xml文件如下
<cxfbc:consumer wsdl="classpath:HelloWorld.wsdl"
service="ws:HelloWorldServiceProxy" endpoint="ws:HelloWorldProxy"
targetEndpoint="ws:HelloWorld" targetService="ws:HelloWorldService" />
<cxfbc:provider
wsdl="http://localhost:8080/HelloWorld/services/HelloWorld?wsdl"
service="ws:HelloWorldService" endpoint="ws:HelloWorld" />
[color=red]并在xbean.xml中添加webservice的命名空间,否则启动时找不到服务
xmlns:ws="http://ws.bill.com" [/color]
[img]http://dl2.iteye.com/upload/attachment/0123/3518/57d15be0-03fa-31a0-b0df-a90500693a74.png[/img]
3.4 在根项目下创建名为cxf-bc-sa-demo的servicemix-service-assembly
3.4.1 创建servicemix-service-assembly
[img]http://dl2.iteye.com/upload/attachment/0123/3522/47befbdc-f707-3451-9e78-80821a77e3c2.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/3524/007f6dab-ac72-3723-ba2e-72893e818f76.png[/img]
[img]http://dl2.iteye.com/upload/attachment/0123/3526/ed7d91f4-a59b-374d-9196-a8bdd686d869.png[/img]
3.4.2 配置pom.xml
添加如下依赖:
<dependency>
<groupId>org.apache.servicemix.samples</groupId>
<artifactId>cxf-bc-su-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jbi-service-unit</type>
</dependency>
4. 部署集成
在项目跟目录下,执行mvn install
如果BUILD SUCCESS 刷新后,将servicemix-cxf-bc-demo/cxf-bc-sa-demo/target/cxf-bc-sa-demo-0.0.1-SNAPSHOT.jar拷贝到ServiceMix-Home/hotdeloy目录下
右键压缩文件打开 cxf-bc-sa-demo-0.0.1-SNAPSHOT.jar ,如果里面只有一个zip文件。将servicemix-cxf-bc-demo/cxf-bc-su-demo/target/cxf-bc-su-demo-0.0.1-SNAPSHOT.jar拷贝至ServiceMix-Home/hotdeloy目录下,并拖入cxf-bc-sa-demo-0.0.1-SNAPSHOT.jar中
[img]http://dl2.iteye.com/upload/attachment/0123/3530/d9332c2c-28c3-3f94-a3ff-acff787bc243.png[/img]
启动servicemix.bat,并访问http://localhost:8193/HelloWorld/?wsdl
[img]http://dl2.iteye.com/upload/attachment/0123/3532/bbe65190-b29e-3d06-9d7d-e16fc531ab53.png[/img]
5.遇到问题及总结
1.Plugin execution not covered by lifecycle configuration
通过网上拼凑起来的知识点来看,是由于m2e不能识别第三方插件的goal(如:generate-jbi-service-unit-descriptor等),m2e能够自动识别一些常见的goal(如:compile,install等),所以不用在windows-preferences-maven-lifecycle mappings做配置
但是这个错,并不影响最终的mvn install。所以个人以为,不配置也可以,请读者自己调试
2.对于第一个问题,也可以在<plugins/>标签外,套一层<pluginManagement/>,此时pom.xml前面几行可能报org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration) pom.xml
具体解决方案可参看:
http://stackoverflow.com/questions/37555557/m2e-error-in-mavenarchiver-getmanifest
相关博客:
servicemix 7安装使用及camel-cxf代理webservice:
[url]http://newjava-sina-cn.iteye.com/blog/2359797[/url]
参考网站:
http://blog.csdn.net/xue1225go/article/details/4922018
http://blog.163.com/xh_ding/blog/static/1939032892015222368827
http://www.xuehuile.com/blog/c2505fa6aeb3417eae8b680df1d99ec5.html
http://stackoverflow.com/questions/21076179/pkix-path-building-failed-and-unable-to-find-valid-certification-path-to-requ