<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原創

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲国产另类久久久精品黑人| 亚洲精品夜夜夜妓女网| 精品亚洲成a人片在线观看少妇| 亚洲色无码一区二区三区| 美女黄网站人色视频免费| 久久中文字幕免费视频| 久久精品亚洲中文字幕无码网站| 免费无码H肉动漫在线观看麻豆| 在线人成精品免费视频| 亚洲色图在线观看| 日韩欧美亚洲中文乱码| 四虎永久在线精品免费影视| 国产精品亚洲精品日韩已满| 国产白丝无码免费视频| 亚洲爆乳精品无码一区二区三区| 在线看片免费人成视频播| 亚洲视频在线观看视频| 一级毛片不卡免费看老司机| 妞干网在线免费视频| 亚洲av无码潮喷在线观看 | 日韩毛片在线免费观看| 国产亚洲精品自在线观看| 麻豆成人久久精品二区三区免费| 四虎永久成人免费| 久久av免费天堂小草播放| 国产又粗又猛又爽又黄的免费视频| 麻豆亚洲av熟女国产一区二| 无码国产精品一区二区免费式影视| 亚洲AV一宅男色影视| 国产免费丝袜调教视频| 女bbbbxxxx另类亚洲| 久久久久久99av无码免费网站| 亚洲AV永久无码精品一福利| 国产成人亚洲精品影院| 18以下岁毛片在免费播放| 亚洲另类无码专区首页| 2021免费日韩视频网| 香蕉国产在线观看免费| 亚洲综合激情另类小说区| 免费在线观看理论片| 99re6在线精品视频免费播放|