Rogan Creswick | 3 Sep 21:34
Picon

Problem with multiple type identifiers when loading pears

I just ran into what looks like a bug in the way ids are assigned for
JCas Cover types.

I'm loading annotators from PEARs, and each annotator (generally,
aggregate annotators, but I don't think that matters) produces
Redaction annotations.  The application that makes use of these
annotators needs to get filtered annotation indexes that only contain
these Redaction annotations.  Because of this, both the pears and the
invoking code have a dependency on the generated (by jcasgen)
Redaction class.

If I'm understanding the loading procedure, the ResourceManager
encapsulates a class loader that loads the PEAR dependencies, and
which triggers the creation of an instance of Redaction.class -- the
Redaction static initializer invokes
JCasRegistry.register(Redaction.class) to get a unique id.
Unfortunately, this seems to be happening *twice* for the same class,
since it is used by both the loaded pear and by the code doing the
loading.  JCasRegistry doesn't bother to check the input to see if it
has already assigned an ID for that class or not, so two IDs are
generated for Redaction.type, and that field is no longer a valid
identifier for the class.

One solution is to use a Map<Class<T extends Annotation>, Integer>
instead of the array list that JCasRegistry.register makes use of, and
do a look up on the class, returning the same id for subsequent calls.
That is probably not sufficient to properly solve the problem I'm
having, but I think it is necessary -- JCasRegistry.register(...) very
clearly does not return the same output for the same input on
subsequent invocations.
(Continue reading)

marius | 4 Sep 14:55
Picon
Favicon

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/uima/tools/cvd/CVD

Hello

I'm trying to make the tutorial "
Getting Started: Writing My First UIMA Annotator" and 
if I want to test my annotator I get this message:

""

Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/uima/tools/cvd/CVD
Caused by: java.lang.ClassNotFoundException:
org.apache.uima.tools.cvd.CVD
	at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
Could not find the main class: org.apache.uima.tools.cvd.CVD. Program
will exit.
""

can someone help me

Thanks 

Marius

(Continue reading)

Rogan Creswick | 4 Sep 18:50
Picon

Re: Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/uima/tools/cvd/CVD

On Fri, Sep 4, 2009 at 5:55 AM, marius <marius_iuresi@...> wrote:
> Hello
>
> I'm trying to make the tutorial "
> Getting Started: Writing My First UIMA Annotator" and
> if I want to test my annotator I get this message:

What command are you running to get this exception? Are you using the
cvd.bat (or cvd.sh) in the uima bin directory?

It looks like you're just missing a classpath entry.

--Rogan

> ""
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/uima/tools/cvd/CVD
> Caused by: java.lang.ClassNotFoundException:
> org.apache.uima.tools.cvd.CVD
>        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
>        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
> Could not find the main class: org.apache.uima.tools.cvd.CVD. Program
> will exit.
> ""
(Continue reading)

marius | 4 Sep 19:58
Picon
Favicon

Re: Exception in thread


Hello Rogan	

I do everything in eclipse just like on the site is...

marius 

Thilo Goetz | 4 Sep 20:18
Picon
Picon

Re: Exception in thread

marius wrote:
> 
> 
> 
> Hello Rogan	
> 
> I do everything in eclipse just like on the site is...
> 
> marius 
> 
> 
> 

No offense, but you wish to read this:
http://catb.org/~esr/faqs/smart-questions.html

Also try to get familiar with Java and Eclipse
first.  There are tons of Java tutorials on the
web, and Eclipse comes with an excellent tutorial
and help.

--Thilo

marius | 4 Sep 20:39
Picon
Favicon

Re: Exception in thread


Don't you worry about my java skills..

Marshall Schor | 5 Sep 13:54

Re: Exception in thread

Hi Marius,

Can you please post the command you used to start java to run the CVD? 
-Marshall

marius wrote:
>
>
> Hello Rogan	
>
> I do everything in eclipse just like on the site is...
>
> marius 
>
>
>
>
>
>
>   

Marshall Schor | 5 Sep 13:58

Re: How to configure aggregate analysis engines in a programmatically created CPE?


Fabio Mancinelli wrote:
> Hi everybody,
>
> I am building a CPE programmatically by using an aggregate analysis engine:
>
> CpeDescription cpeDesc = CpeDescriptorFactory.produceDescriptor();
>
> /* Setup the collection reader */
> ...
>
> /* Setup analysis engine */
> URL analysisEngineUrl =
> ClassLoader.getSystemResource("AggregateAnalysisEngine.xml");
> CpeCasProcessor analysisEngine =
> CpeDescriptorFactory.produceCasProcessor("Aggregate");
> analysisEngine.setDescriptor(analysisEngineUrl.toString());
> cpeDesc.addCasProcessor(analysisEngine);
>
> The problem I am facing is that I don't know how to configure the
> analysis engines contained in the aggregate ones.
>
> With simple analysis engines I could do:
>
> CasProcessorConfigurationParameterSettings analysisEngineSettings =
> CpeDescriptorFactory.produceCasProcessorConfigurationParameterSettings();
> analysisEngineSettings.setParameterValue("param", "value");
> analysisEngine.setConfigurationParameterSettings(analysisEngineSettings);
>
> But I cannot find any way to configure analysis engine inside an
(Continue reading)

Marshall Schor | 5 Sep 14:09

Re: Problem with multiple type identifiers when loading pears


Rogan Creswick wrote:
> I just ran into what looks like a bug in the way ids are assigned for
> JCas Cover types.
>
> I'm loading annotators from PEARs, and each annotator (generally,
> aggregate annotators, but I don't think that matters) produces
> Redaction annotations.  The application that makes use of these
> annotators needs to get filtered annotation indexes that only contain
> these Redaction annotations.  Because of this, both the pears and the
> invoking code have a dependency on the generated (by jcasgen)
> Redaction class.
>
> If I'm understanding the loading procedure, the ResourceManager
> encapsulates a class loader that loads the PEAR dependencies, and
> which triggers the creation of an instance of Redaction.class -- the
> Redaction static initializer invokes
> JCasRegistry.register(Redaction.class) to get a unique id.
> Unfortunately, this seems to be happening *twice* for the same class,
> since it is used by both the loaded pear and by the code doing the
> loading.  JCasRegistry doesn't bother to check the input to see if it
> has already assigned an ID for that class or not, so two IDs are
> generated for Redaction.type, and that field is no longer a valid
> identifier for the class.
>   

Can you say a bit more what the problem is?

The use-case for Pears is to provide a shielded environment where the
things in the PEAR can run with an independent classpath.  For example,
(Continue reading)

Rogan Creswick | 5 Sep 21:23
Picon

Re: Problem with multiple type identifiers when loading pears

On Sat, Sep 5, 2009 at 5:09 AM, Marshall Schor <msa@...> wrote:
>
> Can you say a bit more what the problem is?
>

I think my problem is actually tangential to the issue with
JCasRegistry.  After retrieving types from the jcas TypeSystem, I
still ran into issues with multiple Redaction definitions because of
multiple copies of the bytecode being loaded (multiple class loaders,
I think).  I've worked around that -- see below if you're interested.
I'd like to hear suggestions to make it cleaner, but at least it's
working.

I still don't understand why  JCasRegistry.register(...) shouldn't be
a true function.  It seems like there are at least two parallel ways
to retrieve types, and in my experience, they don't return the same
results--at least when getting filtered annotation indices.  (The ways
being: JCasRegistry.getClassForIndex(MyAnnotationType.type) and
aJCas.getTypeSystem().getTypeByName(MyAnnotationType.class.getType())

Anyhow, here's an overview of what we're doing -- it may shed some
light on this issue:

The UIMA portion of our application is a self-contained module (lets
call it 'core') that (once instantiated) takes a Document as input,
and returns a Collection<Violation>.  Violations are moderately
complex data structures that contain the fields of an Annotation
object -- specifically, a Redaction (Redaction is a JCasGen-generated
annotation subtype with some minor additional metadata that the
Annotators populate).
(Continue reading)


Gmane