<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 閱讀(534) 評論(0)  編輯  收藏 所屬分類: java原創

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


    網站導航:
     
    主站蜘蛛池模板: 亚洲性色精品一区二区在线| 国产精品亚洲精品日韩动图| 亚洲精品国产电影午夜| 最新国产精品亚洲| 久久精品成人免费观看97| 亚洲人成在线免费观看| 免费国产怡红院在线观看| 亚洲视频中文字幕| 免费人成大片在线观看播放电影| 在线看无码的免费网站| 久久国产成人精品国产成人亚洲| 丁香婷婷亚洲六月综合色| 97人妻精品全国免费视频| 情侣视频精品免费的国产 | 日本一线a视频免费观看| 色在线亚洲视频www| 免费羞羞视频网站| 亚洲精品国产精品乱码不99| 羞羞视频免费网站含羞草| 久久久久久国产a免费观看黄色大片| 亚洲中文字幕久久精品无码APP| MM1313亚洲国产精品| 免费可以在线看A∨网站| 91在线亚洲精品专区| 三年片在线观看免费西瓜视频| 久热综合在线亚洲精品| 国产一区二区三区免费观在线| 国产jizzjizz视频免费看| 亚洲精品自偷自拍无码| 国产精品免费精品自在线观看| 亚洲AV一宅男色影视| 最近中文字幕国语免费完整| 亚洲kkk4444在线观看| 亚洲免费在线观看| 欧洲美女大片免费播放器视频| 亚洲最大AV网站在线观看| 18国产精品白浆在线观看免费| 蜜芽亚洲av无码一区二区三区| 成人免费午间影院在线观看| 精品国产日韩久久亚洲| 亚洲国产综合无码一区二区二三区 |