Carrot2

BeanShell script failing with a ClassNotFoundException

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 2.0
  • Fix Version/s: 2.1
  • Component/s: None
  • Labels:
    None

Description

When this is added as an input component for the browser:

/carrot2-lingo-3g-browser/components/input-cached-lucene.bsh:

import com.dawidweiss.carrot.core.local.*;
import com.dawidweiss.carrot.core.local.impl.*;
import com.dawidweiss.carrot.core.local.clustering.*;
import com.dawidweiss.carrot.local.controller.*;
import com.carrot.input.lucene.*;
import carrot2.demo.cache.*;

/**

  • Provide a path to the Lucene index to be used below, or use the "lucene.index.path"
  • system property to do that.
    */
    String indexPath = System.getProperty("lucene.index.path");

LocalComponentFactory factory = null;

if (indexPath != null)
{
luceneFactory = new LuceneLocalInputComponentFactory(indexPath);

factory = new LocalComponentFactoryBase()
{
public LocalComponent getInstance()

{ return new RawDocumentProducerCacheWrapper(luceneFactory.getInstance()); }

};
}
else
{
RawDocument errorMessage = new RawDocumentSnippet(
"0",
"Please configure Lucene index first",
"To use Lucene input, please provide a path to a Lucene index in the " + "'lucene.index.path' system property.",
"http://www.carrot2.org", // This url could point to some more material about configuring Lucene index
(float)0.0
);

factory = new LocalComponentFactoryBase() {
public LocalComponent getInstance() { return new RawDocumentProducerCacheWrapper(new com.dawidweiss.carrot.core.local.impl.DummyLocalInputComponent(errorMessage, "Please configure Lucene index")); }
};
}

return new LoadedComponentFactory(
/* id */ "input-cached-lucene",factory);

we get a weird exception:

Exception message: java.lang.NoClassDefFoundError: A class required by class: global/BlockNameSpace$4 could not be loaded: java.lang.NoClassDefFoundError: IllegalName: global/BlockNameSpace$4

Activity

Hide
Dawid Weiss added a comment -

This is a bug in BeanShell – we can't do much to fix it at the moment other than write scripts without anonymous classes (some of them work, some of them don't).

Show
Dawid Weiss added a comment - This is a bug in BeanShell – we can't do much to fix it at the moment other than write scripts without anonymous classes (some of them work, some of them don't).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: