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

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

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

    posts - 23,comments - 12,trackbacks - 0

    struts in action 中的register-complete.war,在tomcat中部署后,當輸入用戶名和密碼后總是給出failure頁面的解決方法

    1、首先將程序放在一下沒有空格的目錄中(不能放在如Program Files中)
    例如在D盤的根目錄下新建目錄:myregister.
    在 server.xml中加入:
    <Context path="/myregister"
    docBase="d:\myregister\"
    crossContext="false"
    debug="0"
    reloadable="true" >

    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_dbtest_log." suffix=".txt"
    timestamp="true"/>

    </Context>


    2、找到UserDirectory.java中下面代碼:
        public void setUser(String userId, String password) throws
                UserDirectoryException {

            // no nulls
            if ((null==userId) || (null==password)) {
             System.out.print("userid is null");
                throw new UserDirectoryException();
            }


            try {

                // conform userId to uppercase when stored
                p.put(fixId(userId), password);
                String o = this.getClass().getClassLoader().getResource(UserDirectoryFile).getFile();
                p.store(new FileOutputStream(o), UserDirectoryHeader);

               
            }

            catch (IOException e) {
                throw new UserDirectoryException();

           }
        }


    修改為:
        public void setUser(String userId, String password) throws
                UserDirectoryException {

            // no nulls
            if ((null==userId) || (null==password)) {
             System.out.print("userid is null");
                throw new UserDirectoryException();
            }


            try {

                // conform userId to uppercase when stored
                p.put(fixId(userId), password);
                String o = this.getClass().getClassLoader().getResource(UserDirectoryFile).getFile();
         System.out.println(o); //o is /D:/myregister/WEB-INF/classes/resources/users.properties
         String ostr=o.substring(1); // the  line must be add is to use to remove the "/" in  String o
         System.out.println(ostr); //ostr is D:/myregister/WEB-INF/classes/resources/users.properties
                p.store(new FileOutputStream(ostr), UserDirectoryHeader);//modify o as ostr

               
            }

            catch (IOException e) {
                throw new UserDirectoryException();

           }
        }

    注意最關鍵的是將:this.getClass().getClassLoader().getResource(UserDirectoryFile).getFile();所獲得的字符串進行處理因為它前面多了一個"/"。需要去掉。



    英文:

    I found a solution to your problem

    first step:
    you must deploy the application build a folder  make sure you don't use
    a directory which has any spaces in the path (such as the Program Files directory on Windows)as this may
    cause the UserDirectoryException.
    such as build a folder "myregister"  in Driver D and copy the program in it.

    add the following codes to server.xml:

    <Context path="/myregister"
    docBase="d:\myregister\"
    crossContext="false"
    debug="0"
    reloadable="true" >

    <Logger className="org.apache.catalina.logger.FileLogger"
    prefix="localhost_dbtest_log." suffix=".txt"
    timestamp="true"/>

    </Context>

        

    second step:
    just find the following code within the 'UserDirectory.java'
        public void setUser(String userId, String password) throws
                UserDirectoryException {

            // no nulls
            if ((null==userId) || (null==password)) {
             System.out.print("userid is null");
                throw new UserDirectoryException();
            }


            try {

                // conform userId to uppercase when stored
                p.put(fixId(userId), password);
                String o = this.getClass().getClassLoader().getResource(UserDirectoryFile).getFile();
                p.store(new FileOutputStream(o), UserDirectoryHeader);

               
            }

            catch (IOException e) {
                throw new UserDirectoryException();

           }
        }


    modify as follow:
        public void setUser(String userId, String password) throws
                UserDirectoryException {

            // no nulls
            if ((null==userId) || (null==password)) {
             System.out.print("userid is null");
                throw new UserDirectoryException();
            }


            try {

                // conform userId to uppercase when stored
                p.put(fixId(userId), password);
                String o = this.getClass().getClassLoader().getResource(UserDirectoryFile).getFile();
         System.out.println(o); //o is /D:/myregister/WEB-INF/classes/resources/users.properties
         String ostr=o.substring(1); // the  line must be add is to use to remove the "/" in  String o
         System.out.println(ostr); //ostr is D:/myregister/WEB-INF/classes/resources/users.properties
                p.store(new FileOutputStream(ostr), UserDirectoryHeader);//modify o as ostr

               
            }

            catch (IOException e) {
                throw new UserDirectoryException();

           }
        }


    by the way,the String o is /D:/myregister/WEB-INF/classes/resources/users.properties
    the String ostr is D:/myregister/WEB-INF/classes/resources/users.properties

    posted on 2005-09-09 13:53 my java 閱讀(523) 評論(0)  編輯  收藏 所屬分類: java原創

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲欧洲精品无码AV| 免费一级做a爰片性色毛片| 国产V亚洲V天堂无码| 久久99精品免费一区二区| 亚洲国产精品视频| 色多多A级毛片免费看| 亚洲人成网站色在线入口| 无遮挡呻吟娇喘视频免费播放| 免费jjzz在线播放国产| sss日本免费完整版在线观看| 亚洲精品无码专区2| a级毛片毛片免费观看永久| 亚洲av伊人久久综合密臀性色| 久久成人免费大片| 亚洲精品熟女国产| 永久在线毛片免费观看| 青青免费在线视频| 精品亚洲永久免费精品| 最近中文字幕完整免费视频ww | 免费吃奶摸下激烈视频| 暖暖免费中文在线日本| 国产亚洲一区二区精品| 最近中文字幕免费mv在线视频| 亚洲日韩中文字幕无码一区| 国产在线98福利播放视频免费| 久久不见久久见免费影院www日本 久久WWW免费人成—看片 | 亚洲国产精品国自产电影| 精品免费人成视频app| 亚洲成a人无码亚洲成av无码| 亚洲男人在线无码视频| 99免费在线观看视频| 亚洲人成网站在线在线观看| 亚洲精品国产精品乱码不卞| 国产精品免费一区二区三区四区| 亚洲国产精品综合久久20| 亚洲国产午夜福利在线播放| 欧洲人免费视频网站在线| 色偷偷亚洲女人天堂观看欧| 亚洲日韩在线中文字幕第一页| 日韩在线不卡免费视频一区| 国产成人亚洲精品91专区高清 |