`

servicemix 3安装及cxf-bc组件代理webservice服务

阅读更多
目录
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





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

具体配置内容见附件:<servicemix的archetype配置>



默认情况下,servicemix-project-root版本只有最新版
取消勾选左下方的show the last version of archetype only即可看到其他版本



3.2 创建名为servicemix-cxf-bc-demo的servicemix-project-root




3.3 在根项目下创建名为cxf-bc-su-demo的servicemix-cxf-bc-service-unit
3.3.1 创建servicemix-cxf-bc-service-unit






如果出现以下错误:
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文件夹下面是否有未下载完或中断的文件,如下



删除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" />

并在xbean.xml中添加webservice的命名空间,否则启动时找不到服务
xmlns:ws="http://ws.bill.com"






3.4 在根项目下创建名为cxf-bc-sa-demo的servicemix-service-assembly
3.4.1 创建servicemix-service-assembly






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中




启动servicemix.bat,并访问http://localhost:8193/HelloWorld/?wsdl





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:
http://newjava-sina-cn.iteye.com/blog/2359797



参考网站:
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





  • 大小: 45.5 KB
  • 大小: 68.8 KB
  • 大小: 48.8 KB
  • 大小: 17.6 KB
  • 大小: 15.5 KB
  • 大小: 118.8 KB
  • 大小: 65.8 KB
  • 大小: 52 KB
  • 大小: 52 KB
  • 大小: 48.3 KB
  • 大小: 41.6 KB
  • 大小: 41.9 KB
  • 大小: 62.8 KB
  • 大小: 83.9 KB
  • 大小: 77.7 KB
  • 大小: 62.5 KB
  • 大小: 50.9 KB
  • 大小: 74 KB
  • 大小: 66.1 KB
  • 大小: 77.2 KB
  • 大小: 32.6 KB
  • 大小: 41.7 KB
  • 大小: 52.4 KB
  • 大小: 73.5 KB
  • 大小: 56.7 KB
  • 大小: 89.9 KB
  • 大小: 41.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics