<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无码免费高潮喷水| 最近免费mv在线观看动漫 | 久久久免费精品re6| 日日摸夜夜添夜夜免费视频| 亚洲美国产亚洲AV| 亚洲va精品中文字幕| 亚洲综合久久综合激情久久| 亚洲日韩精品射精日| 亚洲美日韩Av中文字幕无码久久久妻妇| 国产片AV片永久免费观看| 无码午夜成人1000部免费视频| 黄色短视频免费看| 一边摸一边桶一边脱免费视频| 精品亚洲国产成人av| 亚洲乱码日产精品一二三| 亚洲六月丁香六月婷婷蜜芽| 色婷婷六月亚洲婷婷丁香| 亚洲av鲁丝一区二区三区| 亚洲高清专区日韩精品| 中文字幕精品亚洲无线码二区| 日韩精品电影一区亚洲| 国产成人免费片在线视频观看| 亚洲最新中文字幕| 五月天网站亚洲小说| 亚洲Av无码专区国产乱码DVD| 亚洲美女又黄又爽在线观看| 亚洲日本va在线视频观看| 亚洲婷婷国产精品电影人久久| 亚洲精品无码久久毛片| 亚洲裸男gv网站| 国产午夜亚洲不卡| 亚洲精品国产字幕久久不卡 | 在线播放国产不卡免费视频| 男女交性无遮挡免费视频| 麻豆69堂免费视频| yellow视频免费在线观看| 国产久爱免费精品视频|