<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>威言大义</title>
	<atom:link href="http://www.chenweionline.cn/feed" rel="self" type="application/rss+xml" />
	<link>http://www.chenweionline.cn</link>
	<description>言简意赅，论人论事论学问</description>
	<lastBuildDate>Thu, 05 May 2011 05:16:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mysql手动停止无响应查询方法</title>
		<link>http://www.chenweionline.cn/archives/61.htm</link>
		<comments>http://www.chenweionline.cn/archives/61.htm#comments</comments>
		<pubDate>Thu, 05 May 2011 05:16:30 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[Unix/Linux系统]]></category>
		<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=61</guid>
		<description><![CDATA[

热度:


#result td {border:1px solid #000000}

&#160;&#160;&#160;&#160;&#160;&#160;使用phpmyadmin、Navicat for Mysql或Mysql Workbench等客户端连接mysql服务器时，若mysql查询返回结果数据量太大或查询耗时太长时经常会出现查询无响应的情况，此时在客户端选择停止查询只是中止了客户端的查询进程，而服务器端仍在运行已提交的查询请求，从而导致服务器不响应其他查询甚至中止服务的后果。本文介绍如何通过Linux下的mysql命令行手动停止无响应查询或超时查询的方法。
&#160;&#160;&#160;&#160;&#160;&#160;（1）登录mysql。在命令行下登录使用用户名（如admin)和密码（如password）登录的命令如下，其中，-u表示后面是登录使用的用户名， -p表示使用该用户名需要密码。执行该命令后系统会提示输入用户对应的密码，密码验证通过后即进入mysql的命令行界面。
mysql -u &#60;用户名&#62; -p
Enter Password: ******
mysql&#62;
&#160;&#160;&#160;&#160;&#160;&#160;（2）查看mysql正在运行的会话和查询。使用命令show processlist;查看mysql正在运行的查询情况，该命令执行后显示一个表状结构，如下所示：



Id
User
Host
db
Command
Time
State
Info


141438
root
localhost
NULL
Query
0
NULL
show processlist



&#160;&#160;&#160;&#160;&#160;&#160;（3）上表中Id列的值表示目前正在运行的查询的唯一标识，在上表中通过Command列和Info列中的SQL语句找到我们要停止的查询对应的Id号，然后执行kill语句即可停止该查询。命令如下：
kill 141438; 
附：常用命令行界面mysql命令
&#160;&#160;&#160;&#160;&#160;&#160;show databases; //显示mysql中的所有数据库
&#160;&#160;&#160;&#160;&#160;&#160;use [databaseName]; //使用某个数据库，只有运行此命令后才能进入该数据库做查询
&#160;&#160;&#160;&#160;&#160;&#160;show tables; //显示当前数据库下的所有数据表和视图
&#160;&#160;&#160;&#160;&#160;&#160;select * from [tableName] where [Where Clauses]; //执行常规查询语句，如select, insert, update, delete等。
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><style type="text/css">
#result td {border:1px solid #000000}
</style>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;使用phpmyadmin、Navicat for Mysql或Mysql Workbench等客户端连接mysql服务器时，若mysql查询返回结果数据量太大或查询耗时太长时经常会出现查询无响应的情况，此时在客户端选择停止查询只是中止了客户端的查询进程，而服务器端仍在运行已提交的查询请求，从而导致服务器不响应其他查询甚至中止服务的后果。本文介绍如何通过Linux下的mysql命令行手动停止无响应查询或超时查询的方法。<span id="more-61"></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）登录mysql。在命令行下登录使用用户名（如admin)和密码（如password）登录的命令如下，其中，-u表示后面是登录使用的用户名， -p表示使用该用户名需要密码。执行该命令后系统会提示输入用户对应的密码，密码验证通过后即进入mysql的命令行界面。</p>
<pre><strong>mysql -u &lt;用户名&gt; -p</strong></pre>
<pre><strong>Enter Password: ******</strong></pre>
<pre><strong>mysql&gt;</strong></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）查看mysql正在运行的会话和查询。使用命令show processlist;查看mysql正在运行的查询情况，该命令执行后显示一个表状结构，如下所示：</p>
<table id="result" style="width: 95%; border-collapse: collapse; border: 1px solid #000000; text-align: center;" border="0">
<tbody>
<tr>
<td>Id</td>
<td>User</td>
<td>Host</td>
<td>db</td>
<td>Command</td>
<td>Time</td>
<td>State</td>
<td>Info</td>
</tr>
<tr>
<td><strong>141438</strong></td>
<td>root</td>
<td>localhost</td>
<td>NULL</td>
<td>Query</td>
<td>0</td>
<td>NULL</td>
<td>show processlist</td>
</tr>
</tbody>
</table>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（3）上表中Id列的值表示目前正在运行的查询的唯一标识，在上表中通过Command列和Info列中的SQL语句找到我们要停止的查询对应的Id号，然后执行kill语句即可停止该查询。命令如下：</p>
<pre><strong>kill 141438; </strong></pre>
<p><strong>附：常用命令行界面mysql命令</strong><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show databases; //显示mysql中的所有数据库<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;use [databaseName]; //使用某个数据库，只有运行此命令后才能进入该数据库做查询<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;show tables; //显示当前数据库下的所有数据表和视图<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;select * from [tableName] where [Where Clauses]; //执行常规查询语句，如select, insert, update, delete等。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/61.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>人民大学开发完成学术主页生成系统EasyScholar</title>
		<link>http://www.chenweionline.cn/archives/60.htm</link>
		<comments>http://www.chenweionline.cn/archives/60.htm#comments</comments>
		<pubDate>Thu, 05 May 2011 01:56:15 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[网站开发]]></category>
		<category><![CDATA[威言大义]]></category>
		<category><![CDATA[开发经验]]></category>
		<category><![CDATA[网站界面开发]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=60</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;继发布面向计算机领域的中文文献集成系统C-DBLP（后更名为SearchScholar）后，人民大学孟小峰教授领导的网络与移动数据管理（WAMDM）实验室近日又开发完成了学术主页生成系统EasyScholar。该系统基于WAMDM实验室在Web数据集成方向的研究成果及SearchScholar开发中的技术积累，自动收集整理学者的论文著作、承担项目、研究兴趣等学术信息，实现了学者个人学术主页的自动构建功能，大大简化了学者建立个人主页的过程。
&#160;&#160;&#160;&#160;&#160;&#160;EasyScholar着眼于目前国内学者在建立个人主页时收集整理论文著作、科研项目等信息时诸多不便，应用WAMDM实验室面向领域的Web数据集成技术从Web上的公开数据源自动获取学者的相关学术信息，在有限的人工参与下方便地建立学者的个人主页。由于使用了Web数据集成方法，在EasyScholar上建立学术主页不再是一个单调繁重的工作，而是一种方便快捷的体验。此外，EasyScholar根据国内外主流学术主页的风格制作了多种学术主页的模板，用户可以根据个人偏好定制学术主页的风格。生成的主页即可放在我们的学术空间，也可提供静态学术主页的打包下载功能，方便用户部署到其他站点中。
&#160;&#160;&#160;&#160;&#160;&#160;在以上成果的基础上，孟小峰教授进一步提出了构建适合中国学者的学术空间ScholarSpace的计划。ScholarSpace将由三部分组成，即文献集成系统SearchScholar，学术主页生成系统EasyScholar，和将开发完成的学者间社交网络SocialScholar。EasyScholar基于SearchScholar开发完成， SocialScholar将基于EasyScholar开发完成，而SocialScholar的实现会进一步提高SearchScholar的学术搜索质量和能力。学术空间ScholarSpace的这三个子系统形成彼此促进的关系，构成了一个学术信息和资源汇集与分享的良性循环，将为我国学者的学术交流提供便利。
&#160;&#160;&#160;&#160;&#160;&#160;欢迎大家试用：http://easyscholar.ruc.edu.cn/
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun_dark.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;继发布面向计算机领域的中文文献集成系统C-DBLP（后更名为SearchScholar）后，人民大学孟小峰教授领导的网络与移动数据管理（WAMDM）实验室近日又开发完成了学术主页生成系统EasyScholar。该系统基于WAMDM实验室在Web数据集成方向的研究成果及SearchScholar开发中的技术积累，自动收集整理学者的论文著作、承担项目、研究兴趣等学术信息，实现了学者个人学术主页的自动构建功能，大大简化了学者建立个人主页的过程。<span id="more-60"></span></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>EasyScholar</span>着眼于目前国内学者在建立个人主页时收集整理论文著作、科研项目等信息时诸多不便，应用WAMDM实验室面向领域的Web数据集成技术从Web上的公开数据源自动获取学者的相关学术信息，在有限的人工参与下方便地建立学者的个人主页。由于使用了Web数据集成方法，在EasyScholar上建立学术主页不再是一个单调繁重的工作，而是一种方便快捷的体验。此外，EasyScholar根据国内外主流学术主页的风格制作了多种学术主页的模板，用户可以根据个人偏好定制学术主页的风格。生成的主页即可放在我们的学术空间，也可提供静态学术主页的打包下载功能，方便用户部署到其他站点中。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在以上成果的基础上，孟小峰教授进一步提出了构建适合中国学者的学术空间ScholarSpace的计划。ScholarSpace将由三部分组成，即文献集成系统SearchScholar，学术主页生成系统EasyScholar，和将开发完成的学者间社交网络SocialScholar。EasyScholar基于SearchScholar开发完成， SocialScholar将基于EasyScholar开发完成，而SocialScholar的实现会进一步提高SearchScholar的学术搜索质量和能力。学术空间ScholarSpace的这三个子系统形成彼此促进的关系，构成了一个学术信息和资源汇集与分享的良性循环，将为我国学者的学术交流提供便利。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;欢迎大家试用：<a href="http://easyscholar.ruc.edu.cn/"><span style="COLOR: #0000ff"><span style="text-decoration: underline;">http://easyscholar.ruc.edu.cn/</span></span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/60.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MyEclipse安装SubClipse SVN插件</title>
		<link>http://www.chenweionline.cn/archives/59.htm</link>
		<comments>http://www.chenweionline.cn/archives/59.htm#comments</comments>
		<pubDate>Sun, 01 May 2011 07:29:19 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[myclipse]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[开发经验]]></category>
		<category><![CDATA[版本控制]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=59</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;SubClipse是Eclipse上的一个SubVersion版本控制客户端插件，几乎支持所有版本的Eclipse，MyEclipse中也可以使用该插件。安装Subclipse一般可以有两种方式：（1）使用MyEclipse自带的MyEclipse Configuration Center以类似于Eclipse中的software update的方式自动升级安装，但由于安装过程中需要在myeclipse官网下载部分myeclipse的plugin，而MyEclipse对中国区的软件用户下载和更新进行了限制（可能是由于copyright的原因），所以用这种方式更新时总会报错失败。（2）到subclipse的网站（http://subclipse.tigris.org/）上下载相应的subclipse的zip包到本地，以myeclipse插件手动安装。
&#160;&#160;&#160;&#160;&#160;&#160;手动安装subclipse插件时，先从网站下载相应版本的zip包至本地，解压后可以看见包中有features和plugins两个文件夹和一个site.xml文件，将features和plugins两个文件夹拷贝到myeclipse安装目录下新建文件夹（如svn）中，site.xml文件不用拷贝。在$Myeclipse_HOME/dropins文件夹下建一个快捷方式文件svn.link，指向刚才features和plugins文件夹所在的文件夹。（可以先建一个文本文件，在里面写上path=C:\\Users\\web\\AppData\\Local\\Genuitec\\MyEclipse 8.5\\myplugin\\svn，然后把文本文件后缀名.txt改成.link即可）上述操作完成后删除$MyEclipse_HOME/configuration/org.eclipse.update文件夹中的所有内容，重新启动myeclipse即可完成安装。安装完成后可以在菜单中window->show view->other->svn下找到subclipse的相关界面，如“svn资源库”、“svn属性”、“svn注释”等。
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun_dark.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SubClipse是Eclipse上的一个SubVersion版本控制客户端插件，几乎支持所有版本的Eclipse，MyEclipse中也可以使用该插件。安装Subclipse一般可以有两种方式：（1）使用MyEclipse自带的MyEclipse Configuration Center以类似于Eclipse中的software update的方式自动升级安装，但由于安装过程中需要在myeclipse官网下载部分myeclipse的plugin，而MyEclipse对中国区的软件用户下载和更新进行了限制（可能是由于copyright的原因），所以用这种方式更新时总会报错失败。（2）到subclipse的网站（<a href='http://subclipse.tigris.org/' target='_blank'>http://subclipse.tigris.org/</a>）上下载相应的subclipse的zip包到本地，以myeclipse插件手动安装。<span id="more-59"></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手动安装subclipse插件时，先从网站下载相应版本的zip包至本地，解压后可以看见包中有features和plugins两个文件夹和一个site.xml文件，将features和plugins两个文件夹拷贝到myeclipse安装目录下新建文件夹（如svn）中，site.xml文件不用拷贝。在$Myeclipse_HOME/dropins文件夹下建一个快捷方式文件svn.link，指向刚才features和plugins文件夹所在的文件夹。（可以先建一个文本文件，在里面写上path=C:\\Users\\web\\AppData\\Local\\Genuitec\\MyEclipse 8.5\\myplugin\\svn，然后把文本文件后缀名.txt改成.link即可）上述操作完成后删除$MyEclipse_HOME/configuration/org.eclipse.update文件夹中的所有内容，重新启动myeclipse即可完成安装。安装完成后可以在菜单中window->show view->other->svn下找到subclipse的相关界面，如“svn资源库”、“svn属性”、“svn注释”等。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/59.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse出现java was started but returned exit code 1报错并退出的解决方法</title>
		<link>http://www.chenweionline.cn/archives/57.htm</link>
		<comments>http://www.chenweionline.cn/archives/57.htm#comments</comments>
		<pubDate>Fri, 22 Apr 2011 05:33:44 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[开发经验]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=57</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;最近在使用Eclipse时发现无法启动，或者启动后经常出现崩溃退出的情况，提示的错误信息都是“java was started but returned exit code 1”，下载安装了最新版的Eclipse后还是没有解决问题。无奈之下只好百度之，翻了好几页都没有发现有用的信息，直接换到Google.com，终于在Eclipse Forum找到了一个靠谱的答案（网址是http://www.eclipse.org/forums/index.php?t=tree&#38;goto=547573&#38;#page_top），回答答案是“Eclipse is using the system default JRE that it finds in the windows system folders. You should point it to a JDK installation using eclipse.ini (as described here: http://wiki.eclipse.org/Eclipse.ini )”，大意是Eclipse启动的时候默认会使用从windows系统目录下找到的JRE作为默认的环境，由于我之前升级安装了一下JDK，所以系统目录下的JRE和实际的Java安装是不匹配的，因此会出现运行Eclipse时报错的情况。
解决方案：
&#160;&#160;&#160;&#160;&#160;&#160;根据eclipse.ini文件的说明（http://wiki.eclipse.org/Eclipse.ini），该文件提供指定运行eclipse的JVM功能，需要在eclipse.ini中加入JVM的路径说明。语法很简单：
-vm
C:\Program Files\Java\jdk1.6.0_22\bin\javaw.exe
&#160;&#160;&#160;&#160;&#160;&#160;eclipse.ini说明文档中特别提到使用-vm参数的注意事项：
（1）The -vm option and its value (the path) must be on separate lines.（-vm选项和其对应的javaw.exe的路径必须各占一行，这应该是参数解析的格式要求）
（2）The value must be the [...]]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最近在使用Eclipse时发现无法启动，或者启动后经常出现崩溃退出的情况，提示的错误信息都是“java was started but returned exit code 1”，下载安装了最新版的Eclipse后还是没有解决问题。无奈之下只好百度之，翻了好几页都没有发现有用的信息，直接换到Google.com，终于在Eclipse Forum找到了一个靠谱的答案（网址是<a href='http://www.eclipse.org/forums/index.php?t=tree&amp;goto=547573&amp;#page_top' target='_blank'>http://www.eclipse.org/forums/index.php?t=tree&amp;goto=547573&amp;#page_top</a>），回答答案是“Eclipse is using the system default JRE that it finds in the windows system folders. You should point it to a JDK installation using eclipse.ini (as described here: http://wiki.eclipse.org/Eclipse.ini )”，大意是Eclipse启动的时候默认会使用从windows系统目录下找到的JRE作为默认的环境，由于我之前升级安装了一下JDK，所以系统目录下的JRE和实际的Java安装是不匹配的，因此会出现运行Eclipse时报错的情况。<span id="more-57"></span><br />
<strong>解决方案：<br />
</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;根据eclipse.ini文件的说明（<a href='http://wiki.eclipse.org/Eclipse.ini' target='_blank'>http://wiki.eclipse.org/Eclipse.ini</a>），该文件提供指定运行eclipse的JVM功能，需要在eclipse.ini中加入JVM的路径说明。语法很简单：</p>
<pre>-vm</pre>
<pre>C:\Program Files\Java\jdk1.6.0_22\bin\javaw.exe</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eclipse.ini说明文档中特别提到使用-vm参数的注意事项：<br />
（1）<strong>The -vm option and its value (the path) must be on separate lines</strong>.（-vm选项和其对应的javaw.exe的路径必须各占一行，这应该是参数解析的格式要求）<br />
（2）<strong>The value must be the full absolute path to the Java executable, not just to the Java home directory</strong>.（指定的虚拟机路径必须是指向可执行Java程序的完整绝对路径，不能只指定到Java_HOME目录。这个好理解，要指定JVM的话肯定要指定到具体的可执行文件去）<br />
（3）<strong>The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM</strong>.（-vm选项必须放在-vmargs选项前，这是因为-vmargs选项后的值都是作为JVM的参数传给虚拟机的，如果-vm放在-vmargs之后就没有意义了。而-vmargs选项中一般可指定-Xms和-Xmx这两个内存参数）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/57.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用JDK 1.6自带的jvisualvm监控远程服务器中Java程序资源占用情况</title>
		<link>http://www.chenweionline.cn/archives/56.htm</link>
		<comments>http://www.chenweionline.cn/archives/56.htm#comments</comments>
		<pubDate>Thu, 24 Mar 2011 07:07:54 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[Unix/Linux系统]]></category>
		<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=56</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;因为做实验的需要，最近把实验室的Web数据抽取程序修改为多线程版本并在服务器上做大量的数据抽取工作，服务器是Ubuntu Server 10.01版本，通过Putty连接监控程序的运行情况非常不直观，需要使用一个Java资源监控程序实现对目标程序的实时监控。Jdk1.5版本提供的监控工具是Jconsole，相信很多早期的Java开发人员都使用过这个程序，但Jconsole的界面实在是有点对不起观众，所以在jdk1.6中Oracle提供了一个新的可视化的JVM监控工具Java VisualVM（官方介绍链接：http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/applications_remote.html），在Windows系统下的Java VisualVM启动路径是$java_home$/jdk1.6.0/bin/jvisualvm.exe。
&#160;&#160;&#160;&#160;&#160;&#160;双击启动Java VisualVM后可以看到窗口左侧“应用程序”栏中有“本地”、“远程”、“快照”三个项目。其中“本地”下显示的是在localhost运行的Java程序的资源占用情况，如果本地有Java程序在运行的话启动Java VisualVM即可看到相应的程序名，点击程序名打开相应的资源监控菜单，以图形的形式列出程序所占用的CPU、Heap、PermGen、类、线程的统计信息。“远程”项下列出的远程主机上的Java程序的资源占用情况，但需要在远程主机上运行jstatd守护程序，下面就以实现对远程Ubuntu Server中运行的Java程序资源监控为例说明如何使用Java VisualVM监控远程Java程序。
&#160;&#160;&#160;&#160;&#160;&#160;（1）在服务器上安装jstatd组件。由于安装JDK时配置选项的原因，有的服务器中没有默认安装jstatd组件。jstatd是openjdk中的一个package，使用apt-get命令安装openjdk即可。关于jstatd组件的详细介绍可参考：http://download.oracle.com/javase/6/docs/technotes/tools/share/jstatd.html
sudo apt-get install openjdk-6-jdk
&#160;&#160;&#160;&#160;&#160;&#160;（2）在服务器上配置jstatd的security policy文件。jstatd是一个监控JVM从创建到销毁过程中资源占用情况并提供远程监控接口的RMI（Remote Method Invocation，远程方法调用）服务器程序，它是一个Daemon程序，要保证远程监控软件连接到本地的话需要jstatd始终保持运行。jstatd运行需要通过-J-Djava.security.policy=***指定安全策略，因此我们需要在服务器上建立一个指定安全策略的文件jstatd.all.policy，文件内容如下：
grant codebase "file:${java.home}/../lib/tools.jar" {
   permission java.security.AllPermission;
};
&#160;&#160;&#160;&#160;&#160;&#160;（3）修改服务器hosts文件中的IP地址。要使Java VisualVM成功连接到远程服务器上，服务器端应该在/etc/hosts文件中把本机地址设为本机的IP地址。使用hostname -i命令查看，如果显示的是127.0.0.1或者与本机实际IP不一致的话，需要把/etc/hosts文件中相应的地址改为本机实际IP。
&#160;&#160;&#160;&#160;&#160;&#160;（4）运行jstatd守护程序。由于jstatd需要保持一直运行，所以建议使用screen命令执行jstatd程序，命令如下：
screen jstatd -J-Djava.security.policy=jstatd.all.policy
如果需要RMI日志功能的话，还可以在启动参数中加入-J-Djava.rmi.server.logCalls=true。jstatd开始运行后，使用CTRL+A+D断开screen界面，回到shell界面。如果想切换回jstatd运行界面的话，使用screen -r -d命令即可。
&#160;&#160;&#160;&#160;&#160;&#160;（5）通过Java VisualVM连接到服务器监控Java程序。在Java VisualVM程序窗口左侧“远程”项目右键选择“添加远程主机”，在弹出的对话框中输入远程主机的IP地址，确认提交后即可看到相应的远程主机和在上面运行的Java程序，连接成功后应该会显示Jstatd及其PID。
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;因为做实验的需要，最近把实验室的Web数据抽取程序修改为多线程版本并在服务器上做大量的数据抽取工作，服务器是Ubuntu Server 10.01版本，通过Putty连接监控程序的运行情况非常不直观，需要使用一个Java资源监控程序实现对目标程序的实时监控。Jdk1.5版本提供的监控工具是Jconsole，相信很多早期的Java开发人员都使用过这个程序，但Jconsole的界面实在是有点对不起观众，所以在jdk1.6中Oracle提供了一个新的可视化的JVM监控工具Java VisualVM（官方介绍链接：<a href="http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/applications_remote.html" target="_blank">http://download.oracle.com/javase/6/docs/technotes/guides/visualvm/applications_remote.html</a>），在Windows系统下的Java VisualVM启动路径是<strong>$java_home$/jdk1.6.0/bin/jvisualvm.exe</strong>。<span id="more-56"></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;双击启动Java VisualVM后可以看到窗口左侧“应用程序”栏中有“<strong>本地</strong>”、“<strong>远程</strong>”、“<strong>快照</strong>”三个项目。其中“本地”下显示的是在localhost运行的Java程序的资源占用情况，如果本地有Java程序在运行的话启动Java VisualVM即可看到相应的程序名，点击程序名打开相应的资源监控菜单，以图形的形式列出程序所占用的CPU、Heap、PermGen、类、线程的统计信息。“远程”项下列出的远程主机上的Java程序的资源占用情况，但需要在远程主机上运行<strong>jstatd守护程序</strong>，下面就以实现对远程Ubuntu Server中运行的Java程序资源监控为例说明如何使用Java VisualVM监控远程Java程序。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）<strong>在服务器上安装jstatd组件</strong>。由于安装JDK时配置选项的原因，有的服务器中没有默认安装jstatd组件。jstatd是openjdk中的一个package，使用apt-get命令安装openjdk即可。关于jstatd组件的详细介绍可参考：<a href="http://download.oracle.com/javase/6/docs/technotes/tools/share/jstatd.html" target="_blank">http://download.oracle.com/javase/6/docs/technotes/tools/share/jstatd.html</a></p>
<pre><strong>sudo apt-get install openjdk-6-jdk</strong></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）<strong>在服务器上配置jstatd的security policy文件</strong>。jstatd是一个监控JVM从创建到销毁过程中资源占用情况并提供远程监控接口的RMI（Remote Method Invocation，远程方法调用）服务器程序，它是一个Daemon程序，要保证远程监控软件连接到本地的话需要jstatd始终保持运行。jstatd运行需要通过<strong>-J-Djava.security.policy=***</strong>指定安全策略，因此我们需要在服务器上建立一个指定安全策略的文件jstatd.all.policy，文件内容如下：</p>
<pre><strong>grant codebase "file:${java.home}/../lib/tools.jar" {
   permission java.security.AllPermission;
};</strong></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（3）<strong>修改服务器hosts文件中的IP地址</strong>。要使Java VisualVM成功连接到远程服务器上，服务器端应该在/etc/hosts文件中把本机地址设为本机的IP地址。使用hostname -i命令查看，如果显示的是127.0.0.1或者与本机实际IP不一致的话，需要把/etc/hosts文件中相应的地址改为本机实际IP。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（4）<strong>运行jstatd守护程序</strong>。由于jstatd需要保持一直运行，所以建议使用screen命令执行jstatd程序，命令如下：</p>
<pre><strong>screen jstatd -J-Djava.security.policy=jstatd.all.policy</strong></pre>
<p>如果需要RMI日志功能的话，还可以在启动参数中加入<strong>-J-Djava.rmi.server.logCalls=true</strong>。jstatd开始运行后，使用CTRL+A+D断开screen界面，回到shell界面。如果想切换回jstatd运行界面的话，使用screen -r -d命令即可。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（5）<strong>通过Java VisualVM连接到服务器监控Java程序</strong>。在Java VisualVM程序窗口左侧“远程”项目右键选择“添加远程主机”，在弹出的对话框中输入远程主机的IP地址，确认提交后即可看到相应的远程主机和在上面运行的Java程序，连接成功后应该会显示Jstatd及其PID。</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/56.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apt-get出现E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists错误的解决方法</title>
		<link>http://www.chenweionline.cn/archives/55.htm</link>
		<comments>http://www.chenweionline.cn/archives/55.htm#comments</comments>
		<pubDate>Sat, 05 Mar 2011 10:51:11 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[Unix/Linux系统]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[开发经验]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=55</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;最近在Ubuntu上安装mysql-server时用命令apt-get install mysql-server出现报错提示：
E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists/******
刚开始以为是apt lists中的package没有mysql-server，所以运行命令apt-get update更新list列表，但仍然报上述错误，提示是lists的某一个mirror站点的package入口文件Could not be parsed or opened。回想起上一次调用apt-get update时由于update时间太长我直接CTRL+C中止的情形，可能是由于lists中某一个文件没有下载完成，出现解析错误。
&#160;&#160;&#160;&#160;&#160;&#160;可用的解决方案：将/var/lib/apt/lists/下的所有list文件都删除，然后再update即可，命令如下： 
sudo rm /var/lib/apt/lists/* -vf
sudo apt-get update
&#160;&#160;&#160;&#160;&#160;&#160;在Ubuntu server中通过apt-get install是一种比较方便的安装软件的途径，不过由于Ubuntu Mirrors的访问速度问题，安装过程往往耗时很长，比起直接下载代码在本地make的方式要更需要耐心。
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最近在Ubuntu上安装mysql-server时用命令apt-get install mysql-server出现报错提示：</p>
<pre><strong>E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists/******</strong></pre>
<p>刚开始以为是apt lists中的package没有mysql-server，所以运行命令apt-get update更新list列表，但仍然报上述错误，提示是lists的某一个mirror站点的package入口文件Could not be parsed or opened。回想起上一次调用apt-get update时由于update时间太长我直接CTRL+C中止的情形，可能是由于lists中某一个文件没有下载完成，出现解析错误。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;可用的解决方案：将/var/lib/apt/lists/下的所有list文件都删除，然后再update即可，命令如下： </p>
<pre><strong>sudo rm /var/lib/apt/lists/* -vf</strong></pre>
<pre><strong>sudo apt-get update</strong></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在Ubuntu server中通过apt-get install是一种比较方便的安装软件的途径，不过由于Ubuntu Mirrors的访问速度问题，安装过程往往耗时很长，比起直接下载代码在本地make的方式要更需要耐心。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/55.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu下配置apache的urlrewrite功能</title>
		<link>http://www.chenweionline.cn/archives/54.htm</link>
		<comments>http://www.chenweionline.cn/archives/54.htm#comments</comments>
		<pubDate>Fri, 25 Feb 2011 05:51:13 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[Unix/Linux系统]]></category>
		<category><![CDATA[网站开发]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=54</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;Ubuntu Server 10版本的操作系统安装过程中默认可以安装LAMP套件，但要保证apache2正常工作还需要进一步的配置。在站点运行中为了方便搜索引擎的索引，使用最多的就是通过对urlrewrite功能实现对类似/search.php?query=***的url地址静态化重写为/***.html的形式，因此需要在apache中配置urlrewrite功能。
&#160;&#160;&#160;&#160;&#160;&#160;（1）在apache中配置rewrite功能为可用。在windows环境下的apache中，所有配置都集中在httpd.conf中，并且rewriteengine的配置也已列出，只需要找到相应的加载rewrite功能模块的配置语句，将之前的#注释去掉即可。而在Ubuntu及其他linux/unix版本的操作系统中，apache的配置文件是由/etc/apache2文件夹下多个文件及子文件夹组成，其中mods-available文件夹是apache可配置的模块文件列表，mods-enabled是apache当前正在使用的模块文件列表，因此要配置rewrite功能，只需要把mods-avaiable文件夹下的rewrite.load文件链接到mods-enabled文件夹下的相应文件即可。命令如下：
sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
需要注意的是要修改 /etc/apache2/sites-available/default中 AllowOverride None 修改为： AllowOverride All，以保证rewrite的权限。
&#160;&#160;&#160;&#160;&#160;&#160;（2）配置好rewrite功能后，即可在站点配置文件中编写rewrite规则了，典型的格式如下：
rewriteengine on
rewriterule  /(.*).html$ /search.php?query=$1
&#160;&#160;&#160;&#160;&#160;&#160;记得配置完成后要用sudo service apache2 restart重新启动apache以使最新配置生效。
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun_dark.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ubuntu Server 10版本的操作系统安装过程中默认可以安装LAMP套件，但要保证apache2正常工作还需要进一步的配置。在站点运行中为了方便搜索引擎的索引，使用最多的就是通过对urlrewrite功能实现对类似/search.php?query=***的url地址静态化重写为/***.html的形式，因此需要在apache中配置urlrewrite功能。<span id="more-54"></span><br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（1）在apache中配置rewrite功能为可用。在windows环境下的apache中，所有配置都集中在httpd.conf中，并且rewriteengine的配置也已列出，只需要找到相应的加载rewrite功能模块的配置语句，将之前的#注释去掉即可。而在Ubuntu及其他linux/unix版本的操作系统中，apache的配置文件是由/etc/apache2文件夹下多个文件及子文件夹组成，其中mods-available文件夹是apache可配置的模块文件列表，mods-enabled是apache当前正在使用的模块文件列表，因此要配置rewrite功能，只需要把mods-avaiable文件夹下的rewrite.load文件链接到mods-enabled文件夹下的相应文件即可。命令如下：</p>
<pre>sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load</pre>
<p>需要注意的是要修改 /etc/apache2/sites-available/default中 AllowOverride None 修改为： AllowOverride All，以保证rewrite的权限。<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;（2）配置好rewrite功能后，即可在站点配置文件中编写rewrite规则了，典型的格式如下：</p>
<pre>rewriteengine on
rewriterule  /(.*).html$ /search.php?query=$1</pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;记得配置完成后要用sudo service apache2 restart重新启动apache以使最新配置生效。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/54.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MyEclipse+Tomcat设置程序修改自动reload功能</title>
		<link>http://www.chenweionline.cn/archives/53.htm</link>
		<comments>http://www.chenweionline.cn/archives/53.htm#comments</comments>
		<pubDate>Wed, 19 Jan 2011 03:05:04 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[开发经验]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=53</guid>
		<description><![CDATA[

热度:

MyEclipse是JavaEE开发中经常使用的IDE，因其比Eclipse提供了更多的面向JavaEE的插件而为人所青睐，但在MyEclipse+Tomcat搭配的JavaEE项目开发环境中，如果没有对Tomcat进行相关配置的话，MyEclipse中修改程序代码后Tomcat并不会自动reload最新修改的代码，因此需要通过对Tomcat的配置设置程序修改后的自动context reload功能。
对Tomcat6.0版本的修改是在$TOMCAT_HOME/conf/context.xml上进行的，为了保证部署在Tomcat上的所有应用都能够在程序被修改时自动reload，我们需要把context结点加上reloadable属性，修改部分如下：
&#60;Context reloadable=&#8221;true&#8221;&#62;settings&#60;/Context&#62;
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun_dark.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>MyEclipse是JavaEE开发中经常使用的IDE，因其比Eclipse提供了更多的面向JavaEE的插件而为人所青睐，但在MyEclipse+Tomcat搭配的JavaEE项目开发环境中，如果没有对Tomcat进行相关配置的话，MyEclipse中修改程序代码后Tomcat并不会自动reload最新修改的代码，因此需要通过对Tomcat的配置设置程序修改后的自动context reload功能。</p>
<p>对Tomcat6.0版本的修改是在$TOMCAT_HOME/conf/context.xml上进行的，为了保证部署在Tomcat上的所有应用都能够在程序被修改时自动reload，我们需要把context结点加上reloadable属性，修改部分如下：</p>
<p>&lt;Context <font color='red'>reloadable=&#8221;true&#8221;</font>&gt;settings&lt;/Context&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/53.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何将Tomcat安装为Windows7系统服务</title>
		<link>http://www.chenweionline.cn/archives/52.htm</link>
		<comments>http://www.chenweionline.cn/archives/52.htm#comments</comments>
		<pubDate>Mon, 17 Jan 2011 03:16:43 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[tomcat]]></category>
		<category><![CDATA[开发经验]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=52</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;Windows版本的Tomcat 6.0版本不提供exe安装程序，下载zip包解压后即可使用，但为了让tomcat注册为系统服务以便自动运行还需要执行命令安装，步骤如下：

第一步：在Windows 7或Vista操作系统下，需要以管理员身份运行cmd命令行窗口，否则在安装时会提示出错。这是由于windows 7和vista使用了更严格的权限管理机制，非管理员身份运行的命令行窗口无法修改系统服务。安装过程中相关错误提示信息可在$TOMCAT_HOME/logs下找到。
第二步：在命令行窗口中进入到$TOMCAT_HOME/bin文件下，使用service.bat文件安装服务，命令如下：
service.bat install tomcat

&#160;&#160;&#160;&#160;&#160;&#160;如果系统之前安装过tomcat系统服务，在再安装之前需要先移除原服务再安装，命令如下：
service.bat remove tomcat
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun_dark.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Windows版本的Tomcat 6.0版本不提供exe安装程序，下载zip包解压后即可使用，但为了让tomcat注册为系统服务以便自动运行还需要执行命令安装，步骤如下：</p>
<ul>
<li>第一步：在Windows 7或Vista操作系统下，需要以管理员身份运行cmd命令行窗口，否则在安装时会提示出错。这是由于windows 7和vista使用了更严格的权限管理机制，非管理员身份运行的命令行窗口无法修改系统服务。安装过程中相关错误提示信息可在$TOMCAT_HOME/logs下找到。</li>
<li>第二步：在命令行窗口中进入到$TOMCAT_HOME/bin文件下，使用service.bat文件安装服务，命令如下：</li>
<pre>service.bat install tomcat</pre>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;如果系统之前安装过tomcat系统服务，在再安装之前需要先移除原服务再安装，命令如下：</p>
<pre>service.bat remove tomcat</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/52.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu Server上修改mysql默认数据文件存放地址datadir</title>
		<link>http://www.chenweionline.cn/archives/51.htm</link>
		<comments>http://www.chenweionline.cn/archives/51.htm#comments</comments>
		<pubDate>Thu, 13 Jan 2011 08:54:43 +0000</pubDate>
		<dc:creator>陈威</dc:creator>
				<category><![CDATA[技术杂谈]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[开发经验]]></category>
		<category><![CDATA[操作系统]]></category>

		<guid isPermaLink="false">http://www.chenweionline.cn/?p=51</guid>
		<description><![CDATA[

热度:

&#160;&#160;&#160;&#160;&#160;&#160;最近在研究Ubuntu Server上部署网站系统，使用的是标准的LAMP架构（Ubuntu Server 10.04 + Apache + Mysql + php）。Ubuntu Server安装过程中可以自动安装Apache Mysql及php组件，但我们需要根据需要调整相应的配置。今天我们就来讨论一下如何修改mysql默认的数据文件存放地址datadir的方法。
&#160;&#160;&#160;&#160;&#160;&#160;在Ubuntu Server系统中，mysql的配置文件是在/etc/mysql文件夹下，包括my.cnf文件, conf.d文件夹及另外两个debian相关的文件，而默认数据文件存放地址datadir是在my.cnf文件中指定的。打开my.cnf文件，找到配置datadir的位置，默认的路径应该是：
datadir=/var/lib/mysql
把该路径改成需要指定的数据文件存放的新地址，如：
datadir=/data/mysqldata
&#160;&#160;&#160;&#160;&#160;&#160;这样就完成了对数据文件存放地址的修改。但需要注意的是，只修改这一处并不能保证mysql正常地运行，还需要修改其他两处。这是因为修改数据文件存放地址时还需要修改chroot属性，所以还需要修改/etc/apparmor.d下的相关文件。

修改/etc/apparmor.d/usr.sbin.mysqld文件：
/var/lib/mysql/ r      改为：/data/mysqldata r
/var/lib/mysql/**  rwk      改为：/data/mysqldata/**  rwk
修改/etc/apparmor.d/abstractions/mysql文件：
/var/lib/mysql/mysql.sock rw    改为：/data/mysqldata/mysql.sock rw
修改完成后重新加载apparmor服务：
sudo /etc/init.d/apparmor reload
重新建立mysql基本数据库：
sudo mysql_install_db

&#160;&#160;&#160;&#160;&#160;&#160;上述步骤中如果遇到permission问题，请调整相应的数据文件夹的权限设置。在mysql_install_db成功执行后即可使用service mysql start命令启动mysql服务器。
]]></description>
			<content:encoded><![CDATA[
<table>
<tr cellpadding=0><td>热度:</td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun.gif' width=10 height=10 border=0 /></td><td cellpadding=0><img src='http://www.chenweionline.cn/wp-content/plugins/statpresscn/images/sun_dark.gif' width=10 height=10 border=0 /></td></tr>
</table>
<p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最近在研究Ubuntu Server上部署网站系统，使用的是标准的LAMP架构（Ubuntu Server 10.04 + Apache + Mysql + php）。Ubuntu Server安装过程中可以自动安装Apache Mysql及php组件，但我们需要根据需要调整相应的配置。今天我们就来讨论一下如何修改mysql默认的数据文件存放地址datadir的方法。</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在Ubuntu Server系统中，mysql的配置文件是在/etc/mysql文件夹下，包括my.cnf文件, conf.d文件夹及另外两个debian相关的文件，而默认数据文件存放地址datadir是在my.cnf文件中指定的。打开my.cnf文件，找到配置datadir的位置，默认的路径应该是：</p>
<pre>datadir=/var/lib/mysql</pre>
<p>把该路径改成需要指定的数据文件存放的新地址，如：</p>
<pre>datadir=/data/mysqldata</pre>
<p><span id="more-51"></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这样就完成了对数据文件存放地址的修改。但需要注意的是，只修改这一处并不能保证mysql正常地运行，还需要修改其他两处。这是因为修改数据文件存放地址时还需要修改chroot属性，所以还需要修改<strong>/etc/apparmor.d</strong>下的相关文件。</p>
<ul>
<li>修改<strong>/etc/apparmor.d/usr.sbin.mysqld</strong>文件：</li>
<pre>/var/lib/mysql/ r      改为：/data/mysqldata r</pre>
<pre>/var/lib/mysql/**  rwk      改为：/data/mysqldata/**  rwk</pre>
<li>修改<strong>/etc/apparmor.<strong>d</strong></strong><strong>/abstractions/mysq</strong>l文件：</li>
<pre>/var/lib/mysql/mysql.sock rw    改为：/data/mysqldata/mysql.sock rw</pre>
<li>修改完成后重新加载apparmor服务：</li>
<pre>sudo /etc/init.d/apparmor reload</pre>
<li>重新建立mysql基本数据库：</li>
<pre>sudo mysql_install_db</pre>
</ul>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;上述步骤中如果遇到permission问题，请调整相应的数据文件夹的权限设置。在mysql_install_db成功执行后即可使用service mysql start命令启动mysql服务器。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chenweionline.cn/archives/51.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

