2008年8月12日

          使用Firebug的console導致IE提示對象未定義錯誤

          1.安裝Firebug Lite
          具體安裝方法查看Firebug Lite的主頁
          http://getfirebug.com/lite.html

          2.添加一段javascript到頁面中
          if (!window.console || !console.firebug)

          {
              var names 
          = ["log""debug""info""warn""error""assert""dir""dirxml",
              
          "group""groupEnd""time""timeEnd""count""trace""profile""profileEnd"];

              window.console 
          = {};
              
          for (var i = 0; i < names.length; ++i)
                  window.console[names[i]] 
          = function() {}
          }

          或直接下載firebugx.js
          http://getfirebug.com/firebug/firebugx.js


          posted @ 2008-10-15 14:36 Gordian Yuan 閱讀(7894) | 評論 (3)編輯 收藏

          JQuery failure code 0x805e000a

          [Exception... "Component returned failure code: 0x805e000a [nsIXMLHttpRequest.open]" nsresult: "0x805e000a (<unknown>)" location: "JS frame :: http://localhost:8080/scripts/jquery.js :: anonymous :: line 2699" data: no]

          Exception提示是jquery獲取不到結果.但瀏覽器直接訪問地址可以得到結果
          最終發現問題出現在firefox插件adblock上
          因為我的servlet寫成"/advertiser/page"
          adblock把結果給過濾
          因此jquery獲取不到給出Component returned failure code: 0x805e000a

          解決辦法
          把advertiser改名成vertiser,這樣即使用戶使用firefox和adblock也可以訪問

          posted @ 2008-10-07 21:52 Gordian Yuan 閱讀(353) | 評論 (0)編輯 收藏

          關于Eclipse3.4-Ganymede內置SVN不能使用

          當使用Eclipse3.4-Ganymede內置的SVN嘗試檢出項目時出現
          Selected SVN connector library is not available or cannot be loaded.
          原因在于Eclipse3.4并沒有內置默認的SVN連接器.

          解決辦法
          自己安裝一個SVN連接器,通過在線安裝EclipsePlugin的辦法安裝SVN連接器
          下面是安裝地址
          http://www.polarion.org/projects/subversive/download/eclipse/2.0/ganymede-site/

          注意:
          安裝SVN的前提是使用Eclipse3.4-Ganymede的J2EE的版本
          Eclipse3.4-Ganymede的Java版本即使安裝SVN連接器也無法使用 應該是缺少某個組件

          posted @ 2008-08-20 13:34 Gordian Yuan 閱讀(1708) | 評論 (0)編輯 收藏

          Hibernate初始化時在OneToOneSecondPass類中出現NullPointerException

          啟動項目,Hibernate隨即報錯
          Caused by: java.lang.NullPointerException
              at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass.java:135)
          解決辦法
          OneToOne并使用外鍵生成器的時候需要持久化對象聲明的順序.被依賴的需要先聲明

          這個異常是出現在我一個類依賴另一個類來生成主鍵的時候產生
          這時候應該注意的是mapping class的聲明順序,
          例如下面,如果Role類依賴User的某個屬性(例如我的情況是Role使用foreign key generator根據User的主鍵生成Role的主鍵)
          這時候就需要先聲明User然后聲明Role,否則會出現上面的異常.
          <hibernate-configuration>
          <session-factory>
          <mapping class="model.User" />
          <mapping class="model.Role" />
          </session-factory>
          </hibernate-configuration>

          posted @ 2008-08-15 16:33 Gordian Yuan 閱讀(1300) | 評論 (2)編輯 收藏

          Eclipse不能編譯Java文件?

          當我想要使用Eclipse生成serialVersionUID的時候,Eclipse彈出出錯信息.
          The following problem occurred.
          could not find class file.
          make sure the file is compilable.
          同時項目中的Java文件出錯時會出現的紅叉叉也不再出現

          對比兩個項目的屬性發現失敗的項目缺少一個名為"Java Builder"的Builder
          一般在Eclipse新建項目都會有配置Java Builder
          但這個項目是使用m2eclipse的
          創建出來并沒有JavaBuilder
          取而代之的是一個AspectJ Builder

          解決辦法:

          還沒有

          抱歉這個問題還在困擾著我

          嘗試過自行添加一個JavaBuilder
          到workspace項目中打開.project文件添加下面代碼
          <buildSpec>
             <buildCommand>
                <name>org.eclipse.jdt.core.javabuilder</name>
                <arguments>
                </arguments>
             </buildCommand>
          </buildSpec>
          卻引來更嚴重的ClassNotFoundException


          posted @ 2008-08-15 16:13 Gordian Yuan 閱讀(2067) | 評論 (2)編輯 收藏

          Eclipse關閉No grammar constraints (DTD or XML schema) detected for the document警告

          "Warning: No grammar constraints (DTD or XML schema) detected for the document."
          可以在Eclipse工具欄中
          Windows - Preferences - XML - XML Files - Validate files - Indicate when no grammar is specified
          選擇ignore
          來關閉這個警告

          posted @ 2008-08-13 10:53 Gordian Yuan 閱讀(9111) | 評論 (5)編輯 收藏

          為Sitemesh添加上Body標簽的onload屬性

          Sitemesh默認不添加Body的屬性
          例如在Body中常用的onload方法在使用sitemesh后就會失效

          解決辦法
          修改template文件

          如果template文件是jsp則可以修改為
          <body onload="<decorator:getProperty name="body.onload" />">
          </body>

          <body<decorator:getProperty property="body.onload" writeEntireProperty="true" />>
          </body>

          如果template文件是freemarker則可以修改為
          <body onload="${page.properties["body.onload"]?default("")}">

          posted @ 2008-08-12 16:53 Gordian Yuan 閱讀(992) | 評論 (0)編輯 收藏

          關于Maven中找不到native2ascii

          Error starting Sun's native2ascii:
          at org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii.run(SunNative2Ascii.j
          ava:67)

          解決方法:
          復制JDK目錄下的lib文件夾的tools.jar到JRE目錄下的lib文件夾下的ext文件夾
          (另外一個更好的辦法就是把JRE的路徑設置到JDK的目錄下)
          Copying %Java_Home%/lib/tools.jar to 
          %Java_Home%/jre/lib/ext/tools.jar fixed this problem.

          (a better approach is to set up JRE path to the directory JDK)


          經過分析:
          今天使用Maven創建Appfuse的時候,發現出現Error starting Sun's native2ascii
          Maven指向的是JRE的目錄,JRE目錄下沒有tools.jar,故找不到native2ascii
          研究后發現Maven指定的是../相對路徑按道理能通過找尋上一級文件夾從而找到jdk目錄繼而找到tools.jar包
          因此一般情況下是用JDK里面的JRE不會出現這個問題.
          通過上面分析判斷項目配置的JRE不在JDK的目錄,把tools.jar文件放到JRE目錄lib文件夾的ext文件夾下
          問題解決

          posted @ 2008-08-12 15:48 Gordian Yuan 閱讀(1410) | 評論 (0)編輯 收藏

          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          導航

          統計

          常用鏈接

          留言簿(1)

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 剑河县| 曲周县| 垣曲县| 同心县| 澎湖县| 南郑县| 盐津县| 大丰市| 微博| 海盐县| 图木舒克市| 南部县| 建平县| 延寿县| 沂南县| 金湖县| 瑞安市| 蒙城县| 兴文县| 长汀县| 五原县| 抚顺县| 延庆县| 奉节县| 赣榆县| 渭南市| 确山县| 阿荣旗| 宁明县| 平湖市| 琼海市| 高碑店市| 丹寨县| 龙江县| 桂平市| 改则县| 时尚| 德兴市| 连山| 维西| 额尔古纳市|