%date:~0,10% %time:~0,8%
日期格式2011-03-17 11:38:06
posted @ 2011-03-17 11:43 rainingcn 閱讀(415) | 評論 (0) | 編輯 收藏
posts - 6, comments - 0, trackbacks - 0, articles - 0 |
|
%date:~0,10% %time:~0,8%
日期格式2011-03-17 11:38:06
posted @ 2011-03-17 11:43 rainingcn 閱讀(415) | 評論 (0) | 編輯 收藏 1. 使用Maven的maven-archetype-webapp 創建
mvn archetype:create -DgroupId=com.test -DartifactId=tutorial -DarchetypeArtifactId=maven-archetype-webapp
2.修改pom.xml。在build屬性中增加jetty配置<build>
2.1 可以輸入 mvn jetty:run 啟動jetty容器<finalName>tutorial</finalName> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> </plugin> <!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> </plugin> --> </plugins> </build> 3.增加struts2相關配置。具體的pom.xml文件 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId> <artifactId>tutorial</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>tutorial Maven Webapp</name> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.2.1</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.14</version> </dependency> <dependency> <groupId>javassist</groupId> <artifactId>javassist</artifactId> <version>3.8.0.GA</version> </dependency> </dependencies> <build> <finalName>tutorial</finalName> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> </plugin> <!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> </plugin> --> </plugins> </build> </project> 4.導入到相關的IDE工具。如idea mvn idea:idea
4.1 idea中的目錄結構5.寫個class 看下能否正常跳轉。注意點:java類的源目錄為 src │ └─main │ ├─java public class Test {
對應的struts.xmlpublic String execute() { return "success"; } } <?xml version="1.0" encoding="UTF-8"?>
6. url: http://localhost:8080/test<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="default" extends="struts-default" namespace="/"> <action name="test" class="com.test.Test"> <result>index.jsp</result> </action> </package> </struts> 7.參考: Building Web Applications with Maven 2Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Applicationposted @ 2011-03-16 15:02 rainingcn 閱讀(1572) | 評論 (0) | 編輯 收藏 idea中使用SourceSafe沒有在eclipse使用簡便。idea項目工程文件和SS上的工程文件要制定下。原先配過一次,很久不用又忘了。所以試著記下來。
具體步驟 1.配置SourceSafe ![]() 2.配置idea項目工程文件和SS上的工程文件 ![]() posted @ 2011-02-12 16:13 rainingcn 閱讀(277) | 評論 (0) | 編輯 收藏 linux 自帶的apache默認安裝下,動態加載模塊是不啟動的。也就是意味著每一個httpd進程有自己獨立的模塊文件,分別獨立。
這個在多并發的情況下會占用很大資源。 查看方式: 1.查看httpd進程數 ps -ef|grep httpd|wc -l
2.查看打開的文件模塊數 lsof |grep /usr/lib64/httpd/modules/mod_auth_basic.so|wc -l
解決方式:重編譯apache, --enable-mods-shared=most
posted @ 2010-12-20 16:32 rainingcn 閱讀(287) | 評論 (0) | 編輯 收藏 1.close_wait的產生原因,參考http://ahuaxuan.javaeye.com/blog/657511
圖: ![]() 2.系統產生大量close_wait的原因是在大并發的情況下由于丟包或者系統壓力導致來不及處理數據包的原因,導致socket沒有得到很好的關閉。所以這個時候要調優下linux的系統參數 2.1調優參數,可以參看http://space.itpub.net/35489/viewspace-600807 2.2 參數說明,可以參看http://haka.sharera.com/blog/BlogTopic/32309.htm 2.3我目前結合系統修改后的配置: net.ipv4.tcp_keepalive_time=600
3.可以lsof命令,查看大量close_wait所在端口的對應文件信息。net.ipv4.tcp_keepalive_probes=5 net.ipv4.tcp_keepalive_intvl=15 參看http://www.ibm.com/developerworks/cn/aix/library/au-lsof.html posted @ 2010-12-16 13:40 rainingcn 閱讀(369) | 評論 (0) | 編輯 收藏 有時需要在服務器上每隔一段時間運行一段命令,以監控服務器性能。可以用crontab來做。
但是秒級的需要自己寫shell腳本。 比如監控apache: #!/bin/sh
echo "==========1.httpd==2.total connection==3.wait connection====4.jboss connection" rp=1 while rp=1 do echo "=================" date -d today +"%T" #show apache thread count ps -ef|grep httpd|wc -l #show total clients netstat -ant|grep 10.108.10.2|wc -l #show time_wait or ESTABLISHED clients netstat -ant|grep ffff|wc -l #show jboss connection netstat -ant|grep 10.108.7.7|wc -l sleep 1 done 運行腳本前莫忘 chmod +x filename posted @ 2010-12-14 16:10 rainingcn 閱讀(268) | 評論 (0) | 編輯 收藏 |
|