Problem:
ERROR org. springframework. web. context. ContextLoader :( ContextLoader. java: 215)
-Context initialization failed
Org. springframework. beans. factory. beanCreationException: Error creating bean with name 'productsearchservicebean': Injection of resource methods failed; nested exception is org. springframework. beans. factory. beanCreationException: Error creating bean with name 'compass 'defined in class path resource [beans. xml]: Invocation of init method failed; nested exception is org. compass. core. engine. searchEng IneException: Cannot instantiate Lucene Analyzer [net. paoding. analysis. analyzer. paodingAnalyzer] for analyzer [default]. please verify the analyzer setting at [type]; nested exception is net. paoding. analysis. exception. paodingAnalysisException: dic home shocould not be a file, but a directory!
Solution:
① Search for your desired answer through the search engine, like this link: http://zhidao.baidu.com/question/273848534.html? Qbl = relate_question_0
Main content like follow part:
When the server is started, dic home shocould not be a file, but a directory is thrown!
Analysis problem: this is because PaodingMaker. the getFile () method uses the old version of java.net. URL. getFile () cannot recognize Chinese characters or spaces. Only URLs are used. toURI (). getPath () can recognize Chinese characters and spaces.
Solve the problem: You need to modify the code in Paoding. FindPaodingMaker. javaSetDicHomeProperties method, modify File dicHomeFile = getFile (dicHome );
1 File dicHomeFile2 = getFile(dicHome); 2 String path=""; 3 4 try { 5 path = URLDecoder.decode(dicHomeFile2.getPath(),"UTF-8"); 6 } catch (UnsupportedEncodingException e) { 7 e.printStackTrace(); 8 } 9 File dicHomeFile = new File(path);
After completing the preceding steps, you also need to follow these steps:
①PaodingMaker. javaWhere?By analyzing (by your brain and search engine), the java file is in the project where the https://code.google.com/p/paoding/ is located.
[I .e:
Paoding Analysis Abstract
Paoding's KnivesExcellent Chinese Word SegmentationHigh EfficiencyAndHigh scalability. Introduce metaphor, adopt completely object-oriented design, and have advanced ideas.
High Efficiency: on personal machines with PIII 1g memory,1 secondAccurate Word Segmentation1 millionChinese characters.
Based onUnlimited numberThe dictionary file to effectively split the article, so that you can define the word classification.
Ability to properly parse unknown words
]
② How to replacePaodingMaker. class File,I tried the following and succeeded. Download the sourceCode of the Project hosted by googleCode above. Only download is targeted.
PaodingMaker. javaFile [Directory: paoding-Revision 154:/branches/paoding-for-lucene-2.4/src/net/paoding/analysis/knife] (advice: just try it !),
③ Directly load the downloadedPaodingMaker. javaDrag to myeclipse, or create a package based on the package statement of the file, and then new the file, copy all content, as shown above: Change the specific area Code.
④ Project-"clean, re-run [restart server], perfect solution