`
cake918
  • 浏览: 22596 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

Mule ESB浅析2——源码编译与安装

    博客分类:
  • SOA
阅读更多

 

基于源码进行编译

1,从svn获取代码之后,命令行下进入到对应目录执行如下指令

mvn –DskipTests install

 

此处mvn会下载所有的依赖库,Win7默认下载到C:\Users\user\.m2\repository目录下(路径修改位置settings.xml),此处需要几个小时的时间。该目录将被用于配置eclipse SDK

2,从源码生成相应的eclpise工程文件,执行如下指令:

 

mvn eclipse:eclipse mvn idea:idea,为了能够为所有的模块生成相应的工程文件,需要使用JDK6。另外如果需要所依赖包的源文件,则增加-DdownloadSources=true即可。

 

可能遇到的问题包括,

 

1)在执行mvn eclipse:eclipse时出现如下错误:

[ERROR] Java heap space -> [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/OutOfMemoryError

 

解决方法,在执行mvn eclipse:eclipse之前,先执行如下命令:

set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m

 

 

 

2)在执行mvn eclipse:eclipse时出现如下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-eclipse-plugin:2.5.1:eclipse (default-cli) on proje

ct mule-catalog-archetype: Can't canonicalize system path: E:\mule-3x\tools\mule-catalog-archetype\target\classes

\E:\mule-3x\tools\mule-catalog-archetype\target\classes: 文件名、目录名或卷标语法不正确。 -> [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/MojoExecutionException

[ERROR]

[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :mule-catalog-archetype

 

解决方法:

在出错路径E:\mule-3x\tools\mule-catalog-archetype下找到对应的pom.xml文件,

Configuration->resources->resource中的directorytargetPath去掉${project.build.directory}前缀。

 

 

3,在eclipse中编译源码

可能出现的问题包括,

 

1)编译出错信息为:

**具有不受限制的类路径变量***

 

解决方法:

增加相关的路径宏定义,具体位置为:窗口à首选项à java ->构建路径à 类路径变量

 

2)编译出错信息为:

访问限制:由于对必需的库 C:\Program Files\Java\jre6\lib\rt.jar 具有一定限制,因此无法访问类型 Handler

 

解决方法:

对应项目右击,属性à java构建路径 à à 展开JRE系统库 à 双击Access rules –> 添加 (分辨率为:可访问,规则模式为:**)

 

3)出错信息:

新导入的工程无法import部分库,直接点击无法导入的类,右击选择“Fix project setup”,此时会自动搜索到M2_REPO路径下的库,选中即可。

 

 

4,安装eclipse的Mule IDE插件。

 

首先下载Mule IDE 插件:http://dist.muleforge.org/mule-ide/releases/中下载最新版本。

 

使用eclipse的本地插件安装即可。

 

 

可能遇到的问题

1)提示缺包:org.apache.commons.lang 2.3.0

 

解决方法:

http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/releases/ganymede/plugins/下载org.apache.commons.lang 2.3.0,拷贝到mule ide plugin下。

 

 

5,创建Mule工程

Fileà New à Other,展开Mule文件夹,选择Mule Project来生成Mule工程,选择Mule Configuration来生成xml配置文件。只有配置了命名空间,脚本才会生效。

 

6,编译测试代码

1)基于发布包编译

 

编译问题

需要指定测试代码依赖的mule库,否则会报定义找不到。具体添加方法:

右击项目à属性 à java构建路径 à à 添加库 à Mule Classpath 选择”use a project specific Mule distribution”,全选所有的库。

 

执行问题

出错信息:Could not find the main class org.mule.muleserver

 

解决方法:

此处是由于不是创建mule工程,而是导入了原有的测试工程,因此删除该工程重新创建mule工程2)即可。

 

 

2)基于源码编译

 

新建测试代码工程,增加相关源码的依赖关系,位置propertiesàjavaBuildpathàProjects,主要有mule_corespring相关工程,实际使用到的transport的相关工程。

 

编译问题:

Configuration problem: Unable to locate NamespaceHandler for namespace

 

解决方法:

增加无法解析namespace的对应的工程。

 

 

直接获取安装包进行安装

 

http://www.mulesoft.org/download-mule-esb-community-edition

下载windows版本或者linux版本,直接解压即可。

 

本地使用windows版本,下需要设置MULE_HOME到解压路径,同时,设置%MULE_HOME%/hinPATH路径下。

调用populate_m2_repo.cmd c:\.m2\repository,会将本地的Mule Enterprise jar包存放到maven下载的存储库中

命令行启动:mule [-config <your-config.xml>]

 

 

下一篇介绍Mule和tomcat集成的使用与调试。

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics