江蘇520

          江蘇520

          常用鏈接

          統(tǒng)計(jì)

          最新評(píng)論

          #

          Tomcat 6.0.20

          Tomcat是Apache 軟件基金會(huì)(Apache Software Foundation)的Jakarta 項(xiàng)目中的一個(gè)核心項(xiàng)目,由Apache、Sun 和其他一些公司及個(gè)人共同開發(fā)而成.由于有了Sun 的參與和支持,最新的Servlet 和JSP 規(guī)范總是能在Tomcat 中得到體現(xiàn),因?yàn)門omcat 技術(shù)先進(jìn)、性能穩(wěn)定,而且免費(fèi),因而深受Java 愛好者的喜愛并得到了部分軟件開發(fā)商的認(rèn)可,成為目前比較流行的Web 應(yīng)用服務(wù)器.Tomcat 很受廣大程序員的喜歡,因?yàn)樗\(yùn)行時(shí)占用的系統(tǒng)資源小,擴(kuò)展性好,支持負(fù)載平衡與郵件服務(wù)等開發(fā)應(yīng)用系統(tǒng)常用的功能;而且它還在不斷的改進(jìn)和完善中,任何一個(gè)感興趣的程序員都可以更改它或在其中加入新的功能.

          下載:Tomcat 6.0.20

          Apache Tomcat Version 6.0.20
          Release Notes

          =============================
          KNOWN ISSUES IN THIS RELEASE:
          =============================

          * Dependency Changes
          * JNI Based Applications
          * Bundled APIs
          * Web application reloading and static fields in shared libraries
          * Tomcat on Linux
          * Enabling SSI and CGI Support
          * Security manager URLs
          * Symlinking static resources
          * Enabling invoker servlet
          * Viewing the Tomcat Change Log
          * When all else fails
          http://www.bt285.cn
          http://www.feng123.com
          ===================
          Dependency Changes:
          ===================
          Tomcat 6.0 is designed to run on JSE 5.0 and later.

          In addition, Tomcat 6.0 uses the Eclipse JDT Java compiler for compiling
          JSP pages. This means you no longer need to have the complete
          Java Development Kit (JDK) to run Tomcat, but a Java Runtime Environment
          (JRE) is sufficient. The Eclipse JDT Java compiler is bundled with the
          binary Tomcat distributions. Tomcat can also be configured to use the
          compiler from the JDK to compile JSPs, or any other Java compiler supported
          by Apache Ant.


          =======================
          JNI Based Applications:
          =======================
          Applications that require native libraries must ensure that the libraries have
          been loaded prior to use. Typically, this is done with a call like:

          static {
          System.loadLibrary("path-to-library-file");
          }

          in some class. However, the application must also ensure that the library is
          not loaded more than once. If the above code were placed in a class inside
          the web application (i.e. under /WEB-INF/classes or /WEB-INF/lib), and the
          application were reloaded, the loadLibrary() call would be attempted a second
          time.

          To avoid this problem, place classes that load native libraries outside of the
          web application, and ensure that the loadLibrary() call is executed only once
          during the lifetime of a particular JVM.


          =============
          Bundled APIs:
          =============
          A standard installation of Tomcat 6.0 makes all of the following APIs available
          for use by web applications (by placing them in "lib"):
          * annotations-api.jar (Annotations package)
          * catalina.jar (Tomcat Catalina implementation)
          * catalina-ant.jar (Tomcat Catalina Ant tasks)
          * catalina-ha.jar (High availability package)
          * catalina-tribes.jar (Group communication)
          * el-api.jar (EL 2.1 API)
          * jasper.jar (Jasper 2 Compiler and Runtime)
          * jasper-el.jar (Jasper 2 EL implementation)
          * jasper-jdt.jar (Eclipse JDT 3.3 Java compiler)
          * jsp-api.jar (JSP 2.1 API)
          * servlet-api.jar (Servlet 2.5 API)
          * tomcat-coyote.jar (Tomcat connectors and utility classes)
          * tomcat-dbcp.jar (package renamed database connection pool based on Commons DBCP)

          You can make additional APIs available to all of your web applications by
          putting unpacked classes into a "classes" directory (not created by default),
          or by placing them in JAR files in the "lib" directory.

          To override the XML parser implementation or interfaces, use the endorsed
          mechanism of the JVM. The default configuration defines JARs located in
          "endorsed" as endorsed.


          ================================================================
          Web application reloading and static fields in shared libraries:
          ================================================================
          Some shared libraries (many are part of the JDK) keep references to objects
          instantiated by the web application. To avoid class loading related problems
          (ClassCastExceptions, messages indicating that the classloader
          is stopped, etc.), the shared libraries state should be reinitialized.

          Something which might help is to avoid putting classes which would be
          referenced by a shared static field in the web application classloader,
          and putting them in the shared classloader instead (JARs should be put in the
          "lib" folder, and classes should be put in the "classes" folder).


          ================
          Tomcat on Linux:
          ================
          GLIBC 2.2 / Linux 2.4 users should define an environment variable:
          export LD_ASSUME_KERNEL=2.2.5

          Redhat Linux 9.0 users should use the following setting to avoid
          stability problems:
          export LD_ASSUME_KERNEL=2.4.1

          There are some Linux bugs reported against the NIO sendfile behavior, make sure you
          have a JDK that is up to date, or disable sendfile behavior in the Connector.<br/>
          6427312: (fc) FileChannel.transferTo() throws IOException "system call interrupted"<br/>
          5103988: (fc) FileChannel.transferTo should return -1 for EAGAIN instead throws IOException<br/>
          6253145: (fc) FileChannel.transferTo on Linux fails when going beyond 2GB boundary<br/>
          6470086: (fc) FileChannel.transferTo(2147483647, 1, channel) cause "Value too large" exception<br/>


          =============================
          Enabling SSI and CGI Support:
          =============================
          Because of the security risks associated with CGI and SSI available
          to web applications, these features are disabled by default.

          To enable and configure CGI support, please see the cgi-howto.html page.

          To enable and configue SSI support, please see the ssi-howto.html page.


          ======================
          Security manager URLs:
          ======================
          In order to grant security permissions to JARs located inside the
          web application repository, use URLs of of the following format
          in your policy file:

          file:${catalina.home}/webapps/examples/WEB-INF/lib/driver.jar

          ============================
          Symlinking static resources:
          ============================
          By default, Unix symlinks will not work when used in a web application to link
          resources located outside the web application root directory.

          This behavior is optional, and the "allowLinking" flag may be used to disable
          the check.

          =========================
          Enabling invoker servlet:
          =========================
          Starting with Tomcat 4.1.12, the invoker servlet is no longer available by
          default in all webapps. Enabling it for all webapps is possible by editing
          $CATALINA_HOME/conf/web.xml to uncomment the "/servlet/*" servlet-mapping
          definition.

          Using the invoker servlet in a production environment is not recommended and
          is unsupported. More details are available on the Tomcat FAQ at
          http://tomcat.apache.org/faq/misc.html#invoker.

          ==============================
          Viewing the Tomcat Change Log:
          ==============================
          See changelog.html in this directory.

          ====================
          When all else fails:
          ====================
          See the FAQ
          http://tomcat.apache.org/faq/

          posted @ 2009-05-17 20:12 江蘇520| 編輯 收藏

          Fire Workflow 介紹

             2009-02-02日 Fire Workflow 的Eclispe設(shè)計(jì)器插件上傳到google code ,并有較詳細(xì)的文檔(2_通過設(shè)計(jì)器和模擬器快速了解Fire Workflow.pdf,3_各種工作流模式的實(shí)現(xiàn).pdf)。

          請(qǐng)到http://code.google.com/p/fireflow下載。
          鏡像:http://www.bt285.cn  http://www.5a520.cn




                           Fire workflow FAQ
          1、為什么要寫Fire Workflow
                 本人從事企業(yè)MIS系統(tǒng)開發(fā)很多年頭了,感覺MIS系統(tǒng)很多領(lǐng)域都有比較好的解決方案并已成為事實(shí)標(biāo)準(zhǔn),例如Spring,Hibernate等等;然而工作流還沒有令人滿意的開源產(chǎn)品。我了解過的工作流產(chǎn)品(主要是開源的,收費(fèi)產(chǎn)品沒有什么研究,僅僅看看其白皮書而已)都存在如下毛?。?


                  
          • 缺乏嚴(yán)密的理論做支撐,工作流模型大多千篇一律地照搬WfMC的xpdl,       
          • 因?yàn)槿狈碚撝?,所以工作流引擎的算法有點(diǎn)七拼八湊,擴(kuò)展性也比較差。       
          • 沒有好的設(shè)計(jì)器,應(yīng)用比較困難       

                 最近研究并應(yīng)用了一下JBoss的Jbpm,除了其面向圖的引擎算法讓我眼前一亮外,其他的也不是令人滿意。其引擎的擴(kuò)展性不好,表結(jié)構(gòu)太復(fù)雜,在大數(shù)據(jù)量系統(tǒng)中,性能令人堪憂。
                 鑒于此,我動(dòng)手寫了一個(gè)Fire Workflow,拋磚引玉。

          2、Fire Workflow的定位
                 我從來不認(rèn)為工作流可以“自定義”,所以Fire Workflow是面向開發(fā)人員的。Fire Workflow和Spring、Hibernate一樣,是一個(gè)或幾個(gè)普普通通的jar包,嵌入到系統(tǒng)中,用以解決系統(tǒng)開發(fā)中工作流領(lǐng)域的問題。
                 因?yàn)镕ire Workflow是面向開發(fā)人員的,所以在下面兩個(gè)方面花了較大功夫。
                

                  
          • 流程設(shè)計(jì)器。Fire Workflow用于幫助開發(fā)人員解決系統(tǒng)中的流程問題,所以好的流程設(shè)計(jì)器有助于開發(fā)人員提高開發(fā)效率。Fire Workflow設(shè)計(jì)器和主流IDE緊密集成(目前有Eclipse插件和NetBeans插件),使得開發(fā)人員開發(fā)調(diào)試流程就像開發(fā)調(diào)試一個(gè)普通java類一樣簡(jiǎn)單。       
          • 工作流引擎。Fire Workflow引擎設(shè)計(jì)充分考慮擴(kuò)展性,因?yàn)闃I(yè)務(wù)系統(tǒng)的需求五花八門,所以一個(gè)寫的很死的引擎必然沒有生命力。Fire Workflow引擎的各種服務(wù)都可以擴(kuò)展或者替換。
                 Fire Workflow雖然不認(rèn)可流程“自定義”需求,但是并不否認(rèn)用戶有調(diào)整業(yè)已存在的流程的需求,而且這種需求還比較普遍。所以Fire Workflow計(jì)劃提供Web界面,讓最終用戶的系統(tǒng)管理員在一定范圍內(nèi)調(diào)整流程。

          3、Fireflow的特點(diǎn)
                 理論嚴(yán)密
                 Fire Workflow以Petri Net作為理論基礎(chǔ),流程的順序流轉(zhuǎn)、分支、匯聚、跳轉(zhuǎn)等算法都有定義/定理為依據(jù)。
                 設(shè)計(jì)合理
                 Fire workflow將工作流引擎的職責(zé)分解委派到各種服務(wù)中,每中服務(wù)都可以被擴(kuò)展或者替換。
                 應(yīng)用簡(jiǎn)單
                  Fire workflow的API以及數(shù)據(jù)庫(kù)表結(jié)構(gòu)非常簡(jiǎn)單。

                 性能優(yōu)良
                 Fire workflow著重在流程實(shí)例的數(shù)據(jù)量,數(shù)據(jù)庫(kù)IO等方面進(jìn)行性能優(yōu)化。


          4、Fireflow的構(gòu)成
                 Fire Workflow由模型、引擎、設(shè)計(jì)器(包含模擬器)三部分組成。
                
          • 模型部分規(guī)定了流程定義文件的各種元素及其相互關(guān)系,例如流程(WorkflowProcess)、活動(dòng)(Activity)、轉(zhuǎn)移(Transition)、開始節(jié)點(diǎn)(StartNode)、結(jié)束節(jié)點(diǎn)(EndNode)、同步器(Synchronizer)。模型部分的實(shí)現(xiàn)在org-fireflow-model.jar中。
          • 引擎讀取流程定義文件并解釋執(zhí)行。引擎提供一組對(duì)象和相關(guān)的API供外部系統(tǒng)調(diào)用,如流程實(shí)例(ProcessInstance)、任務(wù)實(shí)例(TaskInstance)、工單(WorkItem)、事件等等。引擎部分的實(shí)現(xiàn)在org-fireflow-engine.jar中。
          • 設(shè)計(jì)器編輯并輸出流程定義文件。Fire Workflow的設(shè)計(jì)器附帶了強(qiáng)大的模擬器,可以在設(shè)計(jì)時(shí)模擬流程的執(zhí)行,從而檢查流程定義的正確性。

                 此處附帶解釋一下我的一個(gè)觀點(diǎn):我認(rèn)為,流程定義文件和java文件一樣,是應(yīng)用系統(tǒng)源代碼的一部分。因此,流程設(shè)計(jì)器做成了當(dāng)前流行的IDE的插件,便于開發(fā)人員進(jìn)行流程開發(fā)。而且每個(gè)流程單獨(dú)一個(gè)定義文件,就像每個(gè)java類在通常情況下單獨(dú)一個(gè)文件一樣。

          5、Fire Workflow的流程定義語言為什么不使用Xpdl
                 本人認(rèn)為Xpdl好看不好用。
                 相較于Xpdl,F(xiàn)ire workflow 的流程定義語言主要做了如下變動(dòng)。
                
          • 廢除Package的概念:在我看來一個(gè)流程一個(gè)文件比較方便開發(fā),流程定義文件在某中程度上和java類文件一樣,是系統(tǒng)源代碼的一部分
          • 廢除全局和局部的概念:在xpdl中有全局DataField和局部DataField區(qū)分,實(shí)際上其作用不大。
          • 增加同步器節(jié)點(diǎn):Fire Workflow將流程中的節(jié)點(diǎn)分成兩類 ,即Acitivyt和Sychronizer(Start Node和End Node是synchronizer的特例)。這兩類節(jié)點(diǎn)分別代表了業(yè)務(wù)子系統(tǒng)的邏輯操作和工作流子系統(tǒng)的邏輯操作。
          • 增加Task元素:一個(gè)Activity可以包含多個(gè)Task,Task代表實(shí)際的業(yè)務(wù)邏輯。

          posted @ 2009-05-16 22:04 江蘇520| 編輯 收藏

          集成struts2 spring hibernate的實(shí)例

          集成struts,spring,hibernate時(shí),對(duì)于初學(xué)者來說最大的麻煩就其繁瑣的xml配置文件。現(xiàn)在三者都對(duì)基于注解的配置提供了良好的支持。在struts2中,使用convent plugin,得益于annotation和規(guī)約,配置過程得以大大減少。在spring2.5也可以使用@Autowired,進(jìn)行注入,使用@Controller,@Service,@Repository注解,自動(dòng)定義bean,還支持annotation風(fēng)格的聲明式事務(wù)支持,以及aspectJ類似的AOP。hibernate也可以使用JPA標(biāo)準(zhǔn)注解定義實(shí)體描述,避免使用mapping文件。

          當(dāng)然,對(duì)于annotation和xml風(fēng)格的配置,誰更好,更多依賴個(gè)人興趣。但使用annotation確實(shí)減少了很多配置工作量。本文采用annotation風(fēng)格的配置,以TaskList為例子講解struts2 spring hibernate的集成。項(xiàng)目文件見附件。

          一:配置struts2。

          首先在web.xml文件中配置filter

          <filter>  
              
          <filter-name>struts2</filter-name>  
              
          <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>  
          </filter>  
            
          <filter-mapping>  
              
          <filter-name>struts2</filter-name>  
              
          <url-pattern>*.action</url-pattern>  
          </filter-mapping>  

          然后在classpath中創(chuàng)建struts.xml配置文件。

          <?xml version="1.0" encoding="UTF-8"?>  
          <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"   
                  " http://www.bt285.cn /dtds/struts-2.1.dtd"
          >  
          <struts>  
              
          <constant name="struts.devMode" value="true" />  
              
          <constant name="struts.convention.default.parent.package" value="default-package" />  
              
          <constant name="struts.convention.package.locators" value="action" />  
              
          <package name="default-package" extends="convention-default">  
            
                  
          <default-action-ref name="index" />  
            
                  
          <action name="index"  >  
                      
          <result>http://www.5a520.cn /WEB-INF/content/index.jsp</result>  
                  
          </action>    
            
              
          </package>  
          </struts>  

           

          struts.devMode屬性,配置啟用調(diào)試,將有更多的錯(cuò)誤信息輸出,便于排錯(cuò)。struts.convention.default.parent.package屬性,指定使用注解標(biāo)注的控制器的默認(rèn)包。可以在這個(gè)默認(rèn)包中配置全局信息。

          struts.convention.package.locators屬性,為查找控制器包路徑的關(guān)鍵字。如com.mycompany.action,com.mycompany.action.user,都會(huì)被struts2掃描。里面有繼承至Action的類,或類名以Action結(jié)尾的類,都會(huì)做為Action處理。

          <default-action-ref name="index" />指定了默認(rèn)action,如果指定的action不存在則訪問該action。

          把struts2-spring-plugin-2.1.6.jar添加到classpath中,struts2會(huì)自動(dòng)掃描struts-plugin.xml文件,該文件自動(dòng)注冊(cè)了com.opensymphony.xwork2.ObjectFactory,完成和spring的集成。

          二:配置spring

          在web.xml中加入ContextLoaderListener,用以啟動(dòng)spring容器。用contextConfigLocation指定spring配置文件路徑,可以使用*通配符結(jié)尾。

           

          <listener>  
              
          <listener-class>org.springframework.web.context.ContextLoaderListener   
              
          </listener-class>  
          </listener>  
          <context-param>  
              
          <param-name>contextConfigLocation</param-name>  
              
          <param-value>http://www.bt285.cn :/applicationContext.xml</param-value>  
          </context-param> 

          配置applicationContext.xml

          <?xml version="1.0" encoding="UTF-8"?>  
          <beans>  
            
              
          <context:component-scan base-package="persistence,service,action,aop"/>  
                 
              
          <aop:aspectj-autoproxy  />  
            
              
          <tx:annotation-driven transaction-manager="transactionManager" />  
                 
              
          <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" >  
                  
          <property name="sessionFactory" ref="sessionFactory" />  
              
          </bean>  
            
              
          <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >       
                  
          <property name="configLocation" value="classpath:hibernate.cfg.xml" />  
              
          </bean>  
            
              
          <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" >  
                  
          <property name="sessionFactory" ref="sessionFactory" />  
              
          </bean>  
                 
          </beans>  

          <context:component-scan />指定Bean掃描的包,多個(gè)包逗號(hào)隔開,任何標(biāo)注了@Component,@Controller,@Service,@Repository的類,都會(huì)被自動(dòng)識(shí)別為bean。

          <aop:aspectj-autoproxy />聲明aspectj動(dòng)態(tài)代理,啟用注解驅(qū)動(dòng)的aspectj配置。

          <tx:annotation-driven />啟用注解驅(qū)動(dòng)的聲明事務(wù)支持。

          然后定義了sessionFactory和transactionManager,hibernateTemplate用來注入到Dao中,取代繼承的方式使用spring對(duì)hibernate的集成支持。

          三:hibernate配置

          hibernate配置獨(dú)立配置,方便修改。

           

          <?xml version="1.0" encoding="UTF-8"?>  
          <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">  
          <hibernate-configuration>  
              
          <session-factory>  
                  
          <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>  
                  
          <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>  
                  
          <property name="hibernate.connection.url">jdbc:mysql:// http://www.feng123.com :3306/sshdemo</property>  
                  
          <property name="hibernate.connection.username">root</property>  
                  
          <property name="hibernate.connection.password">root</property>  
                  
          <property name="hibernate.hbm2ddl.auto">update</property>  
                  
          <property name="hibernate.show_sql">true</property>  
                  
          <property name="hibernate.format_sql">true</property>  
                  
          <property name="hibernate.current_session_context_class">thread</property>         
            
                  
          <!-- 最大連接數(shù) -->  
                  
          <property name="hibernate.c3p0.max_size">20</property>  
                  
          <!-- 最小連接數(shù) -->  
                  
          <property name="hibernate.c3p0.min_size">5</property>  
                  
          <!-- 獲得連接的超時(shí)時(shí)間,如果超過這個(gè)時(shí)間,會(huì)拋出異常,單位毫秒 -->  
                  
          <property name="hibernate.c3p0.timeout">120</property>  
                  
          <!-- 最大的PreparedStatement的數(shù)量 -->  
                  
          <property name="hibernate.c3p0.max_statements">100</property>  
                  
          <!-- 每隔120秒檢查連接池里的空閑連接 ,單位是秒-->  
                  
          <property name="hibernate.c3p0.idle_test_period">120</property>  
                  
          <!-- 當(dāng)連接池里面的連接用完的時(shí)候,C3P0一下獲取的新的連接數(shù) -->  
                  
          <property name="hibernate.c3p0.acquire_increment">2</property>  
                  
          <!-- 每次都驗(yàn)證連接是否可用 -->  
                  
          <property name="hibernate.c3p0.validate">true</property>  
            
                  
          <mapping class="domain.Task" />  
              
          </session-factory>  
          </hibernate-configuration>  


           

           

          posted @ 2009-05-14 17:40 江蘇520| 編輯 收藏

          我的常用分頁(yè)類

               摘要: package yourpackage;    import java.util.ArrayList;       /** *//**    * 分頁(yè)信息    * jdk 1.4 ...  閱讀全文

          posted @ 2009-05-13 16:54 江蘇520| 編輯 收藏

          僅列出標(biāo)題
          共2頁(yè): 上一頁(yè) 1 2 
          主站蜘蛛池模板: 华宁县| 谢通门县| 尉犁县| 肇州县| 西藏| 根河市| 治县。| 两当县| 万山特区| 方山县| 西畴县| 卢氏县| 临汾市| 治多县| 小金县| 辽阳县| 富川| 吴川市| 和林格尔县| 图们市| 赤城县| 邛崃市| 鹿泉市| 临武县| 秦安县| 额济纳旗| 衡阳县| 湾仔区| 油尖旺区| 济阳县| 囊谦县| 甘谷县| 类乌齐县| 景泰县| 玉溪市| 郧西县| 三门县| 忻州市| 前郭尔| 罗田县| 克什克腾旗|