關於ActiveMQ在MyEclipse中出現無法讀取schema文件的問題解決方法
由於專案要使用到郵件功能,老大就叫我用ActiveMQ來管理郵件的傳送,其好處網上百度,這裡不說了,我想說說網上有好多號稱可以執行的Spring+ActiveMQ的例子,下載下來後發現每個例子的**applicationContext.xml都在MyEclipse中出現錯誤(紅點提示---看到就頭痛了),幾乎試驗過所有的中文解決方法了,還是沒法解決,大家都可以從英文提示那裡知道IDE找不到schema文件,無法讀取jar包裡的activemq.xsd檔案所引發。
找了一天的方法,還是那樣,紅點依舊,很沮喪,本人經受不起打擊,這次的打擊不小了。中文的方法無法解決,沒辦法,只好去試試英文的。本人英文不太好,只能死馬當活馬醫了,很快就發現了個解決方法,原來之前試驗過的一箇中文方法的方向是正確的,不過不知道是那篇中文文章的作者手誤還是不負責 :twisted: ,可以肯定他沒有試驗過就釋出的,不然怎麼還是出現紅點錯誤,而且一個錯誤,網上千千萬萬篇文章都是那樣的複製、黏貼轉載。給不少的新手帶來了障礙。
以下是從英文網站複製過來的----將一些認為是重點的翻譯一下
Newer versions of ActiveMQ have support for XML name space schema declarations to allow easier configuration of container beans. Adding the following XMLNS declaration to the beans container will allow you to use ActiveMQ’s amq name space.
XML:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
<amq:broker start="true" brokerName="bs-localhost">
<amq:networkConnectors>
<!−− more configurations −−>
</amq:networkConnectors>
</amq:broker>
</bean>
When the application is deployed (in Tomcat) it will work as expected, however if you try to run it under Eclipse the container fails to start with the message:
org.xml.sax.SAXParseException: schema_reference.4:
Failed to read schema document 'http://activemq.apache.org/schema/core/activemq-core.xsd',
because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:
The matching wildcard is strict,
but no declaration can be found for element 'amq:broker'. </xsd>
The amq:broker maybe replaced with amq:connectionFactory depending on which name elements you have actually used.
[color=red][b]In order for Eclipse to understand the amq name space you must add xbean support for ActiveMQ. This is achieved by adding xbean-spring-3.4.jar to your dynamic web project.[/b][/color]
[b][color=green]在專案中新增xbean-spring-3.4.jar是為了讓Eclipse能知道ActiveMQ的amq的名稱空間[/color][/b]
According to the ActiveMQ website the XSD declaration will be automatically fished out of the jar and used to help Eclipse give you features like command completion for the XML schema. In fact what happens, is that Eclipse lights up like a Christmas tree moaning that it can’t find the schema declaration. Below is a set of instructions to tell Eclipse how to associate the activemq-core.xsd url with the activemq-core.xsd found in the jar file which is shipped as part of ActiveMQ.
1. Select Windows->Preferences from the Eclipse menu bar.
2. Select XML->XML Catalog from the left hand configuration tree.
3. Highlight User Specified Entries and select Add.
4. The Add XML Catalog Entry windows appears.
5. In the Location enter the path to the activemq-all jar, then add !/activemq.xsd to the end of the jar name. e.g. jar:file:[b][color=red]C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd[/color][/b]
[b][color=green]以上這段中C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd的C:/Java/libs/activemq/apache-activemq-5.2.0替換為自己的acticemq-all.jar的絕對路徑,activemq-all-5.2.0.jar改成自己對應的包名便可以。中文方法都是寫<path for activemq>\,什麼也不說明下,嚴重鄙視他們,很不負責[/color][/b]
6. Under KeyType enter Namespace Name
7. and under Key enter http://activemq.apache.org/schema/core
8. then click Ok.
9. Now we need to do the same for the other name space file, so hit Add again.
10. In the Location enter the path to the activemq-all jar, then add !/activemq.xsd to the end of the jar name. e.g. jar:file:C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd
11. Under KeyType enter Schema Location
12. and under Key enter http://activemq.apache.org/schema/core/activemq-core.xsd
13. Click Ok, Ok.
The Spring IDE should do its thing and the red error markers will disappear.
相信大家都應該解決困擾很久的問題,我也還要繼續學習ActiveMQ的使用,很高興與大家分享經驗、交流技術
找了一天的方法,還是那樣,紅點依舊,很沮喪,本人經受不起打擊,這次的打擊不小了。中文的方法無法解決,沒辦法,只好去試試英文的。本人英文不太好,只能死馬當活馬醫了,很快就發現了個解決方法,原來之前試驗過的一箇中文方法的方向是正確的,不過不知道是那篇中文文章的作者手誤還是不負責 :twisted: ,可以肯定他沒有試驗過就釋出的,不然怎麼還是出現紅點錯誤,而且一個錯誤,網上千千萬萬篇文章都是那樣的複製、黏貼轉載。給不少的新手帶來了障礙。
以下是從英文網站複製過來的----將一些認為是重點的翻譯一下
Newer versions of ActiveMQ have support for XML name space schema declarations to allow easier configuration of container beans. Adding the following XMLNS declaration to the beans container will allow you to use ActiveMQ’s amq name space.
XML:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">
<amq:broker start="true" brokerName="bs-localhost">
<amq:networkConnectors>
<!−− more configurations −−>
</amq:networkConnectors>
</amq:broker>
</bean>
When the application is deployed (in Tomcat) it will work as expected, however if you try to run it under Eclipse the container fails to start with the message:
org.xml.sax.SAXParseException: schema_reference.4:
Failed to read schema document 'http://activemq.apache.org/schema/core/activemq-core.xsd',
because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:
The matching wildcard is strict,
but no declaration can be found for element 'amq:broker'. </xsd>
The amq:broker maybe replaced with amq:connectionFactory depending on which name elements you have actually used.
[color=red][b]In order for Eclipse to understand the amq name space you must add xbean support for ActiveMQ. This is achieved by adding xbean-spring-3.4.jar to your dynamic web project.[/b][/color]
[b][color=green]在專案中新增xbean-spring-3.4.jar是為了讓Eclipse能知道ActiveMQ的amq的名稱空間[/color][/b]
According to the ActiveMQ website the XSD declaration will be automatically fished out of the jar and used to help Eclipse give you features like command completion for the XML schema. In fact what happens, is that Eclipse lights up like a Christmas tree moaning that it can’t find the schema declaration. Below is a set of instructions to tell Eclipse how to associate the activemq-core.xsd url with the activemq-core.xsd found in the jar file which is shipped as part of ActiveMQ.
1. Select Windows->Preferences from the Eclipse menu bar.
2. Select XML->XML Catalog from the left hand configuration tree.
3. Highlight User Specified Entries and select Add.
4. The Add XML Catalog Entry windows appears.
5. In the Location enter the path to the activemq-all jar, then add !/activemq.xsd to the end of the jar name. e.g. jar:file:[b][color=red]C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd[/color][/b]
[b][color=green]以上這段中C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd的C:/Java/libs/activemq/apache-activemq-5.2.0替換為自己的acticemq-all.jar的絕對路徑,activemq-all-5.2.0.jar改成自己對應的包名便可以。中文方法都是寫<path for activemq>\,什麼也不說明下,嚴重鄙視他們,很不負責[/color][/b]
6. Under KeyType enter Namespace Name
7. and under Key enter http://activemq.apache.org/schema/core
8. then click Ok.
9. Now we need to do the same for the other name space file, so hit Add again.
10. In the Location enter the path to the activemq-all jar, then add !/activemq.xsd to the end of the jar name. e.g. jar:file:C:/Java/libs/activemq/apache-activemq-5.2.0/activemq-all-5.2.0.jar!/activemq.xsd
11. Under KeyType enter Schema Location
12. and under Key enter http://activemq.apache.org/schema/core/activemq-core.xsd
13. Click Ok, Ok.
The Spring IDE should do its thing and the red error markers will disappear.
相信大家都應該解決困擾很久的問題,我也還要繼續學習ActiveMQ的使用,很高興與大家分享經驗、交流技術
相關文章
- 關於listener無法啟動的問題解決
- 關於網路硬體配置出現問題,無法上網問題的解決
- SaaS無法解決“關鍵”問題
- matlab中出現mex無法編譯的問題Matlab編譯
- 解決:在阻止快取的inspect模式下無法drawImage()的問題快取模式
- 關於SESSION中出現的奇怪的問題!高手進~~Session
- 對於python中出現UnicodeDecodeError問題的解決方案PythonUnicodeError
- 關於requests的session方法無法保持cookie的問題。SessionCookie
- CentOS下OpenCV無法讀取影片檔案的解決方法CentOSOpenCV
- 關於在join中出現ORA-00918: 未明確定義列的解決辦法
- myeclipse10無法weblogic10.3的問題解決方案EclipseWeb
- 關於從其他程式切回word文件時卡頓問題的解決辦法
- Spark SQL中出現 CROSS JOIN 問題解決SparkSQLROS
- 關於weget “無法建立SSL連線”的解決方法
- CentOS下OpenCV無法讀取視訊檔案的解決方法CentOSOpenCV
- 怎麼解決SOLIDWORKS文件無法正常開啟的問題!Solid
- win10無法正常關機的最佳解決方法_如何解決win10無法正常關機的問題Win10
- goland中npm無法使用的問題及解決方法GoLandNPM
- 解決無法使用VI的問題
- IDEA中Lombok無法生效的問題及解決方法IdeaLombok
- 安裝過程中出現PKG_CONFIG_PATH的問題解決方法
- 求救:關於讀取excel資料的問題Excel
- 關於ASP.NET在IIS上的一些問題的解決辦法ASP.NET
- EFS加密文件無法開啟的解決原理和方法加密
- [未解決]fedora9無法關機問題
- 解決Centos無法yum源的問題CentOS
- 關於input的一些問題解決方法分享
- gmail無法訪問問題解決--FGWAI
- 組策略中的稽核策略提示 Windows無法讀取模板資訊的解決方法Windows
- 解決RAW在SQLPLUS上無法顯示的問題SQL
- 關於 VMware Workstation14 Pro 宿主機無法聯網問題解決方案
- 關於外部引用jar包報紅無法使用解決方法JAR
- 關於 Google 電子表格無法訪問的問題Go
- 解決EventBus中接收方法中無法更新UI的問題UI
- 解決寶塔皮膚無法訪問的問題?
- 行動硬碟出現 檔案目錄損壞且無法讀取 解決方法教程(一)硬碟
- 行動硬碟出現 檔案目錄損壞且無法讀取 解決方法教程(二)硬碟
- 關於Centos7中Vscode無響應的問題及解決方法CentOSVSCode