posts - 6, comments - 0, trackbacks - 0, articles - 0

          2010年12月16日

          %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 創(chuàng)建

          mvn archetype:create -DgroupId=com.test -DartifactId=tutorial -DarchetypeArtifactId=maven-archetype-webapp
          2.修改pom.xml。在build屬性中增加jetty配置
          <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>
             2.1 可以輸入 mvn jetty:run  啟動jetty容器
          3.增加struts2相關(guān)配置。具體的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.導(dǎo)入到相關(guān)的IDE工具。如idea
          mvn idea:idea
             4.1 idea中的目錄結(jié)構(gòu)

          5.寫個class 看下能否正常跳轉(zhuǎn)。注意點:java類的源目錄為
          src
          │  └─main
          │      ├─java
          public class Test {
              public String execute() {
                  return "success";
              }
          }
          對應(yīng)的struts.xml
          <?xml version="1.0" encoding="UTF-8"?>

          <!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>
          6. url: http://localhost:8080/test

          7.參考:
            

          Building Web Applications with Maven 2

          Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application
           

          posted @ 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默認(rèn)安裝下,動態(tài)加載模塊是不啟動的。也就是意味著每一個httpd進(jìn)程有自己獨立的模塊文件,分別獨立。
          這個在多并發(fā)的情況下會占用很大資源。
          查看方式:
          1.查看httpd進(jìn)程數(shù)
          ps -ef|grep httpd|wc -l
          2.查看打開的文件模塊數(shù)
           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的產(chǎn)生原因,參考http://ahuaxuan.javaeye.com/blog/657511
          圖:

          2.系統(tǒng)產(chǎn)生大量close_wait的原因是在大并發(fā)的情況下由于丟包或者系統(tǒng)壓力導(dǎo)致來不及處理數(shù)據(jù)包的原因,導(dǎo)致socket沒有得到很好的關(guān)閉。所以這個時候要調(diào)優(yōu)下linux的系統(tǒng)參數(shù)
          2.1調(diào)優(yōu)參數(shù),可以參看http://space.itpub.net/35489/viewspace-600807
          2.2 參數(shù)說明,可以參看http://haka.sharera.com/blog/BlogTopic/32309.htm
          2.3我目前結(jié)合系統(tǒng)修改后的配置:
           net.ipv4.tcp_keepalive_time=600
           net.ipv4.tcp_keepalive_probes
          =5
           net.ipv4.tcp_keepalive_intvl
          =15
          3.可以lsof命令,查看大量close_wait所在端口的對應(yīng)文件信息。
            參看http://www.ibm.com/developerworks/cn/aix/library/au-lsof.html

          posted @ 2010-12-16 13:40 rainingcn 閱讀(369) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 德庆县| 宣汉县| 溆浦县| 靖远县| 新绛县| 嘉禾县| 呼图壁县| 西乌珠穆沁旗| 弥渡县| 凤山市| 昔阳县| 洪泽县| 东乌珠穆沁旗| 龙口市| 大余县| 突泉县| 溧水县| 元江| 延长县| 宣汉县| 象州县| 葫芦岛市| 阿图什市| 手机| 潢川县| 廊坊市| 汉源县| 高清| 崇义县| 彭山县| 台中市| 寻乌县| 花垣县| 尖扎县| 许昌县| 瑞丽市| 轮台县| 克拉玛依市| 连州市| 个旧市| 渭源县|