Can you please post the stack trace so we can see the nesting of method
calls leading to the null pointer exception?
Thanks. -Marshall
ISAO Isaac Saito wrote:
> Thilo,
>
> Thank you for the comment.
> I took following steps but the result is the same.
>
> 1. set /uimaj-2.2.0-incubating-bin/apache-uima/lib as a classpath
> 2. clean compiled classes and build
>
> any comments will be appreciated.
>
> Isaac
>
> On 11/20/07, Thilo Goetz <[EMAIL PROTECTED]> wrote:
>
>> Hi,
>>
>> this looks like you may be referring to an old version
>> of your JCas classes in your classpath. The invocation
>> exception may be caused because the old version of the
>> Person class doesn't have the company feature yet. Please
>> check your classpath and make sure the classes you run
>> with are the same ones you compile against.
>>
>> --Thilo
>>
>> ISAO Isaac Saito wrote:
>>
>>> Hi all,
>>>
>>> Could anybody has a solution to the problem I describe below?
>>>
>>> Thanks in adv,
>>> Isaac
>>>
>>>
>>> - What I Want:
>>> set an array of String as a feature and get them
>>>
>>>
>>> - Phenomenon:
>>>
>>> -- Exception occurs and application terminates after executing
>>> System.out.print(person.getCompany_related().toArray())
>>>
>>> Exception in thread "main" java.lang.NullPointerException
>>> at org.apache.uima.cas.impl.CASImpl.ll_getFSForRef(CASImpl.java:2745)
>>>
>>>
>>> -- the content of variable shows "com.sun.jdi.InvocationException
>>> occurred invoking method." after executing
>>> person.setCompany_related(compArray).
>>> This can be seen by using eclipse' debug mode.
>>>
>>>
>>> - java code
>>>
>>> private void extractNeeFromText(String descpath, String htmlBody,
>>> Annotation person) {
>>> XMLInputSource in = null;
>>> try {
>>> in = new XMLInputSource(descpath);
>>> } catch (IOException e) {
>>> e.printStackTrace();
>>> }
>>> AnalysisEngine ae = AnalysisEngineUtil.getAeInstance(in);
>>> ResourceSpecifier specifier = null;
>>> AnalysisEngine ae = null;
>>> try {
>>> specifier =
>>> UIMAFramework.getXMLParser().parseResourceSpecifier(
>>> desc);
>>> ae = UIMAFramework.produceAnalysisEngine(specifier);
>>> } catch (InvalidXMLException e) {
>>> e.printStackTrace();
>>> } catch (ResourceInitializationException e) {
>>> e.printStackTrace();
>>> }
>>> JCas jcas = AnalysisEngineUtil.analyzeByAnalysisEngine(ae,
>>> htmlBody);
>>> FSIndex index = jcas.getJFSIndexRepository().getAnnotationIndex(
>>> Company.type);
>>> StringArray compArray = new StringArray(jcas, index.size());
>>> FSIterator compIter = index.iterator();
>>> int num_company = 0;
>>> while (compIter.hasNext()) {
>>> Company annot = (Company) compIter.next();
>>> compArray.set(num_company, annot.getLex());
>>> // TODO remove redundunt values
>>> num_company++;
>>> }
>>> person.setCompany_related(compArray);
>>> System.out.println(person.getCompany_related().toArray());
>>> }
>>>
>>>
>>> - type system desctiption
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
>>> <name>Person-Wikip_TypeSystemDescriptor</name>
>>> <description></description>
>>> <version>1.0</version>
>>> <vendor>ISAAC</vendor>
>>> <imports>
>>> <import
>>> location="../../tae_nee_apacheUima/desc/NamedEntityTypeSystemDescriptor.xml"/>
>>> </imports>
>>> <types>
>>> <typeDescription>
>>> <name>jp.ac.keio.dmc.context.srw.types.PersonWikip</name>
>>> <description>w</description>
>>> <supertypeName>uima.tcas.Annotation</supertypeName>
>>> <features>
>>> <featureDescription>
>>> <name>company_related</name>
>>> <description></description>
>>> <rangeTypeName>uima.cas.StringArray</rangeTypeName>
>>> </featureDescription>
>>> </features>
>>> </typeDescription>
>>> </types>
>>> </typeSystemDescription>
>>>
>>>
>>> - Referred conversation
>>> http://www.ibm.com/developerworks/forums/thread.jspa?threadID=129534
>>>
>
>
>