posts - 37,  comments - 53,  trackbacks - 0
            2009年4月8日
          grails應(yīng)用以war包的方式發(fā)布到weblogic本來(lái)應(yīng)該是沒(méi)有什么問(wèn)題的,也不需要像網(wǎng)上說(shuō)的那樣進(jìn)行weblogic的配置,但是有兩個(gè)小問(wèn)題在實(shí)際的使用中需要注意:
          1.我的應(yīng)用中,使用了spring-security-cas的插件來(lái)實(shí)現(xiàn)cas client,但是不知道為什么在生產(chǎn)war包是,在web.xml中,有兩個(gè)CAS Single Sign Out Filter的mapping,結(jié)果導(dǎo)致發(fā)布失敗,需要手工刪除一個(gè)(目前的解決辦法)
          2.grails的urlmapping插件,如果映射“/”到某個(gè)action,目前好像是不成功的,但是只要不是“/”,則沒(méi)有這個(gè)問(wèn)題。如果默認(rèn)的根目錄不是index.gsp,這個(gè)可能需要在訪(fǎng)問(wèn)“/”時(shí)進(jìn)行跳轉(zhuǎn)的處理。

          posted @ 2011-02-09 16:21 雪地孤鴻 閱讀(520) | 評(píng)論 (0)編輯 收藏
          1.weblogic必須是10.3.4.0或以上版本,由于cas server采用了spring 2.5的版本,使用JPA2.0的原因,weblogic10.3.4之前的版本不支持jpa2.0
          2.cas server webapp 如果以war的方式發(fā)布,會(huì)因?yàn)閘og4j.xml的問(wèn)題而不能正常發(fā)布,具體原因還沒(méi)有完全弄清楚,但是如果以解開(kāi)后的文件夾目錄的方式發(fā)布則沒(méi)有問(wèn)題。

          posted @ 2011-02-09 16:16 雪地孤鴻 閱讀(3264) | 評(píng)論 (2)編輯 收藏
          測(cè)試環(huán)境下使用的是mysql數(shù)據(jù)庫(kù),切換到正式的oralce數(shù)據(jù)庫(kù)中去發(fā)現(xiàn)cas server是無(wú)效的,主要的原因是由于數(shù)據(jù)庫(kù)的差異導(dǎo)致的
          認(rèn)證用戶(hù)的sql語(yǔ)句在mysql下為
          select password from user_login where username=? and enabled=true
          而在oracle下應(yīng)該為
          select password from user_login where username=? and enabled=1
          主要由于oralce和mysql對(duì)boolean字段的處理不一致導(dǎo)致的。

          posted @ 2011-01-26 09:05 雪地孤鴻 閱讀(719) | 評(píng)論 (0)編輯 收藏

          cas server logout后,默認(rèn)是停留在cas的退出頁(yè)面,一般我們需要重新轉(zhuǎn)向到客戶(hù)端網(wǎng)站的登錄或是相關(guān)的頁(yè)面,一般需要進(jìn)行一下配置

          1.cas-server端,配置文件為/WEB-INFO/cas-servlet.xml中的logoutController

           <bean id="logoutController" class="org.jasig.cas.web.LogoutController" 
               p:centralAuthenticationService-ref="centralAuthenticationService" 
               p:logoutView="casLogoutView" 
               p:warnCookieGenerator-ref="warnCookieGenerator" 
               p:ticketGrantingTicketCookieGenerator-ref="ticketGrantingTicketCookieGenerator"   
                p:followServiceRedirects="true"/>

          posted @ 2011-01-21 13:38 雪地孤鴻 閱讀(1068) | 評(píng)論 (1)編輯 收藏

          經(jīng)過(guò)將近兩天的測(cè)試,參考眾多網(wǎng)友的貢獻(xiàn),終于完成了對(duì)cas的主要配置和測(cè)試,現(xiàn)記錄如下

          基本需求:

          1.cas server-3.4.5,casclient-3.2(官方版本),均可在cas官方網(wǎng)站下載,http://www.jasig.org

          2.使用低成本的http協(xié)議進(jìn)行傳輸,俺買(mǎi)不起ssl證書(shū)

          3.通過(guò)jdbc進(jìn)行用戶(hù)驗(yàn)證

          4.需要通過(guò)casserver提供除登錄用戶(hù)名以外的附加信息

          參考資料:

          1.cas官方網(wǎng)站的用戶(hù)幫助手冊(cè)和wiki

          2.網(wǎng)友“城市獵人”的blog,http://yuzhwe.javaeye.com/blog/830143

          3.網(wǎng)友“悟空悟道”的blog,http://llhdf.javaeye.com/blog/764385

          4.其他網(wǎng)友貢獻(xiàn)的相關(guān)的blog,都是通過(guò)google出來(lái),就不一一列出了,一并致謝!!!

          好了,下面進(jìn)入正題,如果您不想測(cè)試中出現(xiàn)異常情況,或是獲取不到相關(guān)數(shù)據(jù),請(qǐng)關(guān)注文中的紅色字體部分。

          (1)使用http協(xié)議的設(shè)置,如果您也像我一樣,買(mǎi)不起ssl數(shù)字證書(shū),對(duì)安全的要求也不是特別的搞,下面的配置就可以幫助解決這個(gè)問(wèn)題:

          在cas-server-webapp中的/WEB-INF/spring-configuration/ticketGrantingTicketCookieGenerator.xml文件中有如下配置

          <bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
            p:cookieSecure="true"     //默認(rèn)為true,使用https,如果只需要http,修改為false即可
            p:cookieMaxAge="-1"
            p:cookieName="CASTGC"
            p:cookiePath="/cas" />

           (2)使用jdbc數(shù)據(jù)源進(jìn)行用戶(hù)認(rèn)證,需要修改cas的authenticationHandlers方式,在文件/WEB-INF/deployerConfigContext.xml有如下配置:

          <property name="authenticationHandlers">
             <list>
              <!--
               | This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
               | a server side SSL certificate.
               +-->
              <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
               p:httpClient-ref="httpClient" />
              <!--
               | This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS
               | into production.  The default SimpleTestUsernamePasswordAuthenticationHandler authenticates UsernamePasswordCredentials
               | where the username equals the password.  You will need to replace this with an AuthenticationHandler that implements your
               | local authentication strategy.  You might accomplish this by coding a new such handler and declaring
               | edu.someschool.its.cas.MySpecialHandler here, or you might use one of the handlers provided in the adaptors modules.
               +-->
              <!--<bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />-->
               <bean  class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
                   <property name="dataSource" ref="dataSource" />
                  
          <property name="sql" value="select password from userInfo where username=? and enabled=true" />
                   //用戶(hù)密碼編碼方式

                   <property name="passwordEncoder"
                     ref="passwordEncoderBean"/>
                   </bean>  
             </list>
            </property>

          該屬性中的list只要用一個(gè)認(rèn)證通過(guò)即可,建議將紅色部分放在第一位,如果確認(rèn)只用jdbc一種方式,其他認(rèn)證方式均可刪除。另外需要在在文件中添加datasoure和passordEncoder兩個(gè)bean,如下

          <!-- Data source definition -->
           <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName">
              <value>com.mysql.jdbc.Driver</value>
            </property>
            <property name="url">
              <value>jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf-8</value>    //如果使用mysql數(shù)據(jù)庫(kù),應(yīng)該加上后面的編碼參數(shù),否則可能導(dǎo)致客戶(hù)端對(duì)TGT票據(jù)無(wú)法識(shí)別的問(wèn)題
            </property>
            <property name="username"><value>root</value></property>
            <property name="password"><value>password</value></property>
           </bean>
           <bean id="passwordEncoderBean" class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder">
                  <constructor-arg value="SHA1" />  //cas
          server默認(rèn)支持MD5和SHA1兩種編碼方式,如果需要其他的編碼方式例如SHA256,512等,可自行實(shí)現(xiàn)org.jasig.cas.authentication.handler.PasswordEncoder接口
              </bean>

          附加備注:如果您是使用cas server的源碼自行編譯的話(huà),需要在cas-server-web模塊的pom.xml中添加如下模塊的依賴(lài):

          <dependency>
                 <groupId>${project.groupId}</groupId>
                 <artifactId>cas-server-support-jdbc</artifactId>
                 <version>${project.version}</version>
            </dependency>  

          并添加對(duì)應(yīng)數(shù)據(jù)庫(kù)的jdbc的jar包。

          (3)讓cas server提供更多的用戶(hù)數(shù)據(jù)共客戶(hù)端使用

          通過(guò)測(cè)試,由于cas的代碼更新過(guò)程中的變化較大,所以包兼容的問(wèn)題好像一直存在,在測(cè)試中我就碰到過(guò),花費(fèi)時(shí)間比較多,建議同學(xué)們?cè)谑褂眠^(guò)程中使用官方的最新的發(fā)布版本。在我使用的這個(gè)版本中,請(qǐng)參考前面的關(guān)于server和client端的版本說(shuō)明,應(yīng)該沒(méi)有包沖突的問(wèn)題,測(cè)試通過(guò)。下面進(jìn)行配置,配置文件:/WEB-INF/deployerConfigContext.xml
          <property name="credentialsToPrincipalResolvers">
             <list>
                 <!--<bean class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" />-->
              <!-- modify on 2011-01-18,add user info -->
              <bean class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" >
                <property name="attributeRepository" >   //為認(rèn)證過(guò)的用戶(hù)的Principal添加屬性
                <ref local="attributeRepository"/>
               </property> 
              </bean>
                <bean
               class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
             </list>
            </property>
           修改該文件中默認(rèn)的 attributeRepositorybean配置
          <!-- 在這里配置獲取更多用戶(hù)的信息 -->
           <bean id="attributeRepository" class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
            <constructor-arg index="0" ref="dataSource" />
            <constructor-arg index="1" value="select id as UId, password_hint as ph from userInfo where username=? and enabled=true" />
            <property name="queryAttributeMapping">
             <map>
             <entry key="username" value="uid"/><!-- 這里必須這么寫(xiě),系統(tǒng)會(huì)自己匹配,貌似和where語(yǔ)句后面的用戶(hù)名字段的拼寫(xiě)沒(méi)有什么關(guān)系 -->
             </map>
            </property>
             <!-- 要獲取的屬性在這里配置 -->
            <property name="resultAttributeMapping">
             <map>
             <entry key="UId" value="userId" /> //key為對(duì)應(yīng)的數(shù)據(jù)庫(kù)字段名稱(chēng),value為提供給客戶(hù)端獲取的屬性名字,系統(tǒng)會(huì)自動(dòng)填充值
             <entry key="ph" value="passwordHint" />   
             </map>
            </property>
          </bean> 
          備注:網(wǎng)上有很多的關(guān)于這個(gè)的配置,但是如果您使用的是我提供的版本或是高于這個(gè)版本,就應(yīng)該象上面這樣配置,無(wú)用質(zhì)疑,網(wǎng)上大部分的配置都是基于
          person-directory-impl,person-directory-api
          1.1左右的版本,而最新的cas使用的是1.5的版本,經(jīng)過(guò)查看源代碼和api docs確定最新版本的屬性參數(shù)如上配置。

          修改該xml文件中最后一個(gè)默認(rèn)的serviceRegistryDao bean中的屬性全部注釋掉,或者刪除,
          這個(gè)bean中的RegisteredServiceImpl的ignoreAttributes屬性將決定是否添加attributes屬性?xún)?nèi)容,默認(rèn)為false:不添加,只有去掉這個(gè)配置,
          cas server才會(huì)將獲取的用戶(hù)的附加屬性添加到認(rèn)證用的Principal的attributes中去,我在這里犯過(guò)這樣的錯(cuò)誤,最后還是通過(guò)跟蹤源碼才發(fā)現(xiàn)的。
          <bean
            id="serviceRegistryDao"
                  class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl">
                  <!--
                      <property name="registeredServices">
                          <list>
                              <bean class="org.jasig.cas.services.RegisteredServiceImpl">
                                  <property name="id" value="0" />
                                  <property name="name" value="HTTP" />
                                  <property name="description" value="Only Allows HTTP Urls" />
                                  <property name="serviceId" value="http://**" />
                              </bean>

                              <bean class="org.jasig.cas.services.RegisteredServiceImpl">
                                  <property name="id" value="1" />
                                  <property name="name" value="HTTPS" />
                                  <property name="description" value="Only Allows HTTPS Urls" />
                                  <property name="serviceId" value="https://**" />
                              </bean>

                              <bean class="org.jasig.cas.services.RegisteredServiceImpl">
                                  <property name="id" value="2" />
                                  <property name="name" value="IMAPS" />
                                  <property name="description" value="Only Allows HTTPS Urls" />
                                  <property name="serviceId" value="imaps://**" />
                              </bean>

                              <bean class="org.jasig.cas.services.RegisteredServiceImpl">
                                  <property name="id" value="3" />
                                  <property name="name" value="IMAP" />
                                  <property name="description" value="Only Allows IMAP Urls" />
                                  <property name="serviceId" value="imap://**" />
                              </bean>
                          </list>
                      </property>-->
                     </bean>

           修改WEB-INF\view\jsp\protocol\2.0\casServiceValidationSuccess.jsp文件,如下:

          <%@ page session="false"%>
          <%@ taglib prefix="c" uri=">
          <%@ taglib uri="
          <cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
           <cas:authenticationSuccess>
            <cas:user>${fn:escapeXml(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.id)}</cas:user>
            <c:if test="${not empty pgtIou}">
             <cas:proxyGrantingTicket>${pgtIou}</cas:proxyGrantingTicket>
            </c:if>
            <c:if test="${fn:length(assertion.chainedAuthentications) > 1}">
             <cas:proxies>
              <c:forEach var="proxy" items="${assertion.chainedAuthentications}"
               varStatus="loopStatus" begin="0"
               end="${fn:length(assertion.chainedAuthentications)-2}" step="1">
               <cas:proxy>${fn:escapeXml(proxy.principal.id)}</cas:proxy>
              </c:forEach>
             </cas:proxies>
            </c:if>
             <c:if
             test="${fn:length(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes)

          >
          0}">
             <cas:attributes>
              <c:forEach
          var="attr"
               items="${assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes}"
               varStatus="loopStatus"
          begin="0"
               end="${fn:length(assertion.chainedAuthentications[fn:length(assertion.chainedAuthentications)-1].principal.attributes)-1}"
               step="1">
               <cas:${fn:escapeXml(attr.key)}>${fn:escapeXml(attr.value)}</cas:${fn:escapeXml(attr.key)}>
              </c:forEach>
             </cas:attributes>
            </c:if>
           </cas:authenticationSuccess>
          </cas:serviceResponse>
          客戶(hù)端配置:
          1.過(guò)濾器CAS Validation Filter:
          <filter>
            <filter-name>CAS Validation Filter</filter-name>
            <filter-class> org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
            <init-param>
              <param-name>casServerUrlPrefix</param-name>
              <param-value>http://domainserver:8081/cas</param-value>
            </init-param>
          </filter>
          在客戶(hù)端獲取信息
          AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
          String loginName = principal.getName();//獲取用戶(hù)名
          Map<String, Object> attributes = principal.getAttributes();
          if(attributes != null) {
           System.out.println(attributes.get("userId"));
           System.out.println(attributes.get("passwordHint"));
          }

           


           

          posted @ 2011-01-21 10:06 雪地孤鴻 閱讀(15893) | 評(píng)論 (9)編輯 收藏
          最近在使用G2G做項(xiàng)目,開(kāi)發(fā)環(huán)境的數(shù)據(jù)庫(kù)為Mysql,在使用grails的分頁(yè)組件時(shí)沒(méi)有任何問(wèn)題,但是將數(shù)據(jù)庫(kù)切換到ORACLE上就出現(xiàn)了問(wèn)題,在分頁(yè)的時(shí)候,記錄總數(shù)是對(duì)了的,但在進(jìn)行翻頁(yè)的時(shí)候,總會(huì)有前一頁(yè)的數(shù)據(jù)存在,而當(dāng)前的數(shù)據(jù)總是顯示不對(duì),經(jīng)過(guò)將近一天的仔細(xì)排查才找到問(wèn)題的關(guān)鍵,主要是由于數(shù)據(jù)庫(kù)的差異引起的,由于的我的查詢(xún)不需要進(jìn)行排序,所以在原來(lái)的查詢(xún)結(jié)果中沒(méi)有就排序語(yǔ)句,這就導(dǎo)致在mysql中完全正常的功能,到了oralce中每次查詢(xún)的排序不一致,結(jié)果就導(dǎo)致在翻頁(yè)的時(shí)候總有前一頁(yè)的數(shù)據(jù)存在,可能是由于數(shù)據(jù)庫(kù)的引擎規(guī)則的不一致導(dǎo)致的。
          再次記下!

          posted @ 2010-12-13 11:15 雪地孤鴻 閱讀(722) | 評(píng)論 (0)編輯 收藏
             今天早上出來(lái)給老婆大人買(mǎi)早點(diǎn),騎著老婆大人的小車(chē),在路上奔馳,突然一種思緒飛入腦中,想想自己也是三十多歲的人了,卻是一事無(wú)成。我本IT出生,參加工作以來(lái),卻一直徘徊在IT技術(shù)的和行業(yè)解決方案之間搖擺,最后終于下定決心朝著行業(yè)解決方案的方向發(fā)展,卻選擇了一個(gè)旅游行業(yè),雖說(shuō)春秋在國(guó)內(nèi)也算的上不錯(cuò)的旅游公司,但這個(gè)行業(yè)確實(shí)亂象叢生。該公司在信息化方面更是不知所謂,早三暮四。雖然我不應(yīng)該對(duì)公司說(shuō)三道四,但還是忍不住要說(shuō)兩句。算了,這個(gè)都是我個(gè)人的抉擇,我現(xiàn)在是IT技術(shù)方面沒(méi)有什么看家的本事,行業(yè)知識(shí)也沒(méi)有什么,長(zhǎng)此以往,很是危險(xiǎn),隨著年齡的增長(zhǎng),抗風(fēng)險(xiǎn)能力會(huì)越來(lái)月差,我必須要重新的思考和抉擇,不然真的要落的老婆大人預(yù)見(jiàn)的場(chǎng)景了,我自己不甘心這樣,也 不能讓老婆看扁啊。行業(yè)的解決方案肯定是我的房展方向,是繼續(xù)在這個(gè)行業(yè)發(fā)展,還是重新挑選行業(yè),這是個(gè)比較重要的決定,但是不管怎么樣,我的老本行--IT技術(shù)也支撐不了幾年了,我必須要反省,深思我過(guò)去的規(guī)劃和執(zhí)行,重新規(guī)劃和執(zhí)行,努力的保障家庭幸福的經(jīng)濟(jì)基礎(chǔ),開(kāi)拓新的事業(yè)。
          今天在這里寫(xiě)下如此的只言片語(yǔ),就是為了鞭策自己,不能讓自己在被短期的利益而動(dòng)搖長(zhǎng)期的規(guī)劃和執(zhí)行,年紀(jì)也不小了,還沒(méi)有一個(gè)像樣的事業(yè),以后的風(fēng)險(xiǎn)會(huì)越來(lái)越大。
          posted @ 2010-05-03 10:35 雪地孤鴻| 編輯 收藏
          最近在試用Grails進(jìn)行開(kāi)發(fā)一個(gè)小項(xiàng)目,需要使用oracle數(shù)據(jù)庫(kù),我使用的是Oracle 11g,簡(jiǎn)單的配置如下:
          1.添加jdbc lib到Grails項(xiàng)目的lib中,我使用的是ojdcb6_g.jar
          2.修改grails生成項(xiàng)目的DataSource.groovy文件中關(guān)于DataSource的相關(guān)配置:關(guān)鍵點(diǎn)是關(guān)于hibernate方言的配置,由于grails默認(rèn)使用的是HSQL內(nèi)存數(shù)據(jù)庫(kù),推薦使用的是mysql數(shù)據(jù)庫(kù);但是在使用oracle數(shù)據(jù)庫(kù)時(shí),需要配置hiernate的方言;其他的如URL,drive,username,password等配置和一般的配置沒(méi)有什么區(qū)別,詳細(xì)配置如下:
          dataSource {
              pooled = true
              driverClassName = "oracle.jdbc.OracleDriver"
              username = "paygateway"
              password = "paygateway"
              dialect = "org.hibernate.dialect.OracleDialect"
                 
              logSql = true
          }


          posted @ 2010-03-19 13:38 雪地孤鴻 閱讀(2008) | 評(píng)論 (1)編輯 收藏
          公司剛剛買(mǎi)了一臺(tái)Thinkpad R400(7445-A63),預(yù)裝的vista home basic版本,由于第一次使用thinkpad系列,只是制作了一個(gè)start Recovery Disk盤(pán),忘了制作系統(tǒng)恢復(fù)光盤(pán),暈倒,不知道聯(lián)想能否免費(fèi)提供哦,那可是俺花銀子買(mǎi)的阿。當(dāng)時(shí)急著想試用一下win7(當(dāng)然是盜版的),所以就把硬盤(pán)格掉了,后來(lái)想恢復(fù)的時(shí)候已經(jīng)晚了,因?yàn)槲覜](méi)有win7的序列號(hào),沒(méi)有辦法,只能重回xp時(shí)代了。
             由于硬盤(pán)是sata的,安裝過(guò)程很是郁悶,開(kāi)始都引導(dǎo)不了,后來(lái)狠狠的google一把,終于搞定了:
            1.進(jìn)入BIOS-》CONIF,將硬盤(pán)的模式修改為compatibility,原來(lái)為ACHI
            2.到聯(lián)想的官方網(wǎng)站,現(xiàn)在相關(guān)xp的驅(qū)動(dòng)(http://think.lenovo.com.cn),網(wǎng)友提供列表如下;我是全部打包下載了:)
               安裝主板芯片組驅(qū)動(dòng)(Intel Chipset Drivers)
          安裝硬盤(pán)SATA驅(qū)動(dòng)(Intel Matrix Storage Manager)
          安裝ACPI電源驅(qū)動(dòng),即Power Manager Driver
          安裝Lenovo System Interface Driver
          啟動(dòng)系統(tǒng),系統(tǒng)安裝顯卡驅(qū)動(dòng)
          安裝網(wǎng)卡驅(qū)動(dòng)
          安裝無(wú)線(xiàn)驅(qū)動(dòng)
          如果此系統(tǒng)安裝為XP2的系統(tǒng),那么要安裝MODOM和聲卡的前提是安裝讀卡器(也有人叫HD總線(xiàn))補(bǔ)丁: KB888111XPSP2.EXE;
          安裝聲卡驅(qū)動(dòng)和補(bǔ)丁
          安裝貓驅(qū)動(dòng)
          安裝藍(lán)牙驅(qū)動(dòng)
          安裝讀卡器驅(qū)動(dòng)
          安裝智能讀卡器驅(qū)動(dòng)
          安裝指紋驅(qū)動(dòng)        
          安裝PCI簡(jiǎn)易通訊控制器,也就是AMT(INTEL的主動(dòng)管理技術(shù)
          安裝TPM安全芯片的驅(qū)動(dòng)程序
          安裝攝像頭驅(qū)動(dòng)和補(bǔ)丁:7yca02ww.exe,Q909667.rar。
          安裝微軟雙核補(bǔ)丁和其他補(bǔ)丁:KB896256.exe, KB936357.exe, schedulerupdater.exe。
          安裝UltraNav driver
          安裝UltraNav Utility

          3.驅(qū)動(dòng)安裝完成后,重啟機(jī)器,進(jìn)入BIOS,將硬盤(pán)模式修改回原來(lái)的ACHI模式

          4.不知到何時(shí)能用上正中的win7盜版,感覺(jué)還是不錯(cuò),雖然我平時(shí)已經(jīng)不太用win系統(tǒng)了。:)


          posted @ 2009-12-20 11:25 雪地孤鴻 閱讀(1568) | 評(píng)論 (2)編輯 收藏
          ofbiz默認(rèn)的數(shù)據(jù)庫(kù)為derby,這個(gè)當(dāng)然不能在生產(chǎn)環(huán)境中使用,而且也不方便調(diào)試和管理。雖然ofbiz也支持很多的開(kāi)源數(shù)據(jù)庫(kù),例如mysql等,但是我們這里還是使用主流的數(shù)據(jù)庫(kù)系統(tǒng)oracle 11g.詳細(xì)的操作如下
          1.更新JDBC驅(qū)動(dòng),將oracle最新的jdbc驅(qū)動(dòng)copy到${ofbiz install dir}/framework/entity/lib/jdbc 目錄下。
          2.設(shè)置實(shí)體引擎( Entity Engine)的缺省數(shù)據(jù)庫(kù)為oracle.在修改 ${ofbiz install dir}/framework/entity/config/entityengine.xml文件中修改配置:
             a.修改數(shù)據(jù)庫(kù)連接參數(shù):
               <datasource name="localoracle"
                      helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
                      schema-name="ofbiz" 你的數(shù)據(jù)庫(kù)schema名稱(chēng)
                      field-type-name="oracle"
                      check-on-start="true"
                      add-missing-on-start="true"
                      alias-view-columns="false"
                      join-style="ansi">
                  <read-data reader-name="seed"/>
                  <read-data reader-name="seed-initial"/>
                  <read-data reader-name="demo"/>
                  <read-data reader-name="ext"/>
                  <inline-jdbc
                          jdbc-driver="oracle.jdbc.driver.OracleDriver"
                          jdbc-uri="jdbc:oracle:thin:@192.168.1.154:1521:ofbiz"  ofbiz為你的數(shù)據(jù)庫(kù)SID
                          jdbc-username="ofbiz"  用戶(hù)名
                          jdbc-password="ofbiz"  密碼
                          pool-minsize="2"
                          pool-maxsize="250"/>
              </datasource>
            b. 修改實(shí)體引擎的數(shù)據(jù)庫(kù)缺省配置如下:(將datasource-name的值設(shè)置為“localoracle”)
                <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
                  <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
                  <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
              </delegator>
              <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false" distributed-cache-clear-enabled="false">
                  <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
                  <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
              </delegator>

              <!-- be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "ant run-install" before running "ant run-tests" -->
              <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
                  <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
                  <group-map group-name="org.ofbiz.olap" datasource-name="localoracle"/>
              </delegator>
              <delegator name="other" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
                  <group-map group-name="org.ofbiz" datasource-name="localoracle"/>
              </delegator>
          3.補(bǔ)充:在進(jìn)行以上配置時(shí),請(qǐng)確保你已經(jīng)存在ofbiz的數(shù)據(jù)庫(kù),實(shí)例,用戶(hù)等都已創(chuàng)建好。
          4. 初始化數(shù)據(jù)和導(dǎo)入:   
               ofbiz$ java -jar ofbiz.jar -install
          通過(guò)以上命令即可進(jìn)行數(shù)據(jù)庫(kù)的初始化和初始數(shù)據(jù)的導(dǎo)入,這里包括了ofbiz自帶的例子,應(yīng)用的所有的數(shù)據(jù)表和初始化數(shù)據(jù)

          5.問(wèn)題:
          在使用oracle數(shù)據(jù)庫(kù)時(shí),當(dāng)前的版本可能會(huì)碰到ORA-01843:無(wú)效的月份的問(wèn)題      

              以sys用戶(hù)登陸并創(chuàng)建Trigger:

              create or replace TRIGGER ON_CONNECT AFTER LOGON ON DATABASE
               DECLARE
               guser varchar2(30);
               begin
                SELECT sys_context('USERENV','SESSION_USER') into guser FROM dual;
                   if (guser='ofbiz' or guser='OFBIZ') THEN
                      EXECUTE IMMEDIATE 'alter session set nls_timestamp_format = ''YYYY-MM-DD HH24:MI:SS.FF''';
                   end if;
               end;

          注意對(duì)登陸用戶(hù)名的判斷必須大小寫(xiě)都要考慮.

          另:ofbiz用戶(hù)不能擁有dba的權(quán)限,同時(shí)ofbiz用戶(hù)比需要有UNLIMITED TABLESPACE的權(quán)限,否則在創(chuàng)建數(shù)據(jù)表的時(shí)候會(huì)報(bào)“數(shù)據(jù)庫(kù)空間不足”的錯(cuò)誤,導(dǎo)致無(wú)法創(chuàng)建表。

          6.參考:
          http://blog.csdn.net/blieveme/archive/2007/10/16/1826604.aspx
          http://docs.ofbiz.org/display/~jacopoc/OFBiz+and+Oracle

          今天就到這里吧,明天繼續(xù):) 
          posted @ 2009-09-03 20:27 雪地孤鴻 閱讀(2623) | 評(píng)論 (3)編輯 收藏
          apache版本2.2
          自帶mod_deflate.so和mod_headers.so
          如果沒(méi)有這兩個(gè)模塊,那么你就需要手工編譯并load這兩個(gè)模塊。
          我是在虛擬主機(jī)下加入一下配置即可
          <Location "/">
          SetOutputFilter DEFLATE
          BrowserMatch ^Mozilla/4 gzip-only-text/html
          BrowserMatch ^Mozilla/4\.0[678] no-gzip
          BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
          SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
          Header append Vary User-Agent env=!dont-vary
          </Location>

          記住,以上配置,需要放到<Directory></Directory>之后,apache官方網(wǎng)站這么說(shuō)的:)

          posted @ 2009-08-26 09:17 雪地孤鴻 閱讀(194) | 評(píng)論 (0)編輯 收藏
          今天發(fā)現(xiàn)linux服務(wù)器的/目錄磁盤(pán)使用率為100%,操作如下
          主要通過(guò)du -sh查找占用磁盤(pán)較多的目錄
          1.清除/var/log下的日志文件
          2.清除/var/spool/mail下占用磁盤(pán)較多的郵件目錄(我的服務(wù)上主要是root用戶(hù)的郵件比較多導(dǎo)致的)

          posted @ 2009-07-02 17:25 雪地孤鴻 閱讀(4374) | 評(píng)論 (0)編輯 收藏

          但是scim中文輸入不了, 上網(wǎng)找解決方案,最后成功的方法:

          sudo apt-get install scim-qtimm 安裝scim的qt模塊

          • sudo gedit /usr/bin/opera 在文件中加入export QT_IM_MODULE="scim"

          啟動(dòng)opera,問(wèn)題解決。


          環(huán)境:

          ubuntu9.0.4

          opera9.6

          測(cè)試成功

          posted @ 2009-05-08 08:59 雪地孤鴻 閱讀(279) | 評(píng)論 (0)編輯 收藏

          鳴謝:http://www.phpma.com/linux/20070908/392.html

          Apache日志分析工具--AWStats6.9安裝使用
          1、事先安裝好Apache

          2、安裝awstats的命令(將awstats安裝在/opt/awstats目錄)
          mkdir -p /var/lib/awstats
          cd /opt
          wget http://www.awstats.cn/files/awstats-6.6.tar.gz
          tar zxvf awstats-6.6.tar.gz
          mv awstats-6.6 awstats
          cd awstats/tools/
          perl awstats_configure.pl

          3、Perl腳本awstats_configure.pl安裝過(guò)程(以下內(nèi)容引用AWStats英文使用說(shuō)明)

          (1)
          -----> Running OS detected: Linux, BSD or Unix
          Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'.
          If you want to use standard directory, you should first move all content
          of AWStats distribution from current directory:
          /opt/awstats
          to standard directory:
          /usr/local/awstats
          And then, run configure.pl from this location.
          Do you want to continue setup from this NON standard directory [yN] ?

          這時(shí)選擇y回車(chē)。

          (2)
          -----> Check for web server install

          Enter full config file path of your Web server.
          Example: /etc/httpd/httpd.conf
          Example: /usr/local/apache2/conf/httpd.conf
          Example: c:\Program files\apache group\apache\conf\httpd.conf
          Config file path ('none' to skip web server setup):

          第一次使用請(qǐng)輸入Apache的httpd.conf路徑,例如/opt/sina/apache/conf/httpd.conf
          以后如果再使用perl awstats_configure.pl生成配置文件,則可以輸入none跳過(guò)。

          (3)
          -----> Check and complete web server config file '/opt/sina/apache/conf/httpd.conf'
          Warning: You Apache config file contains directives to write 'common' log files
          This means that some features can't work (os, browsers and keywords detection).
          Do you want me to setup Apache to write 'combined' log files [y/N] ?

          選擇y,將日志記錄方式由CustomLog /yourlogpath/yourlogfile common改為更詳細(xì)的CustomLog /yourlogpath/yourlogfile combined

          (4)
          -----> Update model config file '/opt/awstats/wwwroot/cgi-bin/awstats.model.conf'
           File awstats.model.conf updated.

          -----> Need to create a new config file ?
          Do you want me to build a new AWStats config/profile
          file (required if first install) [y/N] ?

          創(chuàng)建一個(gè)新的配置文件,選擇y

          (5)
          -----> Define config file name to create
          What is the name of your web site or profile analysis ?
          Example: www.mysite.com
          Example: demo
          Your web site, virtual server or profile name:
          >

          輸入站點(diǎn)名稱(chēng),例如sina

          (6)
          -----> Define config file path
          In which directory do you plan to store your config file(s) ?
          Default: /etc/awstats
          Directory path to store config file(s) (Enter for default):
          >

          輸入AWStats配置文件存放路徑,一般直接回車(chē)則使用默認(rèn)路徑/etc/awstats

          (7)
          -----> Add update process inside a scheduler
          Sorry, configure.pl does not support automatic add to cron yet.
          You can do it manually by adding the following command to your cron:
          /opt/awstats/wwwroot/cgi-bin/awstats.pl -update -config=sina
          Or if you have several config files and prefer having only one command:
          /opt/awstats/tools/awstats_updateall.pl now
          Press ENTER to continue...

          按回車(chē)鍵繼續(xù)

          (8)
          A SIMPLE config file has been created: /opt/awstats/etc/awstats.sina.conf
          You should have a look inside to check and change manually main parameters.
          You can then manually update your statistics for 'sina' with command:
          > perl awstats.pl -update -config=sina
          You can also read your statistics for 'sina' with URL:
          > http://localhost/awstats/

          Press ENTER to finish...

          按回車(chē)鍵結(jié)束


          4、修改awstats.sina.conf配置
          vi /etc/awstats/awstats.sina.conf

          按?,在之后輸入要搜索的內(nèi)容LogFile="
          然后按Ins鍵,找到LogFile="/var/log/httpd/access_log"
          改為要分析的Apache日志路徑與文件名。

          (1)多日志合并分析(例:新浪播客其中兩臺(tái)服務(wù)器2月6日的日志30.0206.vblog.log與31.0206.vblog.log)
          LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/30.0206.vblog.log /var/apachelogs/31.0206.vblog.log|"

          LogFile="/opt/awstats/tools/logresolvemerge.pl /var/apachelogs/*.0206.vblog.log|"

          (2)分析使用gzip壓縮過(guò)的日志文件
          LogFile="gzip -d </var/log/apache/access.log.gz|"


          5、更新分析報(bào)告
          perl /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=sina -update


          在實(shí)踐過(guò)程中,確實(shí)有該問(wèn)題,只要?jiǎng)h除掉歷史日志記錄即可
          如果出現(xiàn)以下錯(cuò)誤提示,很大可能是Apache的Log文件中存在以前CustomLog /yourlogpath/yourlogfile common生成的日志,刪除掉這些行的日志即可:
          This means each line in your web server log file need to have "combined log format" like this:
          111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"

          6、查看分析報(bào)告
          http://localhost/awstats/awstats.pl?config=sina

          這里的sina對(duì)應(yīng)/etc/awstats/awstats.sina.conf中的sina

          7.awstats自動(dòng)生成日志分析報(bào)告

          需要root用戶(hù)權(quán)限,或者可以操作crontab -e命令的用戶(hù)權(quán)限:

          (1)鍵入:crontab -e

          (2)輸入以下系統(tǒng)定時(shí)任務(wù):

          0 5 * * *  /opt/awstats/wwwroot/cgi-bin/awstats.pl -config=www.google.com -update

          每天凌晨5點(diǎn)執(zhí)行日志分析報(bào)告,opt/awstats/wwwroot/cgi-bin/awstats.pl為awstats安裝目錄下的perl命令,www.goolge.com為你安裝awstats時(shí)指定的網(wǎng)站域名。關(guān)于crontab命令的用法,可以google一下。

          8.awstats基礎(chǔ)安全設(shè)置

          (1)linux系統(tǒng)中必須存在用戶(hù),如果不存在可以按以下方式操作

          groupadd awsuser     #增加awstats用戶(hù)組

          useradd -g awsuser awstats #增加awstats用戶(hù),并歸屬awsuser用戶(hù)組

          (2)在apache安裝目錄下新建文件夾

          mkdir passwd

          (3)運(yùn)行如下代碼產(chǎn)生用戶(hù)名為awstats用戶(hù)及其密碼

          opt/apache/bin/htpasswd -c /opt/apache/passwd/passwords awstats

          鍵入密碼和驗(yàn)證密碼即可

          (4)配置httpd.conf

          <Directory "/opt/awstats-6.9/wwwroot"> Options None AllowOverride None Order allow,deny Allow from all AuthType Basic AuthName "Restricted Files" AuthUserFile /usr/local/apache2/password/passwords Require user awsspring </Directory>




          附:
          (2)測(cè)試環(huán)境:在DELL PowerEdge 1950/2950 服務(wù)器+red hat as 4.6/5.0 as Linux操作系統(tǒng)+Apache 2.2.11下測(cè)試通過(guò)。

          posted @ 2009-04-08 16:54 雪地孤鴻 閱讀(1146) | 評(píng)論 (0)編輯 收藏
          <2009年4月>
          2930311234
          567891011
          12131415161718
          19202122232425
          262728293012
          3456789

          常用鏈接

          留言簿(17)

          隨筆分類(lèi)

          隨筆檔案

          文章檔案

          blog

          搜索

          •  

          最新評(píng)論

          閱讀排行榜

          評(píng)論排行榜

          主站蜘蛛池模板: 鸡西市| 信宜市| 东乡| 田林县| 梁山县| 翁牛特旗| 恩平市| 玉树县| 通州区| 青阳县| 孝昌县| 团风县| 江津市| 达州市| 尼木县| 新兴县| 鲁甸县| 安乡县| 花垣县| 卢湾区| 宁波市| 高雄县| 福海县| 汽车| 连州市| 迁西县| 大英县| 邢台市| 德保县| 安国市| 长宁县| 万荣县| 永川市| 武安市| 余江县| 蓬莱市| 林州市| 道孚县| 达州市| 北海市| 大新县|