设为首页 收藏本站
查看: 1911|回复: 0

[经验分享] 虚拟化平台cloudstack(6)——使用maven:jetty调试

[复制链接]

尚未签到

发表于 2015-4-18 08:45:43 | 显示全部楼层 |阅读模式
调试环境
  ubuntu 12.04
  JDK1.7
  apache-maven-3.10
  eclipse 4.2 Juno
  mysql 5
  apache ant

JDK的配置和安装
  安装可以参考:
  http://my.oschina.net/jamesju/blog/94916
  我是安装在~//java/jdk1.7.0_21下,执行java -version可以看到当前的JDK版本。

Maven的配置和安装
  安装可以参考:
  http://blog.iyunv.com/sin90lzc/article/details/7429620

Eclipse及插件安装
  到eclipse官网下载4.2或者最新的4.3版本的eclipse.
  下载地址:
  http://www.eclipse.org/downloads/
  安装PyDev插件,用来查看python角本,因为底层操作是使用python写的。
  安装地址:
  http://pydev.org/updates/
  然后安装eclipse的m2e插件,就是eclipse的maven插件。
  安装地址:
  http://download.eclipse.org/technology/m2e/releases
  然后在eclipse的
  因为源码是上传到git上的,所以要安装Egit插件。
  安装地址:Preferences里边配置maven的路径,就是刚安装的maven的路径。
  http://download.eclipse.org/egit/updates
  安装完成后可以到菜单Help->About Eclipse->Installation Details,点击
DSC0000.jpg

下载源码
  使用File->Import
DSC0001.jpg
  选择Next,选择URI
  输入:



https://git-wip-us.apache.org/repos/asf/cloudstack.git

选择要调试的版本,这里要调试是4.02版本,比较稳定的一个版本,如下图:

DSC0002.jpg

然后选择本地路径,Finish。

接下来就等着下载源码,这个时间跟网速有关。

然后再选择File->Import,选择Existing Maven Projects,选择刚才保存的git本地路径,导入刚下载的工程。


编译和运行jetty

使用maven编译,点击Run->Run Configuration

DSC0003.jpg

compile -U,-U表示强制更新,如果有未更新完成的包也会重新下载,这个可以根据自己的情况选择加或不加。

然后点Run,编译成功后会出现如下结果:




[INFO] Reactor Summary:
[INFO]
[INFO] Apache CloudStack ................................. SUCCESS [1.038s]
[INFO] Apache CloudStack Utils ........................... SUCCESS [1.485s]
[INFO] Apache CloudStack API ............................. SUCCESS [0.633s]
[INFO] Apache XenSource XAPI ............................. SUCCESS [0.135s]
[INFO] Apache CloudStack Core ............................ SUCCESS [0.495s]
[INFO] Apache CloudStack Agents .......................... SUCCESS [0.546s]
[INFO] Apache CloudStack SystemVM Patches ................ SUCCESS [0.209s]
[INFO] Apache CloudStack Console Proxy ................... SUCCESS [0.347s]
[INFO] Apache CloudStack Server .......................... SUCCESS [0.470s]
[INFO] Apache CloudStack Usage Server .................... SUCCESS [0.214s]
[INFO] Apache CloudStack Plugin POM ...................... SUCCESS [0.196s]
[INFO] Apache CloudStack Plugin - User Concentrated Pod Deployment Planner  SUCCESS [0.165s]
[INFO] Apache CloudStack Plugin - User Dispersing Deployment Planner  SUCCESS [0.236s]
[INFO] Apache CloudStack Plugin - Host Allocator Random .. SUCCESS [0.355s]
[INFO] Apache CloudStack Plugin - Hypervisor OracleVM .... SUCCESS [0.477s]
[INFO] Apache CloudStack Plugin - Open vSwitch ........... SUCCESS [0.328s]
[INFO] Apache CloudStack Plugin - Hypervisor Xen ......... SUCCESS [0.412s]
[INFO] Apache CloudStack Plugin - Hypervisor KVM ......... SUCCESS [0.395s]
[INFO] Apache CloudStack Plugin - Network Elastic Load Balancer  SUCCESS [0.174s]
[INFO] Apache CloudStack Plugin - Network Nicira NVP ..... SUCCESS [0.175s]
[INFO] Apache CloudStack Plugin - Storage Allocator Random  SUCCESS [0.158s]
[INFO] Apache CloudStack Plugin - User Authenticator LDAP  SUCCESS [0.161s]
[INFO] Apache CloudStack Plugin - User Authenticator MD5 . SUCCESS [0.169s]
[INFO] Apache CloudStack Plugin - User Authenticator Plain Text  SUCCESS [0.166s]
[INFO] Apache CloudStack AWS API Bridge .................. SUCCESS [2.046s]
[INFO] Apache CloudStack Test ............................ SUCCESS [0.167s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.256s
[INFO] Finished at: Fri Aug 02 22:21:41 CST 2013
[INFO] Final Memory: 25M/357M
[INFO] ------------------------------------------------------------------------
  然后运行jetty,这个默认是在cloud-client-ui这个工程里边配置的,所以配置如下:
DSC0004.jpg
  如果中间出现问题,岀到出错的工程中选择maven clean然后再maven install一下,然后再执行cloudrun运行jetty,这样反复几次,就可以成功运行jetty了。
  这时启动会报错,因为没有安装数据库。
  安装数据库:



$ sudo apt-get install mysql-server
在弹出的界面中输入密码,如: cloudstack
  然后



修改MySQL配置文件参数
$ sudo vim /etc/mysql/my.cnf
在[mysqld]模块中加入以下参数
1    innodb_rollback_on_timeout=1
2    innodb_lock_wait_timeout=600
3    max_connections=350
4    log-bin=mysql-bin
5    binlog-format = 'ROW'
重启MySQL
$ sudo service mysql restart
  在eclipse中找到replace.properties文件,修改replace.properties文件中的key为DBROOTPW的值,这个值是mysql默认的密码,我们修改成上面的cloudstack
  然后安装ant



sudo apt-get install ant
  安装完成后到源码安装目录或者在eclipse中执行



ant deploydb
  这样数据库就可以成功部署了。
  然后在调试的时候需要选择Debug->Debug Configuration->Source->Add
  将所有源码工程加上。
DSC0005.jpg
  然后打上断点,以Debug模式运行,就可用断点调试了。
DSC0006.jpg

可能遇到的问题
  1、工程jar包丢失,编译不过去



[WARNING] The POM for org.apache.cloudstack:cloud-plugin-user-authenticator-md5:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-user-authenticator-plaintext/4.0.2/cloud-plugin-user-authenticator-plaintext-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-user-authenticator-plaintext:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-network-nvp/4.0.2/cloud-plugin-network-nvp-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-network-nvp:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-network-ovs/4.0.2/cloud-plugin-network-ovs-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-network-ovs:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-network-elb/4.0.2/cloud-plugin-network-elb-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-network-elb:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-hypervisor-xen/4.0.2/cloud-plugin-hypervisor-xen-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-hypervisor-xen:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-hypervisor-ovm/4.0.2/cloud-plugin-hypervisor-ovm-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-hypervisor-ovm:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-hypervisor-kvm/4.0.2/cloud-plugin-hypervisor-kvm-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-hypervisor-kvm:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-storage-allocator-random/4.0.2/cloud-plugin-storage-allocator-random-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-storage-allocator-random:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-planner-user-dispersing/4.0.2/cloud-plugin-planner-user-dispersing-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-planner-user-dispersing:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-planner-user-concentrated-pod/4.0.2/cloud-plugin-planner-user-concentrated-pod-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-planner-user-concentrated-pod:jar:4.0.2 is missing, no dependency information available
[INFO] Downloading: http://repo.maven.apache.org/maven2/org/apache/cloudstack/cloud-plugin-host-allocator-random/4.0.2/cloud-plugin-host-allocator-random-4.0.2.pom
[WARNING] The POM for org.apache.cloudstack:cloud-plugin-host-allocator-random:jar:4.0.2 is missing, no dependency information available
  找到对应的工程,然后执行mvn clean install,哪个出问题就在哪个工程上执行就可以了。
  

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-58304-1-1.html 上篇帖子: Jetty 9.2.9 发布,修复了安全漏洞 下篇帖子: Jetty 9.2.11.v20150529 发布
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表