在运行jetty-maven-plugin时,出现错误

2015年1月13日 10:22

在运行jetty-maven-plugin出现错误
 
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.2.6.v20141205:run (default-cli) on project PKPlatform_web: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.2.6.v20141205:run failed: Unable to load the mojo 'run' in the plugin 'org.eclipse.jetty:jetty-maven-plugin:9.2.6.v20141205' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 51.0
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.eclipse.jetty:jetty-maven-plugin:9.2.6.v20141205
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-maven-plugin/9.2.6.v20141205/jetty-maven-plugin-9.2.6.v20141205.jar
[ERROR] urls[1] = file:/D:/DEV/mavenRepons/org/sonatype/sisu/sisu-inject-bean/2.1.1/sisu-inject-bean-2.1.1.jar
[ERROR] urls[2] = file:/D:/DEV/mavenRepons/org/sonatype/sisu/sisu-guice/2.9.4/sisu-guice-2.9.4-no_aop.jar
[ERROR] urls[3] = file:/D:/DEV/mavenRepons/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
[ERROR] urls[4] = file:/D:/DEV/mavenRepons/org/sonatype/aether/aether-util/1.11/aether-util-1.11.jar
[ERROR] urls[5] = file:/D:/DEV/mavenRepons/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[6] = file:/D:/DEV/mavenRepons/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[7] = file:/D:/DEV/mavenRepons/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[8] = file:/D:/DEV/mavenRepons/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[9] = file:/D:/DEV/mavenRepons/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.1/maven-plugin-tools-api-3.1.jar
[ERROR] urls[10] = file:/D:/DEV/mavenRepons/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[11] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-util/9.2.6.v20141205/jetty-util-9.2.6.v20141205.jar
[ERROR] urls[12] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-webapp/9.2.6.v20141205/jetty-webapp-9.2.6.v20141205.jar
[ERROR] urls[13] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-xml/9.2.6.v20141205/jetty-xml-9.2.6.v20141205.jar
[ERROR] urls[14] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-servlet/9.2.6.v20141205/jetty-servlet-9.2.6.v20141205.jar
[ERROR] urls[15] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-quickstart/9.2.6.v20141205/jetty-quickstart-9.2.6.v20141205.jar
[ERROR] urls[16] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-jaas/9.2.6.v20141205/jetty-jaas-9.2.6.v20141205.jar
[ERROR] urls[17] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-security/9.2.6.v20141205/jetty-security-9.2.6.v20141205.jar
[ERROR] urls[18] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-plus/9.2.6.v20141205/jetty-plus-9.2.6.v20141205.jar
[ERROR] urls[19] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-jndi/9.2.6.v20141205/jetty-jndi-9.2.6.v20141205.jar
[ERROR] urls[20] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-server/9.2.6.v20141205/jetty-server-9.2.6.v20141205.jar
[ERROR] urls[21] = file:/D:/DEV/mavenRepons/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
[ERROR] urls[22] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-http/9.2.6.v20141205/jetty-http-9.2.6.v20141205.jar
[ERROR] urls[23] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-io/9.2.6.v20141205/jetty-io-9.2.6.v20141205.jar
[ERROR] urls[24] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-jmx/9.2.6.v20141205/jetty-jmx-9.2.6.v20141205.jar
[ERROR] urls[25] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/jetty-annotations/9.2.6.v20141205/jetty-annotations-9.2.6.v20141205.jar
[ERROR] urls[26] = file:/D:/DEV/mavenRepons/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
[ERROR] urls[27] = file:/D:/DEV/mavenRepons/org/ow2/asm/asm/5.0.1/asm-5.0.1.jar
[ERROR] urls[28] = file:/D:/DEV/mavenRepons/org/ow2/asm/asm-commons/5.0.1/asm-commons-5.0.1.jar
[ERROR] urls[29] = file:/D:/DEV/mavenRepons/org/ow2/asm/asm-tree/5.0.1/asm-tree-5.0.1.jar
[ERROR] urls[30] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.2.6.v20141205/javax-websocket-server-impl-9.2.6.v20141205.jar
[ERROR] urls[31] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.2.6.v20141205/javax-websocket-client-impl-9.2.6.v20141205.jar
[ERROR] urls[32] = file:/D:/DEV/mavenRepons/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar
[ERROR] urls[33] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/websocket-server/9.2.6.v20141205/websocket-server-9.2.6.v20141205.jar
[ERROR] urls[34] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/websocket-common/9.2.6.v20141205/websocket-common-9.2.6.v20141205.jar
[ERROR] urls[35] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/websocket-api/9.2.6.v20141205/websocket-api-9.2.6.v20141205.jar
[ERROR] urls[36] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/websocket-client/9.2.6.v20141205/websocket-client-9.2.6.v20141205.jar
[ERROR] urls[37] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/websocket/websocket-servlet/9.2.6.v20141205/websocket-servlet-9.2.6.v20141205.jar
[ERROR] urls[38] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/apache-jsp/9.2.6.v20141205/apache-jsp-9.2.6.v20141205.jar
[ERROR] urls[39] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/toolchain/jetty-schemas/3.1.M0/jetty-schemas-3.1.M0.jar
[ERROR] urls[40] = file:/D:/DEV/mavenRepons/org/mortbay/jasper/apache-jsp/8.0.9.M3/apache-jsp-8.0.9.M3.jar
[ERROR] urls[41] = file:/D:/DEV/mavenRepons/org/mortbay/jasper/apache-el/8.0.9.M3/apache-el-8.0.9.M3.jar
[ERROR] urls[42] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/orbit/org.eclipse.jdt.core/3.8.2.v20130121/org.eclipse.jdt.core-3.8.2.v20130121.jar
[ERROR] urls[43] = file:/D:/DEV/mavenRepons/org/eclipse/jetty/apache-jstl/9.2.6.v20141205/apache-jstl-9.2.6.v20141205.jar
[ERROR] urls[44] = file:/D:/DEV/mavenRepons/org/apache/taglibs/taglibs-standard-spec/1.2.1/taglibs-standard-spec-1.2.1.jar
[ERROR] urls[45] = file:/D:/DEV/mavenRepons/org/apache/taglibs/taglibs-standard-impl/1.2.1/taglibs-standard-impl-1.2.1.jar
[ERROR] urls[46] = file:/D:/DEV/mavenRepons/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] -> [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/PluginContainerException
 
从上面发现
repository.exception.ComponentLookupException: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 51.0
很明显是版本问题. 检查jdk,版本是1.6,改为1.7后,重新运行,一切正常.
 

Tags: jetty
评论(16) 阅读(22882)

<img>加载图片失败,怎样替换为默认图片

2015年1月05日 15:45

img元素加载图片失败,则变成一个小图标,让页面变得难看。此时如何替换为默认图片?

onerror属性

img元素自带onerror属性,加载失败时,触发error事件
<img src="image.gif" onerror='this.src="default.gif" />

jquery.error函数

jquery提供对应的事件处理函数
$('img').error(function(){
    $(this).attr('src',"default.gif");
})

jquery.one函数

使用上面两种方法,假如默认图片也加载失败,则变成死循环. 此时可使用one()绑定事件
$("img").one("error", function(e){
     $(this).attr("src", "default.gif");
});
 
另外error事件,不支持冒泡,jquery.delegate函数捕捉不到error事件。
 

Tags: html
评论(51) 阅读(11426)

净空法师:为什么要隐恶扬善?

2015年1月04日 11:27

所以要称赞,称赞,你看用如来,不用诸佛,用的词句不一样,当然意思就不相同。佛经上名词的转变,有它特别的用意。我们在江味农居士《金刚经讲义》里面,他注得很详细;《金刚经》上有的时候说诸佛、有的时候说如来。江居士告诉我们,凡是说诸佛,是从相上讲的、从事上讲的;凡是讲如来,都是从性上讲的。《金刚经》如是,我们这个经也不例外,《大方广佛华严经》亦复如是。所以我们就明白了,礼敬诸佛是从事相上说的,事相上一切恭敬说称赞如来,是从性德上说的。那就是说明,与性德相应,就是善的,我们要称赞,恶的不能称赞,恶的不说就好,不称赞,要称赞善的。但是礼敬,善人我们礼敬,恶人也要礼敬,不能说善人我尊敬他,恶人我不尊敬他,那你就错了。恶人尊敬他而不赞叹他,善人是尊敬他也赞叹他,差别在这个地方。那个恭敬之心决定没有差别,决定是平等的。这个称赞一定与性德相应。赞人的善,我们从这里去学。

  世间一切众生,如果说他一生当中都在做恶,从来没有做过一桩善事,我不相信,佛也不相信,你们大家也不会相信。一切众生在这个世间,起心动念、言语造作,善恶混杂。不过就是现代的众生业障习气重,所造的是恶多善少,如果能够转变过来,我们善多恶少,那这个社会整个风气都转变了。我们赞扬善、不说恶,让那些作恶的人,时间久了,他也有良心,恶人也有良心,不能说他没有良心,时间久了,他会觉悟,他会反省,生惭愧心。我造作很多恶,人家都不说,人家能包容,我做这么一点小善,人家都称赞,他就会回心转意,他就会少作恶、多修善。

  如果我们对人家的善不赞扬,人家小恶我们就大肆宣扬,这个所产生的反效果,会让人家生悔恨之心;做的善事后悔,做的善事,有什么好处?哪一个人知道,哪一个人称赞我;造一点点恶事,天下都知道。让这些想做善事的人,这个善的意念没有了。你看世界上,人都做恶,变成什么?变成一个错误的错觉,作恶是应当的、作恶是时髦的。这一个错觉、这一个误会,就不得了,引导举世之人舍弃善念,增长恶念,不肯修善,拼命在作恶,带给这个社会就是大灾难,带给一切众生极大的痛苦。追究其根本的原因,就是我们在日常生活当中,说话不谨慎,造成这个后果、造成这个灾难。佛对於这桩事情,真是在一切经论里面说得太多太多了。我们没有留意,没有细心的去观察,没有认真去学习。

大乘无量寿经  (第六集)  1998/4/19  新加坡佛教居士林  档名:02-34-006

评论(47) 阅读(4339)

jetty-maven-plugin静态文件保存不了

2014年12月31日 11:08

起因

为maven项目配置jetty-maven-plugin插件,以jetty:run方式运行,会出现静态文件保存不了的问题。原因是jetty内存映射文件来缓存静态文件. 解决方法是将jetty内存映射参数取消掉.

解决

找webdefault.xml文件

在下面路径找到webdefault.xml文件
C:\Users\Administrator\.m2\repository\org\eclipse\jetty\jetty-webapp\9.2.6.v20141205
如果安装了jetty服务器,在它的etc目录下也可以取到webdefault.xml文件

useFileMappedBuffer参数值改为false

webdefault.xml配置
<init-param>
  <param-name>useFileMappedBuffer</param-name>
  <param-value>false</param-value>
</init-param>

新增defaultsDescriptor配置项

<plugin>  
    <groupId>org.eclipse.jetty</groupId>  
    <artifactId>jetty-maven-plugin</artifactId>  
    <version>9.2.6.v20141205</version>  
    <configuration>
        <scanIntervalSeconds>0</scanIntervalSeconds>
        <webAppSourceDirectory>${basedir}/WebRoot</webAppSourceDirectory>
        <webApp>  
            <contextPath>/</contextPath>
            <war>${project.build.directory}/${project.build.finalName}.war</war>
            <!-- jetty9.2.6的defaultsDescriptor在<webApp>里,早期版本在<configuration>或者<webAppConfig>里 -->
            <defaultsDescriptor>${basedir}/WebRoot/resources/webdefault.xml</defaultsDescriptor>
        </webApp> 
</configuration>
</plugin>

webdefault.xml加载是否成功

控制台输出如下,表示加载了webdefualt.xml
[INFO] Web defaults = .... /WebRoot/resources/webdefault.xml

感受

上面方法虽然可以解决问题,但是很不好用. 如果jetty-maven-plugin能设计个开发模式设置,在易用性上会有更大提升.

参考资料

jetty-maven-plugin配置文档
maven文档
 
 

评论(400) 阅读(48461)

rsync+inotify-tools+ssh触发式同步

2014年12月02日 14:53

Tags: rsync;inotify;同步
评论(3) 阅读(3930)

inotify-tools用法

2014年12月02日 14:40

一、介绍

    inotify-tools是为linux下inotify文件监控工具提供的一套C的开发接口函数库,同时还提供了一系列的命令行工具,这些工具可以用来监控文件系统的事件。Inotify-tools使用用c编写的,除了要求内核(Linux2.6.13开始)支持inotify外,不依赖于其他。inotify-tools提供两种工具,一是inotifywait,它是用来监控文件或目录的变化,二是inotifywatch,它是用来统计文件系统访问的次数。

二、初试

1.查看内核是否支持
➜  ~  grep INOTIFY_USER /boot/config-$(uname -r)
CONFIG_INOTIFY_USER=y
 
2.安装
➜  ~ yum install inotify-tools
 
3.运行inotifywait
➜  ~  inotifywait -rm workspace
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
 
4. 触发事件, 查看结果
➜  ~  touch workspace/demo.py 
inotifywait输出
workspace/ CREATE demo.py
workspace/ OPEN demo.py
workspace/ ATTRIB demo.py
workspace/ CLOSE_WRITE,CLOSE demo.py

三、语法

inotifywait  [-hcmrq]  [-e  <event> ] [-t <seconds> ] [--format <fmt> ]
       [--timefmt <fmt> ] <file> [ ... ]

四、选项

-r, --recursive  监视一个目录下的所有子目录。
-e , --event     指定监视的事件。
-m, --monitor    接收到一个事情而不退出,无限期地执行。默认的行为是接收到一个事情后立即退出。
-q, --quiet      指定一次,不会输出详细信息,指定二次,除了致命错误,不会输出任何信息。
-h,--help        输出帮助信息
@<file>          排除不需要监视的文件,可以是相对路径,也可以是绝对路径。
--fromfile     从文件读取需要监视的文件或排除的文件,一个文件一行,排除的文件以@开头。
-d, --daemon   跟--monitor一样,除了是在后台运行,需要指定--outfile把事情输出到一个文件。也意味着使用了--syslog。
-o, --outfile  输出事情到一个文件而不是标准输出。
-s, --syslog   输出错误信息到系统日志
--exclude      正则匹配需要排除的文件,大小写敏感。
--excludei     正则匹配需要排除的文件,忽略大小写。
-t , --timeout  设置超时时间,如果为0,则无限期地执行下去。
-c, --csv     输出csv格式。
--timefmt     指定时间格式,用于--format选项中的%T格式。
--format      指定输出格式。
%w    表示发生事件的目录
%f    表示发生事件的文件
%e    表示发生的事件
%Xe   事件以“X"分隔
%T    使用由--timefmt定义的时间格式

五、输出

watched_filename EVENT_NAMES event_filename
  • watched_filename 监控文件
  • EVENT_NAMES 事件名
  • event_filename 事件对象文件

六、事件

access  文件读取
modify  文件更改。
attrib  文件属性更改,如权限,时间戳等。
close_write 以可写模式打开的文件被关闭,不代表此文件一定已经写入数据。
close_nowrite 以只读模式打开的文件被关闭。
close  文件被关闭,不管它是如何打开的。
open   文件打开。
moved_to 一个文件或目录移动到监听的目录,即使是在同一目录内移动,此事件也触发。
moved_from 一个文件或目录移出监听的目录,即使是在同一目录内移动,此事件也触发。
move    包括moved_to和 moved_from
move_self 文件或目录被移除,之后不再监听此文件或目录。
create  文件或目录创建
delete  文件或目录删除
delete_self  文件或目录移除,之后不再监听此文件或目录
unmount  文件系统取消挂载,之后不再监听此文件系统。
 
 
参考: https://www.centos.bz/2012/06/inotify-tools-introduction/
 

Tags: inotify;
评论(1) 阅读(4564)

rsync学习

2014年12月01日 15:53

一、示例

以下面两个目录为例子
src目录结构
➜  tree src
src
└── demo.py
dest目录结构
➜  tree dest 
dest
└── hello.py
 
1. 文件同步
➜  rsync -v src/demo.py dest
demo.py

sent 85 bytes  received 35 bytes  240.00 bytes/sec
total size is 0  speedup is 0.00
 
2. 目录同步
➜  rsync -av src/  dest
sending incremental file list
./
demo.py

sent 118 bytes  received 38 bytes  312.00 bytes/sec
total size is 0  speedup is 0.00
 
3. 远程目录同步
➜  rsync -av src/  wyq@localhost:~/dest
wyq@localhost's password: 
sending incremental file list
./
demo.py

sent 118 bytes  received 38 bytes  34.67 bytes/sec
total size is 0  speedup is 0.00

二、介绍

    rsync(remote sync)远程同步工具. 使用rsync算法,只传送两个文件不同的部分, 而不是每次都整份传送,因此速度相当快. 运行Rsync服务器的机器也叫备份服务,一个Rsync服务器可同时备份多个客户端的数据; 也可以多个Rsync服务器备份一个客户端的数据。
    rsync服务器打开873端口, 等待对方Rsync连接。连接时,Rsync server会检查口令是否相符,若通过口令查核,则可以开始进行文件传输。第一次连通完成时,会把整份文件传输一次,下一次就只传送二个文件之间不同的部份。
    rsync支持大多数linux系统,windows也有相应版本,比较知名的有cwRsync和Sync2NAS。

三、基本特点

1.可以镜像保存整个目录树和文件系统;
2.可以很容易做到保持原来文件的权限、时间、软硬链接等;
3.无须特殊权限即可安装;
4.优化的流程,文件传输效率高;
5.可以使用rcp、ssh等方式来传输文件,当然也可以通过直接的socket连接;
6.支持匿名传输。

四、语法

本地:  rsync [OPTION...] SRC... [DEST]

Access via remote shell(ssh)
  获取: rsync [OPTION...] [USER@]HOST:SRC... [DEST]
  推送: rsync [OPTION...] SRC... [USER@]HOST:DEST

Access via rsync daemon:(rsync服务器)
  Pull: rsync [OPTION...] [USER@]HOST::SRC... [DEST]
        rsync [OPTION...] rsync://[USER@]HOST[:PORT]/SRC... [DEST]
  Push: rsync [OPTION...] SRC... [USER@]HOST::DEST
        rsync [OPTION...] SRC... rsync://[USER@]HOST[:PORT]/DEST
 
* ":"   分隔符就启动这种模式
* "::"  分隔符启动daemon模式
* 传输方式有两种:rsync-daemon、ssh. daemon方式缺乏灵活性;ssh方式,灵活,速度快,安全性高,但是cpu消耗高.一般用ssh.

五、选项

一般都使用azv选项
 
-v, --verbose 详细模式
-a, archive  归档模式,表示以递归方式传输文件,并保持所有文件属性
-r, --recursive 对子目录以递归方式处理
-z, --compress 传输时对数据进行压缩
-b, --backup 创建备份,存在同名文件,将老的重新命名为~filename. 可以使用--suffix指定不同的备份文件前缀.
-l, --links 保留软链接
-L, --copy-links  像对待常规文件一样处理软链接
-e, --rsh=COMMAND 指定使用rsh, ssh方式进行数据同步
--force 强制删除目录,即使不为空
-u, --update  仅仅进行更新,也就是跳过所有已经存在于DST,并且文件时间晚于要备份的文件。(不覆盖更新的文件)
--size-only 当决定是否要备份文件时,仅仅察看文件大小而不考虑文件时间
-I, --ignore-times 不跳过那些有同样的时间和长度的文件
 
-t, --time  保持文件时间信息
-o, --owner 保持文件属主信息
-p, --perms 保持文件权限
-g, --group 保持文件属组信息
-q, --quiet 精简输出模式
-c, --checksum 打开校验模式,强制对文件传输进行校验
--progress 显示数据镜像同步的过程
--delete   以rsync服务器端为基础进行数据镜像同步,保持与rsync服务器目录完全一致.
--delete-excluded  同样删除接收端那些被该选项指定排除的文件
--delete-after 传输结束以后再删除
--exclude=PATTERN  排除不需要传输的文件类型
--partial  保留因故没有完全传输的文件,以加快随后的再次传输
--port=PORT 指定其它rsync服务器端口
--password-file=FILE 从FILE中得到密码
--bwlimit=KBPS 限制I/O带宽,KBytes per second

六、优点与缺点

优点
安全、备份迅速、增量备份,可以解决实时性要求不高的需求.
 
缺点
    rsync需要扫描所有文件后进行对比,然后进行查量传输,如果文件很大,扫描文件非常耗时,而且发生变化的文件往往是很少一部分,因此比较低效.
    rsync不能实时监测,两次触发动作会有时间差,导致服务器和客户端数据出现不一致。
 

Tags: rsync;
评论(1) 阅读(3674)

第一个jetty程序

2014年11月21日 17:36

  • 下载
  • 新建root目录
解压之后在webapps下新建root目录
  • 新建index.jsp文件
在root目录中新建index.jsp文件
<html>
<body>
<%
    out.println("hello world")
%>
</body>
</html>
  • 启动
进入控制台运行
java -jar start.jar
 
在windows下可能出现下面错误,原因是执行java命令时优先使用windows自带的java,但是lib却使用我们配置的classpath.
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac.  A full JDK (not just JRE) is required
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:119)
at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompiler.java:208)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
....
 
解决办法
C:\Program" "Files\Java\jdk1.7.0_60\bin\java -jar start.jar
  • 访问
http://localhost:8080 即可看到hello word
 

Tags: jetty
评论(2) 阅读(3886)

Waiting for table metadata lock解锁

2014年11月20日 16:53

在用alter修改mysql表结构时,可能出现一直在执行中. 这个时候可能就是因为锁表了.
  • 查看锁表 
show processlist 
Id User Host db Command Time State Info
3367062 root 192.168.10.114:61503 pkPlatform Sleep 5444 \N
3572758 root 192.168.10.116:51713 pkPlatform Sleep 9348 \N
...
  • 锁表提示
State子段出现: Waiting for table metadata lock表明存在锁表
  • 解锁
kill 3631200  --(3631200为Id字段值)
 

评论(0) 阅读(5710)

安装增强功能出现make[2]: *** [/tmp/vbox.0/regops.o]错误

2014年11月14日 15:15

fedora运行在virtualbox(版本4.3.12)之上,在安装增强功能时出现下面错误
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.12 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.12 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules       [  确定  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module                   [  确定  ]
Building the shared folder support module                  [失败]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions              [  确定  ]
Installing the Window System drivers
Installing X.Org Server 1.14 modules                       [  确定  ]
Setting up the Window System to use the Guest Additions    [  确定  ]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services componen[  确定  ]
Press Return to close this window...
 
打开日志文件发现下面提示
make[2]: *** [/tmp/vbox.0/regops.o] 错误 1
make[1]: *** [_module_/tmp/vbox.0] 错误 2
make: *** [vboxsf] 错误 2
 
从virtualbox官网找到的一段解释
this has to do with a new version of GCC or kernel in Fedora and the fix was to update to a newer version of VirtualBox,
 but that can be problematic right now on a Windows host. I would try the 4.3.16 guest additions and see if that fixes this.
 If that fails then you need to see if 4.3.16 works in the host. Read the issues though https://forums.virtualbox.org/viewtopic.php?f=6&t=63556
大致意思是由于使用新版本gcc或者kernel,而guest additions并不支持. 解决办法是使用4.3.16版本的增强功能.
 
下载地址
 
下载之后将它挂载到系统中,重新安装增强功能,提示正常.
 

Tags: fedora
评论(262) 阅读(8257)