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

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

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

    posts - 37,  comments - 53,  trackbacks - 0
     
    同樣,經過不斷的摸索和網友的幫助,終于搞定了:),主要的問題還是出在我的服務器上的原因,不知道為什么,我的服務器上部署了sqlite3.0導致apache2.2.6始終無法運行,總是提示找不到"libsqlite3.so.0",不得以,只能換臺服務器測試,輕松搞定,現將過程描述如下,一共參考:
    一.安裝apache2.2.6
        1.    tar fvxz httpd-2.2.2.tar.gz
        2.    進入解壓后的目錄。進行配置:
              ./configure --prefix=/usr/apache --enable-module=so --enable-proxy --enable-proxy-ajp --enable-forward         --enable-proxy-connect --enable-proxy-http --enable-so --enable-deflate --enable-headers --enable-include
        解釋:
              -- prefix=/usr/apache是配置將要安裝到的目錄位置;
              --enable-module=so配置Apache支持Dynamic Shared Objects (DSO)模式;
              --enable-* 配置添加相應的模塊;
        3.    編譯(編譯如果不成功,確認一下你的linux是否安裝有編譯所需要的c環境和其他需要的類庫):
               make
        4.    安裝:
                make install
        5.    編輯/usr/apache/conf/httpd.conf文件,把端口改為80(別跟tomcat的端口沖突):
               ServerName:80
    二、安裝tomcat5.5.17
        直接解壓壓縮包到指定目錄就可以,再次就不多少說了(當然,最好在進行以上兩項操作前先按裝好jdk,1.5或以上版本)
    三、簡單的apche2.2.6+tomcat5.5.17配置說明:
        使用
    使用proxy_ajp整合apache和tomcat,由于Apache2.2對以往版本有較大改動,引進了proxy 模塊,所以Apache2.2和Tomcat5.5的配置需要用到mod_proxy.so等文件(不再使用jk 或 jk2 等tomcat連接器) .基本配置如下:
    (一)加載解析模塊
        windows下,或linux采用動態加載(DSO)模式下需配置。前面我們的linux編譯時把下面的模塊嵌入到了    apache中,所以不用再加載,因此下面的兩行也不用再httpd.conf文件中添加了
            LoadModule proxy_module modules/mod_proxy.so
            LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
    (二)使用proxy_ajp代理, 下面的配置,是把所有目錄全用代理
         使用vi編輯器打開apache的配置文件/conf/httpd.conf,在#LoadModule××××××行的后面添加         以下兩行即可:
            ProxyPass / ajp://127.0.0.1:8009/
            ProxyPassReverse / ajp://127.0.0.1:8009/
    (三)禁止使用proxy_ajp代理的目錄:
         如果對于某些目錄不想使用proxy_ajp代理轉發,可以按照如下配置(配置方式同上面(二)的操         作):
          ProxyPass /images/ !      (禁止images目錄下的內容使用proxy_ajp代理轉發)
          配置到現在,重啟一下apache,就可通過apache來訪問tomcat的服務了。

    特別鳴謝:http://groups.csdn.net/Apache/topic/b70ad273-f66f-4699-83c0-e11d354d262a.aspx

    posted @ 2007-12-24 18:03 雪地孤鴻 閱讀(949) | 評論 (1)編輯 收藏

    exp user1/psw1@service1 owner=user1 file=d:\user_data_20060822.dmp log = d:\user_logout_20060822.log

    imp user2/psw2@service2 file=d:\user_data_20060822.dmp log =d:\user_login_20060822.log fromuser=user1 touser=user2 

    posted @ 2007-08-03 14:02 雪地孤鴻 閱讀(326) | 評論 (0)編輯 收藏
    現在安裝netbeans 5.5默認的UI 語言為中文,如果需要修改為中文,只需在netbeans的安裝目錄中進行適當的設置就可以了:
    1.進入$netbeans/etc
    2.使用文本編輯器打開netbeans.conf.
    3.在“netbeans_default_options”項后添加“--locale language=en”。
    4.重啟netbeans即可見到e文的netbeans 的UI
    以上的設置在windows xp下測試通過,在linux的下的設置類似。
    posted @ 2007-07-15 15:17 雪地孤鴻 閱讀(1016) | 評論 (1)編輯 收藏
    在部署roller3.0的源代碼的時候,每次啟動tomcat后訪問首頁的時候就報錯,提示找不到c.tld,但是standard.jar和jstl.jar都以放到lib目錄下了,郁悶之極,最后發現是因為在lib下放了一個jsp-api.jar的包導致的
    ,只要將該包從lib下移除即可了,在此感謝網絡上不吝賜教的朋友們:)
    posted @ 2006-12-04 15:27 雪地孤鴻 閱讀(2302) | 評論 (3)編輯 收藏

    1.首先是去下載rller2.3的源代碼文件,下載地址:http://rollerweblogger.org/
    由于roller采用了xdoclet,所以在下載的源代碼中有些內容是沒有的,主要缺少的內容如下:
    ???(1)package org.roller.presentation.forms
    ???(2)src下缺少相關的hbm文件
    ???(3)version.properties
    ???(4)roller.tld
    2.由于缺少以上的東西,導致源代碼導入工程后,編譯都不能通過。我不是太懂xdoclet的使用,所以只好缺什么,就給他什么了,盡量滿足他的要求了。在roller-src(roller2.3解壓后的文件)下有ant的腳本,所以我猜想,通過腳本,一定可以生成所有缺少的文件,事實也確實如此,只是在使用ant腳本生成roller web的過程也是坎坷的:),主要是應為roller開發小組為了省事,把一些開源的第三方包給去掉了,所以需要自己給補上。不然就會生成不成功。現記錄如下:
    (1)加上hibernate3.2.1.jar
    ??????在/roller/src/tools目錄下建立/hibernate-3.1/lib文件夾,將hibernate3.jar文件copy到該目錄下面
    (2)加上j2ee.jar
    ??? 將j2ee.jar(或jboss-j2ee.jar)copy到/roller-src/tools/buildtime/xdoclet-1.2.3/文件夾下
    (3)添加javamail的相關包:mail.jar,actiivation.jar
    ???將mail.jar,activation.jar copy到/roller-src/tools/lib目錄下面。
    然后在windows下進入roller-src目錄,使用下面命令即可生成roller web,同時可以生成以上缺省的文件:

    > build all
    然后就可以在roller-src/build目錄尋找你需要的文件,同時也有發布好的roller web了


    roller2.3的安裝發布可以參考roller官方發布的安裝文檔即可。

    大功告成,可以開始學習和修改roller2.3的源碼了!:)

    posted @ 2006-11-01 15:28 雪地孤鴻 閱讀(977) | 評論 (1)編輯 收藏

    linux+php5.1.6+mysql5.0.2+apache2.0.55安裝配置說明:
    一、mysql5.0.2的安裝配置過程及說明:
    1、 #tar -zvxf mysql-5.0.2-alpha.tar.gz
    2、 cd mysql5.0.2
    3、 ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql --with-charset=gbk
      #--prefix=/usr/local/mysql  mysql安裝的目標目錄
      #sysconfdir=/etc my.ini配置文件的路徑
      #localstatedir=/var/lib/mysql 數據庫存放的路徑
      #--with-charset=gbk 數據庫默認的字符集(如果需要支持中文,則必須加上該選項)
    4、make
    5、make install
    6、make clean
    安裝完成......
    7、初始化數據庫
     cd /usr/local/mysql/bin
     ./mysql_install_db
     如果系統沒有mysql這個用戶的話,最好做以下這步:
     useradd -M -o -r -d /var/lib/mysql -s /bin/bash -c "MySQL Server" -u 27 mysql
     然后我啟動mysql
     /usr/local/mysql/bin/mysqld_safe &
     ok,先看看mysql能否正常工作
     mysql -uroot mysql
     如果一切正常則表示數據庫啟動成功,恭喜你了... ...
    8、做完上面的步驟,然后把你編譯目錄的一個腳本COPY過去
      (mysql.server在/usr/local/mysql/share/mysql/目錄下)
     cp support-files/mysql.server /etc/rc.d/init.d/mysqld
     chkconfig --add mysqld
     以后啟動/停止數據庫就可以使用下面的命令:
     /etc/rc.d/init.d/mysqld start
     /etc/rc.d/init.d/mysqld stop
     


    二、apache20.55的安裝配置說明:(DSO動態編譯)
    # tar -zvxf httpd-2.0.55.tar.gz
    # cd httpd-2.0.55
    # ./configure --prefix=/usr/local/apache2 --enable-mods-shared=most --enable-so
    # make
    # make install
    # make clean
    apache2安裝完成,可以啟動apache,看看能否看到那可愛的羽毛... ...

    三、php5的安裝配置說明:
    在安裝php5的過程中,真是一波三折,后來還是參考了網上的文章,加載了N多的庫才搞定,所以這記錄如下
    1、 libxml2安裝
    源代碼:libxml2-2.6.26.tar.gz
    操作指令:
    # tar -zxvf libxml2-2.6.26.tar.gz
    # cd libxml2-2.6.26
    # ./configure
    # make
    # make install
    # make clean

    2、zlib安裝
    源代碼:zlib-1.2.3.tar.tar
    操作指令:
    # tar -zxvf zlib-1.2.3.tar.tar
    # cd zlib-1.2.3
    # ./configure
    # make
    # make install
    # make clean

    3、libpng安裝
    源代碼:libpng-1.2.12.tar.gz
    操作指令:
    # tar -zxvf libpng-1.2.12.tar.gz
    # cd libpng-1.2.12
    # cp scripts/makefile.std makefile
    編輯 makefile 將 prefix 改為 prefix=/usr/local/libpng2
    # make
    # mkdir /usr/local/libpng2
    # make install
    # make clean

    4、jpeg安裝
    源代碼:jpegsrc.v6b.tar.tar
    操作指令:
    # tar -zxvf jpegsrc.v6b.tar.tar
    # cd jpeg-6b
    # ./configure --prefix=/usr/local/jpeg6 --enable-shared
    # make
    # mkdir /usr/local/jpeg6
    # mkdir /usr/local/jpeg6/include
    # mkdir /usr/local/jpeg6/lib
    # mkdir /usr/local/jpeg6/bin
    # mkdir /usr/local/jpeg6/man
    # mkdir /usr/local/jpeg6/man/man1
    # make install-lib
    # make install
    # make clean

    5、GD安裝
    源代碼:gd-2.0.33.tar.gz
    操作指令:
    # tar -zxvf gd-2.0.33.tar.gz
    # cd gd-2.0.33
    # ./configure --prefix=/usr/local/gd2 --with-zlib --with-png=/usr/local/libpng2 --with-jpeg=/usr/local/jpeg6
    編輯 Makefile 231行 將
    CPPFLAGS = -I/usr/local/jpeg6/include (該選項也可能為空,只要參考下面的修改就可以了)
    改為
    CPPFLAGS = -I/usr/local/jpeg6/include -I/usr/local/libpng2/include
    # make
    # make install
    # make clean

    6、libiconv安裝
    源代碼:libiconv-1.9.2.tar.gz
    操作指令:
    # tar -zxvf libiconv-1.9.2.tar.gz
    # cd libiconv-1.9.2
    # ./configure --prefix=/usr/local/libiconv
    # make
    # make install
    # make clean

    將iconv.h連接到php的安裝源程序中(php的安裝源程序必須要和iconv.h在同一磁盤目錄下面,否則link會出錯),否則會php make會出錯
    # cd /usr/home/ty/php-5.1.6/ext/iconv/(該目錄為php的安裝源程序目錄)
    #這里的php-5.1.6就是下面解壓縮的路徑
    # link /usr/local/libiconv/include/iconv.h iconv.h

    7、開始安裝PHP5
    源代碼:php-5.1.6.tar.gz
    操作指令:
    # tar -zxvf php-5.1.6.tar.gz
    # cd php-5.1.6
    # ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-xml --with-mysql=/usr/local/mysql --with-zlib --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr/local/libpng2 --with-iconv=/usr/local/libiconv --with-config-file-path=/usr/local/lib --disable-debug --enable-safe-mode --enable-trans-sid --enable-memory-limit --enable-short-tags --disable-posix --enable-exif --enable-ftp --enable-sockets

    # make
    # make install
    # make clean
    # cp /usr/src/php-5.1.6/php.ini-dist /usr/local/lib/php.ini

    php安裝完成 ... ...

    8、把php加到apache里去
    操作指令:
    # vi /usr/local/apache2/conf/httpd.conf
    (1)在httpd.conf文件相應的地方添加下面幾行(如果在安裝php5時,有的配置可以已經加上了,就不需要再重新添加了)
    LoadModule php5_module modules/libphp5.so
    AddType application/x-httpd-php .php
    在DirectoryIndex index.html index.html.var 后面添加index.php

    配置完成... ...

    四、測試
    然后放個info.php文件上去測試看看成功

    vi /usr/local/apache2/htdocs/test.php
    輸入以下代碼,保存。
    <?
    phpinfo();
    ?>
    然后啟動apache,訪問http://your ip(or your website)/info.php
    如果能夠看看php的相關信息,恭喜你,你的所有的配置成功了。!


    以上的配置,一共花了我將經兩天的時間,終于成功了,衷心的感謝網上無償提供幫助的朋友,在此記錄下來,希望對其他人也能提供一定的幫助!


    時隔多日,重新安裝apache2.2.11+php5.2.9+mysql6.0

    三個應用的安裝基本沒有太大的變化,只是更加友好了:),關鍵是配置讓我花了點時間,很是郁悶,幾天沒有關注,事情就變樣了。IT界發展的就是快啊:),下面就詳細說說配置中遇到的問題吧:

    一、apache2.2.11配置

    相對以前的版本,apache的配置文件分成了多個配置文件,本想配置一個vhost,但是在httpd.conf中就是沒有找到,最后G了一下才發現,虛擬主機的配置已經被單獨為一個配置文件了。在httpd.conf文件中去掉“Include conf/extra/httpd-vhosts.conf”該行前面的注釋,讓后進入conf/extra目錄,打開httpd-vhosts.conf進行配置即可。

    、mysql6.0的安裝:

    由于mysql已經被sun收購,發布方式也有所變化了,目前官方網站上提供的了都是rpm的安裝方式,及其方便:rpm -ivh ***.rpm即可。但是和以前自己編譯的方式有點不一樣,需要安裝server,client,MySQL-devel-community-6.0.9-0.rhel5.x86_64.rpm,有可能還要share包。不然在和php結合使用時會有問題。

    三、php5.2.9的安裝配置

    ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-xml --with-gettext=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613 --with-mysql=/usr/lib/mysql

    上面是我的配置,主要用來運行gallery2.3.這里需要說明的有gettext(多語言支持)的配置:

    1.首先進入到php源碼包中 

    cd /opt/php-5.1.2/ext/gettext 

    2. 在gettext文件夾下產生configure文件 

    /opt/php/bin/phpize 

    3. 配置編譯 

    ./configure --with-php-config=/opt/php/bin/php-config --with-gettext 

     make && make install 

    4. 在/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613下產生一個gettext.so文件 

    5.重新配置編譯安裝php


    mysql6.0配置:

    安裝php的時候,之前一直提示msyql client包找不到,由于我使用的是linux as 5 x86_64的操作信息,mysql client 包是存放在/usr/lib64下面,而php默認是在/usr/lib下尋找,所以需要如下解決:

    1.做個軟連接即刻解決 ln -s /usr/lib64/mysql /usr/lib

    2.按上面的配置執行即可。


    鳴謝:http://www.oschina.net/p/php/thread/87




     

     

     

     


     

    posted @ 2006-10-20 15:05 雪地孤鴻 閱讀(15313) | 評論 (4)編輯 收藏

    本想使用打包后的war來控制發布的版本,但是在發布后,編譯jsp文件時卻出現編譯錯誤:
    Exception compiling Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK

    ERROR 09-14? 14:07:56,726 [TP-Processor3] (ApplicationContext.java:675) - Exception:
    Unable to find a javac compiler;
    com.sun.tools.javac.Main is not on the classpath.
    Perhaps JAVA_HOME does not point to the JDK
    ?at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
    ?at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:924)
    ?at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757)
    ?at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:320)
    ?at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
    ?at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
    ?at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
    ?at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    ?at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    ?at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    ?at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    ?at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
    ?at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
    ?at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    ?at com.mdcchina.util.Validates.FromFilter.doFilter(Unknown Source)
    ?at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    ?at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    ?at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    ?at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    ?at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    ?at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    ?at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    ?at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    ?at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    ?at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
    ?at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
    ?at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:754)
    ?at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:684)
    ?at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:876)
    ?at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    ?at java.lang.Thread.run(Thread.java:595)
    ERROR 09-14? 14:07:56,734 [TP-Processor3] (ApplicationDispatcher.java:704) - Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSP

    An error occurred at line: -1 in the jsp file: null

    Generated servlet error:
    ??? [javac] Compiling 1 source file


    需要將jdk下面的tools.jar包加入到應用的classpath下面,或是將其copy到tomcat的/common/lib下
    才能解決該問題:)

    posted @ 2006-09-14 16:59 雪地孤鴻 閱讀(4419) | 評論 (2)編輯 收藏
    最近,運行的tomcat服務器在正常運行將近2個月后,拋出如下錯誤:

    警告: Reinitializing ServerSocket
    2006-7-28 15:07:40 org.apache.tomcat.util.net.PoolTcpEndpoint acceptSocket
    嚴重: Endpoint ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=80] ignored exception: java.net.SocketException: Too many open files
    java.net.SocketException: Too many open files
    ?at java.net.PlainSocketImpl.socketAccept(Native Method)
    ?at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
    ?at java.net.ServerSocket.implAccept(ServerSocket.java:450)
    ?at java.net.ServerSocket.accept(ServerSocket.java:421)
    ?at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60)
    ?at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:407)
    ?at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:70)
    ?at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    ?at java.lang.Thread.run(Thread.java:595)

    原本以為是tomcat的配置或是應用本身的問題,"谷歌"一把后才發現,該問題的根本原因是由于系統文件資源的限制導致的。具體可以參考http://www.bea.com.cn/support_pattern/Too_Many_Open_Files_Pattern.html
    的說明。具體的解決方式可以參考一下:
    1。ulimit -a 查看系統目前資源限制的設定。
    ???[root@test security]# umlimit -a
    -bash: umlimit: command not found
    [root@test security]# ulimit -a
    core file size??????? (blocks, -c) 0
    data seg size???????? (kbytes, -d) unlimited
    file size???????????? (blocks, -f) unlimited
    max locked memory???? (kbytes, -l) unlimited
    max memory size?????? (kbytes, -m) unlimited
    open files??????????????????? (-n) 1024
    pipe size????????? (512 bytes, -p) 8
    stack size??????????? (kbytes, -s) 8192
    cpu time???????????? (seconds, -t) unlimited
    max user processes??????????? (-u) 7168
    virtual memory??????? (kbytes, -v) unlimited
    [root@test security]#
    通過以上命令,我們可以看到open files 的最大數為1024
    那么我們可以通過一下命令修改該參數的最大值
    2. ulimit -n 4096
    [root@test security]# ulimit -n 4096
    [root@test security]# ulimit -a
    core file size??????? (blocks, -c) 0
    data seg size???????? (kbytes, -d) unlimited
    file size???????????? (blocks, -f) unlimited
    max locked memory???? (kbytes, -l) unlimited
    max memory size?????? (kbytes, -m) unlimited
    open files??????????????????? (-n) 4096
    pipe size????????? (512 bytes, -p) 8
    stack size??????????? (kbytes, -s) 8192
    cpu time???????????? (seconds, -t) unlimited
    max user processes??????????? (-u) 7168
    virtual memory??????? (kbytes, -v) unlimited

    這樣我們就修改了系統在同一時間打開文件資源的最大數,基本解決以上問題。

    另外我們可以通過lsof? -p [進程的 pid]來查看系統當前打開的文件資源,可以了解不同時期系統的文件資源的使用情況,可根據情況進行系統資源的配置。
    posted @ 2006-07-31 11:39 雪地孤鴻 閱讀(4125) | 評論 (0)編輯 收藏

    這幾天要用到一個簡單的權限管理,本來想用struts-Menu簡單搞定,但是很是郁悶的是不知道怎么樣將tomcat的角色應用到struts-menu中,在網上搜了好久,終于在www.yahoo.com.cn中找了不知道是那位大俠的文章,在此感謝了,也希望能給他人方便,特轉貼到此:

    剛剛接觸Struts Menu的時候,對Struts Menu基于角色的菜單顯示很好理解,但是如何將Web應用中的角色管理映射到Struts Menu中,是困擾筆者良久的問題。經過摸索,在查閱了Tomcat的手冊之后,筆者找到了答案。

    ?

    Servlet容器和web應用都可以控制web應用資源的安全,因此Tomcat管理域有容器管理和應用程序管理兩種,默認使用容器管理。通常web應用中使用的登陸Servlet和JSP則是應用程序管理。這就涉及到Realm的概念。

    ?

    Tomcat在%CATALINA_HOME%/conf/server.XML文件中配置Realm,結合在%CATALINA_HOME%/WEB-INF/mywebapp/web.xml文件中配置的<security-constraint>,定義了存儲用戶和角色的信息,以及進行用戶驗證的方式。

    ?

    Tomcat中定義的Realm有如下幾種實現:UserDatabaseRealm、JDBCRealm、JNDIRealm和JAASRealm。下載Tomcat解壓縮后默認使用的是UserDatabaseRealm。該Realm從%CATALINA_HOME%/conf/tomcat-users.xml靜態文件中加載內存,Tomcat運行期間不會動態加載。因此所有的用戶、角色和密碼都是在Tomcat啟動之前配置好的,只存在于內存中。修改tomcat-users.xml文件后必須重新啟動Tomcat,該文件的具體配置請參考Tomcat手冊。

    ?

    本文要著重介紹的是JDBCRealm,該Realm使用關系數據庫,能夠動態訪問數據。用戶、角色和密碼都保存在數據庫中,一旦數據庫有變化,JDBCRealm會立即訪問。相應,JDBCRealm的設置需要數據庫的訪問參數。Tomcat5.0.28中給出了幾種數據庫的配置參數,示例如下:

    ?

    <Realm? className="org.apache.catalina.realm.JDBCRealm"

    ?

    debug="99" digest="MD5"

    ?

    ???????????? driverName="Oracle.jdbc.driver.OracleDriver"

    ?

    ????????? connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"

    ?

    ???????? connectionName="scott" connectionPassword="tiger"

    ?

    ????????????? userTable="users" userNameCol="user_name" userCredCol="user_pass"

    ?

    ????????? userRoleTable="user_roles" roleNameCol="role_name" />

    ?

    ?

    ?

    屬性說明如下:

    className是實現Realm的類名,對于JDBCRealm必須是org.apache.catalina.realm.JDBCRealm。

    ?

    debug設置調試信息的詳細程度等級,0表示不調試,數字越大越詳細。

    ?

    digest是數據庫中密碼字段的加密摘要算法名稱,有SHA、MD2或MD5,默認是cleartext,即不加密。

    ?

    driverName是數據庫訪問的JDBC驅動

    ?

    connectionURL是數據庫訪問URL參數

    ?

    connectionName和connectionPassword是訪問數據庫的名稱和密碼

    userTable是web應用中存儲用戶信息的表名

    userNameCol是用戶信息表中存儲用戶登陸名稱的字段名

    userCredCol是用戶信息表中存儲用戶登陸密碼的字段名

    userRoleTable是將用戶角色映射表名

    roleNameCol是角色表中存儲角色名稱的字段名

    有了這些定義,web應用中定義的用戶和角色就可以在Struts Menu中,用于配置基于角色可見與否的菜單。

    ?

    posted @ 2006-04-12 10:26 雪地孤鴻 閱讀(784) | 評論 (0)編輯 收藏

    在網上找了很久,看了很多的文檔,終于將appfuse成功的編譯,發布了:這樣感謝廣大網友的無私奉獻了,好了,閑話少說了,具體的操作如下:
    Appfuse1.9,JDK1.5,ANT1.6.2,Mysql5.0,Tomcat5.5

    一.環境設置:
    以下環境變量均按本機的安裝路徑設置即可。
    ANT_HOME,
    JAVA_HOME,
    CATALINA_HOME,
    MYSQL_HOME
    Path中加入
    %JAVA_HOME%bin;%ANT_HOME%bin;%CATALINA_HOME%bin;%MYSQL_HOME%bin;
    二 在eclipse中使用ant編譯,發布,測試appfuse
    1.Create New Java Project in Eclipse
    Open Eclipse (either with an existing or a new workspace) and to go File → New → Project. Then select "Java Project" and hit the Next button. In the Project Name field, enter the name of your project (i.e. appfuse) and the directory that your project lives (i.e. c:\source\appfuse) in the box below. If you're prompted to switch the Java Perspective, choose Yes.
    If you try to build the project at this point, you'll likely get numerous errors. Most of them involve the fact that the UserForm class can not be found. This is because all of the ActionForms in AppFuse (if you're using the Struts version) are generated from POJOs with XDoclet.

    All of the tasks for XDoclet are configured in the Ant build.xml file so the easiest thing to do is to run "ant gen-forms" to generate the ActionForms. If you have Ant 1.6.2+ installed and in your path, you can do this from the command line. The next step shows you how configure Eclipse to run your AppFuse build.xml.

    2.Configuring Ant in Eclipse

    The easiest way to configure Eclipse for AppFuse is to install Ant on your hard drive (i.e. c:\Tools\apache-ant-1.6.2) and then point Eclipse's ANT_HOME to this directory. To do this, go to Window → Preferences → Ant → Runtime. Then click the "Ant Home" button and select the installation folder on your hard drive.

    If you'd rather use Eclipse's built-in Ant, you'll need to add junit.jar to its classpath. To do this, go to Window → Preferences → Ant → Runtime. Then click the "Add JARs" button and select junit.jar from appfuse/lib/junit3.8.1/lib/junit.jar. Click OK until you arrive back at the workbench view.

    Next, add the catalina-ant.jar (from $CATALINA_HOME/server/lib) to the ant classpath. Then in the property tab, add tomcatTasks.properties (in lib/ant-contrib) file as a global properties file.

    Below is a screenshot of what your Ant Runtime classpath should look like after the above modifications:
    ant-runtime.png

    3.Add build.xml to Ant View
    Now we need to add the build.xml to Eclipse's Ant View. To do this, go to Window → Show View → Ant. Then click on the first icon in this view (screenshot below) to add AppFuse's build file.
    ant-view.png

    4.Run Ant
    After adding the build.xml, you should be able to expand it in the Ant View and execute any of the targets. I usually do "test-all" to verify all the tests pass in my initial project. For a list of targets I use most often, see AppFuse Ant Targets.
    Now if you run the "compile" target and then refresh the project (right-click on project → Refresh) you shouldn't see any errors in the "Problems" pane. You should now be able to compile and create classes as you normally would. Sometimes when my imports aren't resolving correctly in Eclipse, I do have to run Project → Clean in Eclipse.

    NOTE: If you're using the internal version of Ant, you may get an error message like the one below:
    BUILD FAILED: C:\source\appfuse\build.xml:802: The following error occurred while executing this line:
    C:\source\appfuse\build.xml:780: The following error occurred while executing this line:
    java.lang.NoClassDefFoundError: org/apache/xml/serialize/OutputFormat
    This is because there are tasks that require Xerces to be in your Ant classpath [reference]. I added xercesImpl.jar and xml-apis.jar (from my self-installed version of Ant) to Eclipse's Ant classpath to solve this.
    5.Run JUnit Tests in Eclipse
    It's also possible to run your JUnit tests in Eclipse. But before running them, you need to run the "war" target. After this target completes, refresh your project.
    After you have successfully done so, in Eclipse open a test you'd like to run (i.e. UserDaoTest) and go to Run → Debug As → JUnit Test. Note that you may have to run the "db-load" target before you run your tests every so often. I did have the following method in the Base*TestCase class for each layer, but this caused DBUnit to reload the database before every test in a Test class. Removing it reduces the execution time of "test-all" by more than 30 seconds.

    ?

    ??? protected void setUp() throws Exception {
    ??????? DataSource ds = (DataSource) ctx.getBean("dataSource");
    ??????? IDatabaseConnection conn = new DatabaseConnection(ds.getConnection());
    ??????? IDataSet dataSet =
    ??????????? new XmlDataSet(new FileInputStream("metadata/sql/sample-data.xml"));
    ??????? // clear table and insert only sample data
    ??????? DatabaseOperation.CLEAN_INSERT.execute(conn, dataSet);
    ??????? conn.close();
    ??? }?


    If the instructions above don't work for running JUnit tests in Eclipse, I suggest just using the command line - i.e. ant test-dao -Dtestcase=UserDAO. Running tests from the command line always works. ;-)

    好了 ,在eclipse中基本按以上操作就可以成功了,等有時間,我來翻譯一下,雖然我的e文比較爛,但是還是樂于讓大家校正的
    :)原文的地址:http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuseEclipse
    問題描述
    1.剛開始的時候,我們的mysql的用戶名和密碼可能和appfuse的默認的用戶和密碼會不一樣的,這個可以到properties.xml文件中修改為我們安裝mysql是設置的用戶名和密碼,我的修改如下:
    ?<!-- Defaults for database.properties -->
    ??? <property name="database.jar" location="${mysql.jar}"/>
    ??? <property name="database.type" value="mysql"/>
    ??? <property name="database.name" value="appfuse"/>
    ??? <property name="database.host" value="localhost"/>
    ??? <property name="database.username" value="root"/>
    ??? <property name="database.password" value="780121"/>
    ???
    ??? <!-- database URL for creating other dbs - used in db-create target -->
    ??? <property name="database.admin.url" value="jdbc:${database.type}://${database.host}/mysql"/>
    ??? <property name="database.admin.username" value="root"/>
    ??? <property name="database.admin.password" value="780121"/>
    ??? <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
    ??? <property name="database.driver_class" value="com.mysql.jdbc.Driver"/>
    ??? <property name="database.url"
    ??????? value="jdbc:${database.type}://${database.host}/${database.name}?useUnicode=true&amp;amp;characterEncoding=utf-8"/>
    ??? <property name="database.show_sql" value="true"/>

    我是修改了root用戶的密碼,當然你也可以建立test用戶并給初始密碼:)
    2.連接數據庫的問題解決后,另外一個問題有出來了,建立user_role表的時候出問題了:org.dbunit.dataset.NoSuchTableException: user_role
    這個問題的解決方式如下:
    setup-tomcat deploy
    ant setup -Ddatabase.username=foo -Ddatabase.password=bar
    這個主要是先執行以下build.xml中的setup-tomcate deploy指令就可以了:)
    原載地址:http://b0r0j0.blogbus.com/logs/2005/12/1725103.html

    posted @ 2006-04-07 19:55 雪地孤鴻 閱讀(1889) | 評論 (0)編輯 收藏
    僅列出標題
    共4頁: 上一頁 1 2 3 4 下一頁 
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(17)

    隨筆分類

    隨筆檔案

    文章檔案

    blog

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 大学生美女毛片免费视频| A级毛片成人网站免费看| 暖暖免费高清日本一区二区三区| 国产亚洲欧美在线观看| 久久久久亚洲AV无码专区网站| 三年片在线观看免费大全电影| 涩涩色中文综合亚洲| 亚洲精品乱码久久久久久蜜桃| 无码日韩精品一区二区免费暖暖| 亚洲精品无码久久久久久| 亚洲真人无码永久在线| 日韩精品成人无码专区免费| 一级毛片aa高清免费观看| 精品日韩亚洲AV无码 | 亚洲一区二区免费视频| 午夜亚洲国产精品福利| 色播亚洲视频在线观看| 免费在线观看毛片| 国产四虎免费精品视频| 精品一区二区三区免费视频| 亚州**色毛片免费观看| 无码一区二区三区免费视频 | 亚洲专区在线视频| 日韩a级毛片免费观看| 国产午夜无码精品免费看动漫| 在线精品亚洲一区二区| 亚洲AV无码精品色午夜果冻不卡 | 亚洲欧洲精品成人久久奇米网| 免费国产作爱视频网站| a级片在线免费看| 国产成人久久精品亚洲小说| 亚洲中文字幕久久精品无码2021| 亚洲精品视频在线看| 毛片高清视频在线看免费观看| 久久久免费的精品| 国产久爱免费精品视频 | 成人免费福利视频| 最近免费mv在线观看动漫| 一级免费黄色大片| 老子影院午夜伦不卡亚洲| 亚洲国产成人手机在线电影bd|