<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    斷點

    每天進步一點點!
    posts - 174, comments - 56, trackbacks - 0, articles - 21

    一:WebLogic配置問題:
    由于WebLogic的配置問題,我們的系統運行出現了失敗情況。原因是為WebLogic分配的內存太少了。通過修改commom\bin\commEnv.cmd文件來增加內存分配。
    修改的部分如下:
    :bea
    if "%PRODUCTION_MODE%" == "true" goto bea_prod_mode
    set JAVA_VM=-jrockit
    set MEM_ARGS=-Xms768m -Xmx1024m
    set JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none
    goto continue
    :bea_prod_mode
    set JAVA_VM=-jrockit
    set MEM_ARGS=-Xms768m -Xmx1024m   //原來是128M~256M,太小了,數據太大
    goto continue
    結果修改后,沒有效果。還是有失敗的情況。
    發現,原來,在:bea下面還有一段配置信息如下:
    :
    sun
    if "%PRODUCTION_MODE%" == "true" goto sun_prod_mode
    set JAVA_VM=-client
    set MEM_ARGS=-Xms768m -Xmx1024m -XX:MaxPermSize=256m
    set JAVA_OPTIONS=%JAVA_OPTIONS% -Xverify:none
    goto continue
    :sun_prod_mode
    set JAVA_VM=-
    server
    set MEM_ARGS=-Xms768m -Xmx1024m -XX:MaxPermSize=256m
    goto continue


    將這里的內存分配修改后見效。
    原因是,上面對第一段代碼是為bea自己的JVM設置的,下面的是為Sun的設置的。而WebLogic默認的是Sun的,所以出了毛病。

    ,domain中的相關配置:
      1,
    修改bea\user_projects\domains\base_domain\bin\setDomainEnv.cmd文件.
      2,
    修改如下幾個位置:以下藍色部分是需修改的內存大小

         set MEM_ARGS=-Xms256m -Xmx512m   @
    最主要將這兩個值改大,這是此域啟動后,虛擬機可使用的內存

         if "%JAVA_VENDOR%"=="Sun" (           @
    使用sun服務器開發模式下的JVM配置
             if "%PRODUCTION_MODE%"=="" (
                  set MEM_DEV_ARGS=-XX:CompileThreshold=8000 -XX ermSize=48m
              )
          )

        if "%JAVA_VENDOR%"=="Sun" (            @
    使用sun服務器生產模式下的JVM配置
               set MEM_ARGS=%MEM_ARGS% %MEM_DEV_ARGS% -XX:MaxPermSize=128m
        )
       if "%JAVA_VENDOR%"=="HP" (               @
    使用hp服務器生產模式下的JVM配置
            set MEM_ARGS=%MEM_ARGS% -XX:MaxPermSize=128m
       )

    posted @ 2010-05-30 15:45 斷點 閱讀(1396) | 評論 (0)編輯 收藏

    weblogic在運行一段時間后,出現以下的錯誤:
    <2010-5-28 上午11時46分17秒 CST> <Error> <HTTP> <BEA-101017> <[weblogic.servlet.internal.WebAppServletContext@
    1b0d235 - appName: 'rules', name: 'rules', context-path: '/rules'] Root cause of ServletException.
    java.lang.OutOfMemoryError: PermGen space
    >


    解決方法:
    重新啟動weblogic,系統恢復正常。


    這里以tomcat環境為例,其它WEB服務器如jboss,weblogic等是同一個道理。

     一、java.lang.OutOfMemoryError: PermGen space PermGen space的全稱是Permanent Generation space,是指內存的永久保存區域, 這塊內存主要是被JVM存放Class和Meta信息的,Class在被Loader時就會被放到PermGen space中, 它和存放類實例(Instance)的Heap區域不同,GC(Garbage Collection)不會在主程序運行期對 PermGen space進行清理,所以如果你的應用中有很多CLASS的話,就很可能出現PermGen space錯誤, 這種錯誤常見在web服務器對JSP進行pre compile的時候。如果你的WEB APP下都用了大量的第三方jar, 其大小超過了jvm默認的大小(4M)那么就會產生此錯誤信息了。

     解決方法: 手動設置MaxPermSize大小修改TOMCAT_HOME/bin/catalina.sh 在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面加入以下行: JAVA_OPTS="-server -XX:PermSize=64M -XX:MaxPermSize=128m

     建議:將相同的第三方jar文件移置到tomcat/shared/lib目錄下,這樣可以達到減少jar 文檔重復占用內存的目的。


     二、java.lang.OutOfMemoryError: Java heap space Heap size 設置 JVM堆的設置是指java程序運行過程中JVM可以調配使用的內存空間的設置.JVM在啟動的時候會自動設置Heap size的值,其初始空間(即-Xms)是物理內存的1/64,最大空間(-Xmx)是物理內存的1/4。可以利用JVM提供的-Xmn -Xms -Xmx等選項可進行設置。Heap size 的大小是Young Generation 和Tenured Generaion 之和。提示:在JVM中如果98%的時間是用于GC且可用的Heap size 不足2%的時候將拋出此異常信息。提示:Heap Size 最大不要超過可用物理內存的80%,一般的要將-Xms和-Xmx選項設置為相同,而-Xmn為1/4的-Xmx值。

     解決方法:手動設置Heap size 修改TOMCAT_HOME/bin/catalina.sh 在“echo "Using CATALINA_BASE: $CATALINA_BASE"”上面加入以下行: JAVA_OPTS="-server -Xms800m -Xmx800m -XX:MaxNewSize=256m"


     三、實例,以下給出1G內存環境下java jvm 的參數設置參考:
    JAVA_OPTS="-server -Xms800m -Xmx800m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=128m -Djava.awt.headless=true "


     四、 可以配置下Tomcat。
    修改TOMCAT_HOME/bin/tomcat6w.exe 雙擊打開,在“Java "下設置如下:
    Initial memory pool:768 MB
    Maximum memory pool:1024 MB
    Thread stack size:64KB


    Java 堆 - 這是 JVM 用來分配 java 對象的內存。
    如果JVM不能在java堆中獲得更多內存來分配更多java對象,將會拋出java內存不足(java.lang.OutOfMemoryError)錯誤。默認情況下,應用程序崩潰。
    本地內存 - 這是 JVM 用于其內部操作的內存。
    如果 JVM 無法獲得更多本地內存,它將拋出本地內存不足(本地 OutOfMemoryError)錯誤。當進程到達操作系統的進程大小限值,或者當計算機用完 RAM 和交換空間時,通常會發生這種情況。
    進程大小 - 進程大小將是 java 堆、本地內存與加載的可執行文件和庫所占用內存的總和。在 32 位操作系統上,進程的虛擬地址空間最大可達到 4 GB。從這 4 GB 內存中,操作系統內核為自己保留一部分內存(通常為 1 - 2 GB)。剩余內存可用于應用程序。

    posted @ 2010-05-30 15:34 斷點 閱讀(658) | 評論 (0)編輯 收藏

    --項目中的用法。
    1、StringUtils.join
    List dwVoListInTab = this.prodService.getPicTabVOList(picId);
    List dwNameListInTab = new ArrayList();
            for (PrdTabVO dwVo : dwVoListInTab) {
              String dwName = this.prodService.cvtTabNo2DWName(useProdNo, picId,
                dwVo.getCTabNo());
              dwNameListInTab.add(dwName);
              dwNameMap.put(dwVo.getCNmeEn(), dwName);
            }
            ((List)plyDwNameList).addAll(dwNameListInTab);

    String dwNameListStr = "['" + StringUtils.join(dwNameListInTab.toArray(), "','") + "']";
    其它:
    StringUtils.join(new String[]{"cat","dog","carrot","leaf","door"}, ":")
    // cat:dog:carrot:leaf:door

    2、StringUtils.isNotEmpty    //Checks if a String is not empty ("") and not null.

    if (StringUtils.isNotEmpty(onload)) 
              onload = sub.replace(onload);
            else {
              onload = "";
            }

    public String replace(char oldChar,char newChar)返回一個新的字符串,它是通過用 newChar 替換此字符串中出現的所有 oldChar 得到的。
    如果 oldChar 在此 String 對象表示的字符序列中沒有出現,則返回對此 String 對象的引用。

    3、StringUtils.equals    //StringUtils.equals(null, null)   = true
     if (!StringUtils.equals(prodKindNo, "00")) {
    }

    4、StringUtils.isBlank     //Checks if a String is whitespace, empty ("") or null.
    if (StringUtils.isBlank(taskId))
            jsBuffer.append("var taskId='';\n");
          else {
            jsBuffer.append("var taskId='" + taskId + "';\n");
          }

     
    5、StringUtils.leftPad(String str, int size,String padStr) --左填充
    //投保年度【保險起期 - 初登年月】 單位:年
    String ply_year = StringUtils.leftPad(String.valueOf(DateUtils.compareYear(regDate,base.getTInsrncBgnTm())), 2, '0'); 
     
    /**
    4260         * <p>Left pad a String with a specified String.</p>
    4261         *
    4262         * <p>Pad to a size of <code>size</code>.</p>
    4263         *
    4264         * <pre>
    4265         * StringUtils.leftPad(null, *, *)      = null
    4266         * StringUtils.leftPad("", 3, "z")      = "zzz"
    4267         * StringUtils.leftPad("bat", 3, "yz")  = "bat"
    4268         * StringUtils.leftPad("bat", 5, "yz")  = "yzbat"
    4269         * StringUtils.leftPad("bat", 8, "yz")  = "yzyzybat"
    4270         * StringUtils.leftPad("bat", 1, "yz")  = "bat"
    4271         * StringUtils.leftPad("bat", -1, "yz") = "bat"
    4272         * StringUtils.leftPad("bat", 5, null)  = "  bat"
    4273         * StringUtils.leftPad("bat", 5, "")    = "  bat"
    4274         * </pre>
    4275         *
    4276         * @param str  the String to pad out, may be null
    4277         * @param size  the size to pad to
    4278         * @param padStr  the String to pad with, null or empty treated as single space
    4279         * @return left padded String or original String if no padding is necessary,
    4280         *  <code>null</code> if null String input
    4281         */
    4282        public static String leftPad(String str, int size, String padStr) {
    4283            if (str == null) {
    4284                return null;
    4285            }
    4286            if (isEmpty(padStr)) {
    4287                padStr = " ";
    4288            }
    4289            int padLen = padStr.length();
    4290            int strLen = str.length();
    4291            int pads = size - strLen;
    4292            if (pads <= 0) {
    4293                return str; // returns original String when possible
    4294            }
    4295            if (padLen == 1 && pads <= PAD_LIMIT) {
    4296                return leftPad(str, size, padStr.charAt(0));
    4297            }
    4298   
    4299            if (pads == padLen) {
    4300                return padStr.concat(str);
    4301            } else if (pads < padLen) {
    4302                return padStr.substring(0, pads).concat(str);
    4303            } else {
    4304                char[] padding = new char[pads];
    4305                char[] padChars = padStr.toCharArray();
    4306                for (int i = 0; i < pads; i++) {
    4307                    padding[i] = padChars[i % padLen];
    4308                }
    4309                return new String(padding).concat(str);
    4310            }
    4311        }


    ---------------------------------------------


    詳見:http://commons.apache.org/lang/api/org/apache/commons/lang/StringUtils.html

    isEmpty
    public static boolean isEmpty(CharSequence str)
    Checks if a String is empty ("") or null.

     StringUtils.isEmpty(null)      = true
    StringUtils.isEmpty("")        = true
    StringUtils.isEmpty(" ")       = false
    StringUtils.isEmpty("bob")     = false
    StringUtils.isEmpty("  bob  ") = false

    NOTE: This method changed in Lang version 2.0. It no longer trims the String. That

    functionality is available in isBlank().

     

    Parameters:
    str - the String to check, may be null
    Returns:
    true if the String is empty or null


    isNotEmpty
    public static boolean isNotEmpty(CharSequence str)
    Checks if a String is not empty ("") and not null.

     StringUtils.isNotEmpty(null)      = false
    StringUtils.isNotEmpty("")        = false
    StringUtils.isNotEmpty(" ")       = true
    StringUtils.isNotEmpty("bob")     = true
    StringUtils.isNotEmpty("  bob  ") = true

     

    Parameters:
    str - the String to check, may be null
    Returns:
    true if the String is not empty and not null


    isBlank
    public static boolean isBlank(CharSequence str)
    Checks if a String is whitespace, empty ("") or null.

     StringUtils.isBlank(null)      = true
    StringUtils.isBlank("")        = true
    StringUtils.isBlank(" ")       = true
    StringUtils.isBlank("bob")     = false
    StringUtils.isBlank("  bob  ") = false

     

    Parameters:
    str - the String to check, may be null
    Returns:
    true if the String is null, empty or whitespace
    Since:
    2.0


    isNotBlank
    public static boolean isNotBlank(CharSequence str)
    Checks if a String is not empty (""), not null and not whitespace only.

     StringUtils.isNotBlank(null)      = false
    StringUtils.isNotBlank("")        = false
    StringUtils.isNotBlank(" ")       = false
    StringUtils.isNotBlank("bob")     = true
    StringUtils.isNotBlank("  bob  ") = true

     

    Parameters:
    str - the String to check, may be null
    Returns:
    true if the String is not empty and not null and not whitespace
    Since:
    2.0


    trim
    public static String trim(String str)
    Removes control characters (char <= 32) from both ends of this String, handling null by

    returning null.

    The String is trimmed using String.trim(). Trim removes start and end characters <= 32.

    To strip whitespace use strip(String).

    To trim your choice of characters, use the strip(String, String) methods.

     StringUtils.trim(null)          = null
    StringUtils.trim("")            = ""
    StringUtils.trim("     ")       = ""
    StringUtils.trim("abc")         = "abc"
    StringUtils.trim("    abc    ") = "abc"

     

    Parameters:
    str - the String to be trimmed, may be null
    Returns:
    the trimmed string, null if null String input


    trimToNull
    public static String trimToNull(String str)
    Removes control characters (char <= 32) from both ends of this String returning null if

    the String is empty ("") after the trim or if it is null.

    The String is trimmed using String.trim(). Trim removes start and end characters <= 32.

    To strip whitespace use stripToNull(String).

     StringUtils.trimToNull(null)          = null
    StringUtils.trimToNull("")            = null
    StringUtils.trimToNull("     ")       = null
    StringUtils.trimToNull("abc")         = "abc"
    StringUtils.trimToNull("    abc    ") = "abc"

     

    Parameters:
    str - the String to be trimmed, may be null
    Returns:
    the trimmed String, null if only chars <= 32, empty or null String input
    Since:
    2.0


    trimToEmpty
    public static String trimToEmpty(String str)
    Removes control characters (char <= 32) from both ends of this String returning an empty

    String ("") if the String is empty ("") after the trim or if it is null.

    The String is trimmed using String.trim(). Trim removes start and end characters <= 32.

    To strip whitespace use stripToEmpty(String).

     StringUtils.trimToEmpty(null)          = ""
    StringUtils.trimToEmpty("")            = ""
    StringUtils.trimToEmpty("     ")       = ""
    StringUtils.trimToEmpty("abc")         = "abc"
    StringUtils.trimToEmpty("    abc    ") = "abc"

     

    Parameters:
    str - the String to be trimmed, may be null
    Returns:
    the trimmed String, or an empty String if null input
    Since:
    2.0
    equals
    public static boolean equals(String str1,
    String str2)
    Compares two Strings, returning true if they are equal.

    nulls are handled without exceptions. Two null references are considered to be equal. The

    comparison is case sensitive.

     StringUtils.equals(null, null)   = true
    StringUtils.equals(null, "abc")  = false
    StringUtils.equals("abc", null)  = false
    StringUtils.equals("abc", "abc") = true
    StringUtils.equals("abc", "ABC") = false

     

    Parameters:
    str1 - the first String, may be null
    str2 - the second String, may be null
    Returns:
    true if the Strings are equal, case sensitive, or both null
    See Also:
    String.equals(Object) 
     
    startsWith
    public static boolean startsWith(String str,
    String prefix)
    Check if a String starts with a specified prefix.

    nulls are handled without exceptions. Two null references are considered to be equal. The

    comparison is case sensitive.

     StringUtils.startsWith(null, null)      = true
    StringUtils.startsWith(null, "abc")     = false
    StringUtils.startsWith("abcdef", null)  = false
    StringUtils.startsWith("abcdef", "abc") = true
    StringUtils.startsWith("ABCDEF", "abc") = false

     

    Parameters:
    str - the String to check, may be null
    prefix - the prefix to find, may be null
    Returns:
    true if the String starts with the prefix, case sensitive, or both null
    Since:
    2.4
    See Also:
    String.startsWith(String)


    1.去除尾部換行符,使用函數:StringUtils.chomp(testString)
    函數介紹:去除testString尾部的換行符
    例程:
    String input = "Hello\n";  
    System.out.println( StringUtils.chomp( input ));  
    String input2 = "Another test\r\n";  
    System.out.println( StringUtils.chomp( input2 )); 

    輸出如下:
        Hello
        Another test


    2.判斷字符串內容的類型,函數介紹:
    StringUtils.isNumeric( testString ) :如果testString全由數字組成返回True
    StringUtils.isAlpha( testString ) :如果testString全由字母組成返回True
    StringUtils.isAlphanumeric( testString ) :如果testString全由數字或數字組成返回True
    StringUtils.isAlphaspace( testString ) :如果testString全由字母或空格組成返回True

    例程:
    String state = "Virginia";  
    System.out.println( "Is state number? " + StringUtils.isNumeric(state ) );  
    System.out.println( "Is state alpha? " + StringUtils.isAlpha( state ));  
    System.out.println( "Is state alphanumeric? " +StringUtils.isAlphanumeric( state ) );  
    System.out.println( "Is state alphaspace? " + StringUtils.isAlphaSpace( state ) ); 

    輸出如下:
        Is state number? false
        Is state alpha? true
        Is state alphanumeric? true
        Is state alphaspace? true


    3.查找嵌套字符串,使用函數:
    StringUtils.substringBetween(testString,header,tail)
    函數介紹:在testString中取得header和tail之間的字符串。不存在則返回空
    例程:
    String htmlContent = "ABC1234ABC4567";  
    System.out.println(StringUtils.substringBetween(htmlContent, "1234", "4567"));  
    System.out.println(StringUtils.substringBetween(htmlContent, "12345", "4567")); 

    輸出如下:
        ABC
        null


    4.顛倒字符串,使用函數:StringUtils.reverse(testString)
    函數介紹:得到testString中字符顛倒后的字符串
    例程:
    System.out.println( StringUtils.reverse("ABCDE")); 

    輸出如下:
        EDCBA


    5.部分截取字符串,使用函數:
    StringUtils.substringBetween(testString,fromString,toString ):取得兩字符之間的字符串
    StringUtils.substringAfter( ):取得指定字符串后的字符串
    StringUtils.substringBefore( ):取得指定字符串之前的字符串
    StringUtils.substringBeforeLast( ):取得最后一個指定字符串之前的字符串
    StringUtils.substringAfterLast( ):取得最后一個指定字符串之后的字符串

    函數介紹:上面應該都講明白了吧。
    例程:
    String formatted = " 25 * (30,40) [50,60] | 30";  
    System.out.print("N0: " + StringUtils.substringBeforeLast( formatted, "*" ) );  
    System.out.print(", N1: " + StringUtils.substringBetween( formatted, "(", "," ) );  
    System.out.print(", N2: " + StringUtils.substringBetween( formatted, ",", ")" ) );  
    System.out.print(", N3: " + StringUtils.substringBetween( formatted, "[", "," ) );  
    System.out.print(", N4: " + StringUtils.substringBetween( formatted, ",", "]" ) );  
    System.out.print(", N5: " + StringUtils.substringAfterLast( formatted, "|" ) ); 

    輸出如下:
        N0: 25 , N1: 30, N2: 40, N3: 50, N4: 40) [50,60, N5: 30

    posted @ 2010-05-30 10:46 斷點 閱讀(630) | 評論 (0)編輯 收藏

    MethodUtils的簡單用法。

    package com.ztf;

    import java.util.Map;

    import org.apache.commons.beanutils.MethodUtils;
    import org.apache.commons.beanutils.PropertyUtils;

    public class TestMethodUtils {  
            
    public static void main(String[] args) throws Exception{  
                  
                Entity entity 
    = new Entity();  
                entity.setId(
    1) ;
                entity.setName(
    "斷點");
                
               
    // 通過MethodUtils的invokeMethod方法,執行指定的entity中的方法(無參的情況)
                MethodUtils.invokeMethod(entity, "sayHello"null);  
                  
                
    // 通過MethodUtils的invokeMethod方法,執行指定的entity中的方法(1參的情況)
                MethodUtils.invokeMethod(entity, "sayHello""斷點");  
                  
                
    // 通過MethodUtils的invokeMethod方法,執行指定的entity中的方法(多參的情況)
                Object[] params = new Object[]{new Integer(10),new Integer(12)};  
                MethodUtils.invokeMethod(entity, 
    "sayHello", params);  
            }
      
    }
      

    實體:
    package com.ztf;

    public class Entity {
        
    private Integer id;
        
    private String name;
        
        
    public void sayHello(){
            System.out.println(
    "sayHello()---> 無參");
        }

        
        
    public void sayHello(String s){
            System.out.println(
    "sayHello()---> 有1個參數" );
        }

        
        
    public void sayHello(Integer a,Integer b){
            System.out.println(
    "sayHello()---> 有2個參數");
        }

      
        
    public String getName() {
            
    return name;
        }

        
    public void setName(String name) {
            
    this.name = name;
        }

        
    public Integer getId() {
            
    return id;
        }

        
    public void setId(Integer id) {
            
    this.id = id;
        }

    }


    輸出:
    sayHello()---> 無參
    sayHello()---> 有1個參數
    sayHello()---> 有2個參數

    posted @ 2010-05-30 10:01 斷點 閱讀(431) | 評論 (0)編輯 收藏

    實體bean。
    package com.ztf;

    public class Entity {
        
    private Integer id;
        
    private String name;
        
        
    public void sayHello(){
            System.out.println(
    "sayHello()---> 無參");
        }

        
        
    public void sayHello(String s){
            System.out.println(
    "sayHello()---> 有1個參數" );
        }

        
        
    public void sayHello(Integer a,Integer b){
            System.out.println(
    "sayHello()---> 有2個參數");
        }

      
        
    public String getName() {
            
    return name;
        }

        
    public void setName(String name) {
            
    this.name = name;
        }

        
    public Integer getId() {
            
    return id;
        }

        
    public void setId(Integer id) {
            
    this.id = id;
        }

    }


    package com.ztf;
    import java.util.Map;

    import org.apache.commons.beanutils.MethodUtils;
    import org.apache.commons.beanutils.PropertyUtils;

    public class TestPropertyUtils {  
            
    public static void main(String[] args) throws Exception{  
                  
                Entity entity 
    = new Entity();  
                entity.setId(
    1) ;
                entity.setName(
    "斷點");
                
                
    // 通過PropertyUtils的getProperty方法獲取指定屬性的值
                Integer id = (Integer)PropertyUtils.getProperty(entity, "id");  
                String name 
    = (String)PropertyUtils.getProperty(entity, "name");  
                System.out.println(
    "id = " + id + "  name = " + name);  
                  
                
    // 調用PropertyUtils的setProperty方法設置entity的指定屬性
                PropertyUtils.setProperty(entity, "name""每天進步一點");  
                System.out.println(
    "name = " + entity.getName());  
                  
                
    // 通過PropertyUtils的describe方法把entity的所有屬性與屬性值封裝進Map中
                Map map = PropertyUtils.describe(entity);  
                System.out.println(
    "id = " + map.get("id"+ "  name = " + map.get("name"));  
                  
                      }
      
    }
      

    輸出:
    id = 1  name = 斷點
    name = 每天進步一點
    id = 1  name = 每天進步一點


    其它例子:
    import org.apache.commons.beanutils.PropertyUtils;
    List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
    for(BaseGrpMemberVO member : MemberVO){
              Map m = new HashMap();
              for(Map.Entry<String, String> entry: fieldMap.entrySet()){
                        String key = entry.getKey();
                        fieldList.add(key); //記錄字段名
                        String[] keyArray = key.split("\\.");
                        if(keyArray.length == 2){//成員信息
                            Object o =PropertyUtils.getProperty(member, keyArray[1]);
                            m.put(key, o==null?"":o.toString());
                        }else if(keyArray.length == 3){//險別信息
                            List<BaseGrpCvrgVO> cvrgVoList = mgr.getRelCvrgById(member.getCPkId());
                            String cvrgNo = keyArray[0];
                            for(BaseGrpCvrgVO cvrgVo : cvrgVoList){
                                if(cvrgNo.equals(cvrgVo.getCCvrgNo())){
                                    Object o =PropertyUtils.getProperty(cvrgVo, keyArray[2]);
                                    m.put(key, o==null?"":o.toString());
                                }
                            }   
                        }
                    }
              data.add(m);
           }

    posted @ 2010-05-30 09:51 斷點 閱讀(552) | 評論 (0)編輯 收藏

    apache.commons.beanutils.BeanUtils
    該class提供了一系列的靜態方法操作已存在的符合JavaBean規范定義的Java Class.這里強調的JavaBean規范,簡單來說就是一個Java Class通過一系列getter和setter的方法向外界展示其內在的成員變量(屬性)。

    通過BeanUtils的靜態方法,我們可以:
    復制一個JavaBean的實例--BeanUtils.cloneBean();
    在一個JavaBean的兩個實例之間復制屬性--BeanUtils.copyProperties(),BeanUtils.copyProperty();
    為一個JavaBean的實例設置成員變量(屬性)值--BeanUtils.populate(),BeanUtils.setProperty();
    從一個JavaBean的實例中讀取成員變量(屬性)的值--BeanUtils.getArrayProperty(),BeanUtils.getIndexedProperty(),BeanUtils.getMappedProperty(),BeanUtils.getNestedProperty(),BeanUtils.getSimpleProperty(),BeanUtils.getProperty(),BeanUtils.describe();

    1、BeanUtils.cloneBean(java.lang.object bean)
    為bean創建一個clone對象,方法返回類型為Object.此方法的實現機制建立在bean提供的一系列的getters和setters的基礎之上.此方法的正常使用代碼非常簡單,故略掉.

     

    2、BeanUtils.copyProperties(java.lang.Object dest, java.lang.Object orig)
    一個bean class有兩個實例:orig和dest,將orig中的成員變量的值復制給dest,即將已經存在的dest變為orig的副本.與BeanUtils.cloneBean(java.lang.object bean)的區別就在于是不是需要創建新的實例了.
    原文如下:Copy property values from the origin bean to the destination bean for all cases where the property names are the same.


    3、BeanUtils.setProperty(java.lang.Object bean,java.lang.String name,java.lang.Object value)
    這個方法簡單的說就是將bean中的成員變量name賦值為value.


    BeanUtils.populate(java.lang.Object bean, java.util.Map properties)
    使用一個map為bean賦值,該map中的key的名稱與bean中的成員變量名稱相對應.注意:只有在key和成員變量名稱完全對應的時候,populate機制才發生作用;但是在數量上沒有任何要求,如map中的key如果是成員變量名稱的子集,那么成員變量中有的而map中不包含的項將會保留默認值;同樣,如果成員變量是map中key的子集,那么多余的key不會對populate的結果產生任何影響.恩,結果就是populate只針對map中key名稱集合與bean中成員變量名稱集合的交集產生作用。


    4、BeanUtils.getArrayProperty(java.lang.Object bean,java.lang.String name)
    獲取bean中數組成員變量(屬性)的值.
    如果我們指定的name不是數組類型的成員變量,結果會如何?會不會拋出類型錯誤的exception呢?回答是不會,仍然會返回一個String的數組,數組的第一項就是name對應的值(如果不

    是String類型的話,JVM會自動的調用toString()方法的).


    BeanUtils.getIndexedProperty(java.lang.Object bean,java.lang.String name)
    BeanUtils.getIndexedProperty(java.lang.Object bean,java.lang.String name,int index)
    這兩個方法都是獲取數組成員變量(屬性)中的單一元素值的方法.
    比如,我想得到SampleObject中words[1]的值,用法如下:
    BeanUtils.getIndexedProperty(sampleOjbectInstance,"words[1]");
    BeanUtils.getIndexedProperty(sampleOjbectInstance,"words",1);


    BeanUtils.getMappedProperty(java.lang.Object bean,java.lang.String name)
    BeanUtils.getMappedProperty(java.lang.Object bean,java.lang.String name,java.lang.String key)


    BeanUtils.describe(java.lang.Object bean)
    將一個bean以map的形式展示。

    來源:http://www.chinaitpower.com/A/2005-07-03/150232.html

    posted @ 2010-05-30 09:25 斷點 閱讀(429) | 評論 (0)編輯 收藏

    原因:在這兩天的時間里,weblogic92把我很是郁悶了一把,原因是我本地的工程走業務流程沒有問題,而到它上面去跑流程就是 處理失敗!真正的問題就是2個jar包的有沖突,一樣的class文件,名字分別為pcis_reinsure.jar、pcis_reinsure_open.jar 。在我提交svn的時候,把pcis_reinsure.jar刪除了,把pcis_reinsure_open.jar 新增了,結果weblogic92的緩存中含有pcis_reinsure.jar、pcis_reinsure_open.jar 。

    注:pcis_reinsure.jar 舊包、pcis_reinsure_open.jar 新包,其中一個類IRiskUnitService有方法divideRiskUnit,而另一個沒有這個方法,所以老是提示
    Caused by: java.lang.NoSuchMethodError: com..pcis.riskunit.service.IRiskUnitService.divideRiskUnit(L
    com/isoftstone/pcis/policy/dm/bo/PolicyApplication;)V


    解決:
    在Tomcat中,我們知道%catalina_home%\work是存放緩存文件的地方,可以通過刪除這里面的文件,讓它重新編譯,以便代碼生效。

    weblogic92的緩存文件存放在哪里呢? 
    weblogic92的發布項目緩存臨時文件路徑是
    D:\bea\user_projects\domains\nonvhl_policy\servers\AdminServer\tmp\_WL_user\nonvhl_policy\4huf50\war\WEB-INF\lib,在此路徑下把pcis_reinsure.jar刪除就可以了。

    注意:
    1、要停服務后再刪除緩存文件,運行時它已經加載到內存了。

    2、緩存只加載新增的文件,對于工程刪除的jar文件它不做刪除。

    posted @ 2010-05-28 13:54 斷點 閱讀(7429) | 評論 (1)編輯 收藏

     

    .
    JAVA Memory arguments: -Xms512m -Xmx768m -XX:CompileThreshold=8000 -XX:PermSize=48m  -XX:MaxPermSize=256m
    .
    WLS Start Mode=Development
    .
    CLASSPATH=D:\bea\weblogic_crack.jar;;d:\bea\patch_weblogic920\profiles\default\sys_manifest_classpath\weblogic
    _patch.jar;d:\bea\JDK150~1\lib\tools.jar;D:\bea\WEBLOG~1\server\lib\weblogic_sp.jar;D:\bea\WEBLOG~1\server\lib
    \weblogic.jar;D:\bea\WEBLOG~1\server\lib\webservices.jar;;D:\bea\WEBLOG~1\common\eval\pointbase\lib\pbclient51
    .jar;D:\bea\WEBLOG~1\server\lib\xqrl.jar;;
    .
    PATH=d:\bea\patch_weblogic920\profiles\default\native;D:\bea\WEBLOG~1\server\native\win\32;D:\bea\WEBLOG~1\ser
    ver\bin;d:\bea\JDK150~1\jre\bin;d:\bea\JDK150~1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:
    \bea\WEBLOG~1\server\native\win\32\oci920_8
    .
    ***************************************************
    *  To start WebLogic Server, use a username and   *
    *  password assigned to an admin-level user.  For *
    *  server administration, use the WebLogic Server *
    *  console at http:\\hostname:port\console        *
    ***************************************************
    starting weblogic with Java version:
    java version "1.5.0_04"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
    Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
    Starting WLS with line:
    d:\bea\JDK150~1\bin\java -client   -Xms512m -Xmx768m -XX:CompileThreshold=8000 -XX:PermSize=48m  -XX:MaxPermSi
    ze=256m  -Xverify:none  -da -Dplatform.home=D:\bea\WEBLOG~1 -Dwls.home=D:\bea\WEBLOG~1\server -Dwli.home=D:\be
    a\WEBLOG~1\integration  -Dweblogic.management.discover=true  -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logE
    rrorsToConsole= -Dweblogic.ext.dirs=d:\bea\patch_weblogic920\profiles\default\sysext_manifest_classpath -Dwebl
    ogic.Name=AdminServer -Djava.security.policy=D:\bea\WEBLOG~1\server\lib\weblogic.policy   weblogic.Server
    <2010-5-24 上午09時42分56秒 CST> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory conten
    ts added to the end of the classpath:
    D:\bea\weblogic92\platform\lib\p13n\p13n-schemas.jar;D:\bea\weblogic92\platform\lib\p13n\p13n_common.jar;D:\be
    a\weblogic92\platform\lib\p13n\p13n_system.jar;D:\bea\weblogic92\platform\lib\wlp\netuix_common.jar;D:\bea\web
    logic92\platform\lib\wlp\netuix_schemas.jar;D:\bea\weblogic92\platform\lib\wlp\netuix_system.jar;D:\bea\weblog
    ic92\platform\lib\wlp\wsrp-common.jar>
    <2010-5-24 上午09時42分56秒 CST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotS
    pot(TM) Client VM Version 1.5.0_04-b05 from Sun Microsystems Inc.>
    <2010-5-24 上午09時42分57秒 CST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 9.2  Fri Jun 23 20
    :47:26 EDT 2006 783464 >
    <2010-5-24 上午09時43分00秒 CST> <Info> <WebLogicServer> <BEA-000215> <Loaded License : d:\bea\license.bea>
    <2010-5-24 上午09時43分00秒 CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
    <2010-5-24 上午09時43分00秒 CST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
    <2010-5-24 上午09時43分00秒 CST> <Notice> <Log Management> <BEA-170019> <The server log file D:\bea\user_proje
    cts\domains\nonvhl_policy\servers\AdminServer\logs\AdminServer.log is opened. All server side log events will
    be written to this file.>
    <2010-5-24 上午09時43分00秒 CST> <Error> <Socket> <BEA-000438> <Unable to load performance pack. Using Java I/
    O instead. Please ensure that wlntio.dll is in: 'd:\bea\JDK150~1\bin;.;C:\WINDOWS\system32;C:\WINDOWS;d:\bea\p
    atch_weblogic920\profiles\default\native;D:\bea\WEBLOG~1\server\native\win\32;D:\bea\WEBLOG~1\server\bin;d:\be
    a\JDK150~1\jre\bin;d:\bea\JDK150~1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\bea\WEBLOG~1
    \server\native\win\32\oci920_8'
    >
    <2010-5-24 上午09時43分02秒 CST> <Notice> <Security> <BEA-090082> <Security initializing using security realm
    myrealm.>
    <2010-5-24 上午09時43分03秒 CST> <Critical> <Deployer> <BEA-149618> <Unable to deploy an internal management W
    eb application - bea_wls_management_internal2. Managed servers may be unable to start.
    weblogic.management.DeploymentException: weblogic.management.DeploymentException:
            at weblogic.deploy.internal.InternalAppProcessor.stageFilesAndCreateBeansForInternalApp(InternalAppPro
    cessor.java:258)
            at weblogic.deploy.internal.InternalAppProcessor.updateConfiguration(InternalAppProcessor.java:196)
            at weblogic.management.deploy.internal.DeploymentServerService.init(DeploymentServerService.java:144)
            at weblogic.management.deploy.internal.DeploymentPreStandbyServerService.start(DeploymentPreStandbySer
    verService.java:32)
            at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
            Truncated. see log file for complete stacktrace
    java.util.zip.ZipException: Error opening file - D:\bea\WEBLOG~1\server\lib\bea_wls_management_internal2.war M
    essage - 系統找不到指定的文件。
            at weblogic.servlet.utils.WarUtils.existsInWar(WarUtils.java:65)
            at weblogic.servlet.utils.WarUtils.isWar(WarUtils.java:44)
            at weblogic.servlet.internal.WarDeploymentFactory.findOrCreateComponentMBeans(WarDeploymentFactory.jav
    a:54)
            at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48
    )
            at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
            Truncated. see log file for complete stacktrace
    >
    <2010-5-24 上午09時43分03秒 CST> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason:

    There are 1 nested errors:

    weblogic.management.provider.UpdateException: [Deployer:149616]A critical internal application bea_wls_managem
    ent_internal2 was not deployed. Error: weblogic.management.DeploymentException:
            at weblogic.deploy.internal.InternalAppProcessor.handleErr(InternalAppProcessor.java:211)
            at weblogic.deploy.internal.InternalAppProcessor.updateConfiguration(InternalAppProcessor.java:198)
            at weblogic.management.deploy.internal.DeploymentServerService.init(DeploymentServerService.java:144)
            at weblogic.management.deploy.internal.DeploymentPreStandbyServerService.start(DeploymentPreStandbySer
    verService.java:32)
            at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
    Caused by: java.util.zip.ZipException: Error opening file - D:\bea\WEBLOG~1\server\lib\bea_wls_management_inte
    rnal2.war Message - 系統找不到指定的文件。
            at weblogic.servlet.utils.WarUtils.existsInWar(WarUtils.java:65)
            at weblogic.servlet.utils.WarUtils.isWar(WarUtils.java:44)
            at weblogic.servlet.internal.WarDeploymentFactory.findOrCreateComponentMBeans(WarDeploymentFactory.jav
    a:54)
            at weblogic.application.internal.MBeanFactoryImpl.findOrCreateComponentMBeans(MBeanFactoryImpl.java:48
    )
            at weblogic.application.internal.MBeanFactoryImpl.createComponentMBeans(MBeanFactoryImpl.java:110)
            at weblogic.application.inter

    解決方法:
    1、把自己以前安裝的bea目錄下的
    D:\bea\WEBLOG~1\server\lib\bea_wls_management_internal2.war Message 文件重新復制一份放在當前bea下即可。

    2、還有一種就是重新裝下bea。

    posted @ 2010-05-24 14:21 斷點 閱讀(3959) | 評論 (0)編輯 收藏

    ArrayUtils類幫我們完成數組的打印、查找、克隆、倒序、以及值型/對象數組之間的轉換等操作。

     1import org.apache.commons.lang.ArrayUtils;
     2
     3public class TestArrayUtils {
     4    
     5    public static void main(String[] args) {   
     6        /**
     7         * 打印數組中的內容
     8         */

     9        int[] intArray = new int[] 23456 };
    10        int[][] multiDimension = new int[][] 123 }23 }{567} };
    11        
    12        System.out.println( "intArray: " + ArrayUtils.toString( intArray ) );
    13        System.out.println( "multiDimension: " + ArrayUtils.toString( multiDimension ) );
    14    }

    15}

    輸出:
    intArray: {2,3,4,5,6}
    multiDimension: {{1,2,3},{2,3},{5,6,7}}

    posted @ 2010-05-17 23:57 斷點 閱讀(238) | 評論 (0)編輯 收藏

     CollectionUtils 中四個方法對集合操作: union(),intersection(),disjunction();,subtract()。

     1import java.util.Arrays;     
     2import java.util.Collection;     
     3import java.util.Collections;     
     4import java.util.List;     
     5     
     6import org.apache.commons.collections.CollectionUtils;     
     7import org.apache.commons.lang.ArrayUtils;     
     8     
     9public class TestCollectionUtils {     
    10 @SuppressWarnings("unchecked")     
    11 public static void main(String[] args) {     
    12  String[] arrayA = new String[] "1""2""3""3""4""5" };     
    13  String[] arrayB = new String[] "3""4""4""5""6""7" };     
    14     
    15  List<String> a = Arrays.asList(arrayA);     
    16  List<String> b = Arrays.asList(arrayB);     
    17  // 并集
    18  Collection<String> union = CollectionUtils.union(a, b);     
    19  // 交集
    20  Collection<String> intersection = CollectionUtils.intersection(a, b);     
    21  // 交集的補集
    22  Collection<String> disjunction = CollectionUtils.disjunction(a, b);     
    23  // 集合相減
    24  Collection<String> subtract = CollectionUtils.subtract(a, b);     
    25     
    26  Collections.sort((List<String>) union);     
    27  Collections.sort((List<String>) intersection);     
    28  Collections.sort((List<String>) disjunction);     
    29  Collections.sort((List<String>) subtract);     
    30     
    31  System.out.println("A: " + ArrayUtils.toString(a.toArray()));     
    32  System.out.println("B: " + ArrayUtils.toString(b.toArray()));     
    33  System.out.println("--------------------------------------------");     
    34  System.out.println("Union(A, B): " + ArrayUtils.toString(union.toArray()));     
    35  System.out.println("Intersection(A, B): " + ArrayUtils.toString(intersection.toArray()));     
    36  System.out.println("Disjunction(A, B): " + ArrayUtils.toString(disjunction.toArray()));     
    37  System.out.println("Subtract(A, B): " + ArrayUtils.toString(subtract.toArray()));     
    38 }
         
    39}
       

    輸出:
    A: {1,2,3,3,4,5}
    B: {3,4,4,5,6,7}
    --------------------------------------------
    Union(A, B): {1,2,3,3,4,4,5,6,7}
    Intersection(A, B): {3,4,5}
    Disjunction(A, B): {1,2,3,4,6,7}
    Subtract(A, B): {1,2,3}

    轉載:http://blog.csdn.net/ofofw/archive/2009/06/26/4300964.aspx

    posted @ 2010-05-17 23:29 斷點 閱讀(628) | 評論 (0)編輯 收藏

    僅列出標題
    共18頁: First 上一頁 2 3 4 5 6 7 8 9 10 下一頁 Last 
    主站蜘蛛池模板: 国产V亚洲V天堂A无码| 亚洲日韩精品无码专区| 夜夜爽妓女8888视频免费观看 | 久久精品免费观看国产| 日本人的色道免费网站| 亚洲人成影院在线| 91精品国产免费入口| 亚洲国产综合人成综合网站00| 最近中文字幕mv免费高清在线| 久久精品国产亚洲AV大全| 免费无码又爽又刺激高潮视频| 亚洲午夜未满十八勿入| 59pao成国产成视频永久免费 | 亚洲av无码乱码国产精品| 182tv免费视频在线观看| 亚洲AV日韩AV高潮无码专区| 特级aaaaaaaaa毛片免费视频| 国产午夜免费福利红片| 污视频网站在线观看免费| 久久久亚洲精品蜜桃臀| 免费91麻豆精品国产自产在线观看| 亚洲日韩区在线电影| 国产麻豆视频免费观看| 亚洲av一综合av一区| 久9热免费精品视频在线观看| 亚洲精品不卡视频| 免费人成网站在线观看不卡| 91大神亚洲影视在线| 好大好硬好爽免费视频| 一个人看的免费观看日本视频www| 国产亚洲精品xxx| 成人久久免费网站| 亚洲一区二区免费视频| 日韩高清免费观看| 亚洲综合欧美色五月俺也去| 免费大香伊蕉在人线国产| 国产一级婬片A视频免费观看| 精品国产日韩亚洲一区| 十八禁无码免费网站 | 视频一区在线免费观看| 亚洲AV无码一区东京热久久|