<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无码久久| 亚洲免费电影网站| 香蕉大伊亚洲人在线观看| 好紧我太爽了视频免费国产| 亚洲韩国—中文字幕| 国产精品免费视频观看拍拍| 国产gv天堂亚洲国产gv刚刚碰 | 蜜桃传媒一区二区亚洲AV| 免费无码不卡视频在线观看| 国产精品成人亚洲| 亚洲精品午夜国产VA久久成人| a级日本高清免费看| 亚洲欧洲日产国码www| 午夜无遮挡羞羞漫画免费| 美女视频黄频a免费| 亚洲国产精华液网站w| av免费不卡国产观看| 久久亚洲AV成人无码国产电影 | 亚洲精品无码久久久久去q| 十八禁无码免费网站| 亚洲欧美精品午睡沙发| 亚洲日韩在线观看免费视频| 一级毛片aaaaaa免费看| 亚洲人av高清无码| 国产亚洲精品精华液| 97在线线免费观看视频在线观看| 美女被免费视频网站a| 亚洲精品视频久久| 亚洲av午夜精品一区二区三区| 99久久99热精品免费观看国产| 亚洲国产成人手机在线观看| 国产成A人亚洲精V品无码|