Google Groups

Re: [Neo4j] Issue with Custom full text lucene index


Peter Neubauer May 9, 2012 12:20 PM
Posted in group: Neo4j

Got the project somewhere? Sounds like something around maybe underlying OSGi separating your code and the loading index?

Send from mobile.

On May 9, 2012 8:49 PM, "Daniel" <danielm...@gmail.com> wrote:
Hey Guys,

I implemented a custom analyzer(CustomAnalyzer)  for lucene overriding
the ReusableAnalyzerBase class. Created an full text index during a
batch import operation

fulltextIndex = indexProvider.nodeIndex("mainTextParagraphs",
MapUtil.stringMap("type", "fulltext", "analyzer",
CustomAnalyzer.class.getName()));

everything works the db imports.

I then tested the db in a standalone project with the following code,
again everything works.
(PASTIE here)
http://pastie.org/3885606

When I try running it on an MVC that we are building I get a class not
found exception.

Caused by: java.lang.ClassNotFoundException:
MainSearchPackage.CustomAnalyzer
       at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:169)
       at
org.neo4j.index.impl.lucene.IndexType.getByClassName(IndexType.java:
246)

I checked the classLoader and the class is present there with a single
instance & proper name.

I thought this may be a security permissions issue and surrounded the
index assignment with

AccessController.doPrivileged(new PrivilegedAction() {
                               public Object run(){
                                       fulltextIndex =
DatabaseInstance.caseDB.index().forNodes("mainTextParagraphs",
MapUtil.stringMap("type", "fulltext",
"analyzer",CustomAnalyzer.class.getName()));
                       ((LuceneIndex<Node>)
fulltextIndex ).setCacheCapacity( "mainTextParagraphs", cacheSize );
                               return null;
                               }
                       });

still same error, I also tried forcibly loading the classloader, same
error.

I am stumped do you guys have any idea what this is?

Thanks for the help
,

Dan