You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Radwen ANIBA <ar...@gmail.com> on 2010/01/18 21:42:04 UTC

Error in My Application

Hi ,

My application run without any problem except at the end it shows this
message and I don't really know why

Exception in thread "BaseCPMImpl-Thread" java.lang.NullPointerException
    at
org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
    at java.lang.Thread.run(Thread.java:619)

And the process do not finish till I kill it

Any idea ?

Rad

Re: Error in My Application

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Rad, the CPE uses multiple threads while processing the Collection. Return
from process() does not indicate completion of the collection. There is a
thread in which a CollectionReader runs, there is a separate thread in which
your analytics are called, and finally another thread where the Consumer is
running collecting results. You need to plug in a listener object to know
when the collection is finished

But to answer your question, you can call stop() method to stop the CPE.
Please check example code that comes with the UIMA for usage information.

Regards, Jerry C


On Mon, Jan 18, 2010 at 4:31 PM, Radwen ANIBA <ar...@gmail.com> wrote:

> yes but when I removed addStatusCallbackListener, the process still alive
> and I have to kill it manually !
>
> I thought when we put mCPE.process() the CPE will finish after doing what
> it
> have to do automatically, shoud I add something after that to kill it ?
>
> 2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>
>
> > Forgot to mention, the fix is against JIRA
> > UIMA-1727<https://issues.apache.org/jira/browse/UIMA-1727>
> > *
> > *
> > <https://issues.apache.org/jira/browse/UIMA-1727>*Jerry C
> > *
> > On Mon, Jan 18, 2010 at 4:22 PM, Jaroslaw Cwiklik <ui...@gmail.com>
> > wrote:
> >
> > > Rad, there was a bug in the CPM that I just fixed. The CPM was not
> > checking
> > > for null before adding a listener to an internal list. This led to the
> > NPE
> > > as you've reported. The new code should work now. If you dont want to
> > update
> > > from the SVN just dont call the addStatusCallbackListener(null). This
> > would
> > > be a workaround for the problem.
> > >
> > > Jerry C
> > >
> > >
> > > On Mon, Jan 18, 2010 at 3:59 PM, Radwen ANIBA <ar...@gmail.com>
> wrote:
> > >
> > >> just before mCPE.process() i've added these
> > >>
> > >> StatusCallbackListener listner = null ;
> > >>            mCPE.addStatusCallbackListener(listner);
> > >>
> > >> Is this wrong ?
> > >>
> > >> 2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>
> > >>
> > >> > Rad, looks like a bad reference to the Callback Listener:
> > >> >
> > >> >    ArrayList statusCbL = cpEngine.getCallbackListeners();
> > >> >    // Notify all listeners that the CPM has finished processing
> > >> >    for (int j = 0; j < statusCbL.size(); j++) {
> > >> >      BaseStatusCallbackListener st = (BaseStatusCallbackListener)
> > >> > statusCbL.get(j);
> > >> >      if (!killed) {
> > >> >        st.collectionProcessComplete();
> > >> >      } else {
> > >> >        st.aborted();
> > >> >      }
> > >> >    }
> > >> >
> > >> > Line 537: st.collectionProcessComplete();
> > >> >
> > >> > Do you plug in a listener to the CPM?
> > >> >
> > >> > Jerry C
> > >> >
> > >> > On Mon, Jan 18, 2010 at 3:42 PM, Radwen ANIBA <ar...@gmail.com>
> > >> wrote:
> > >> >
> > >> > > Hi ,
> > >> > >
> > >> > > My application run without any problem except at the end it shows
> > this
> > >> > > message and I don't really know why
> > >> > >
> > >> > > Exception in thread "BaseCPMImpl-Thread"
> > >> java.lang.NullPointerException
> > >> > >    at
> > >> > >
> > >>
> > org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
> > >> > >    at java.lang.Thread.run(Thread.java:619)
> > >> > >
> > >> > > And the process do not finish till I kill it
> > >> > >
> > >> > > Any idea ?
> > >> > >
> > >> > > Rad
> > >> > >
> > >> >
> > >>
> > >
> > >
> >
>

Re: Error in My Application

Posted by Radwen ANIBA <ar...@gmail.com>.
yes but when I removed addStatusCallbackListener, the process still alive
and I have to kill it manually !

I thought when we put mCPE.process() the CPE will finish after doing what it
have to do automatically, shoud I add something after that to kill it ?

2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>

> Forgot to mention, the fix is against JIRA
> UIMA-1727<https://issues.apache.org/jira/browse/UIMA-1727>
> *
> *
> <https://issues.apache.org/jira/browse/UIMA-1727>*Jerry C
> *
> On Mon, Jan 18, 2010 at 4:22 PM, Jaroslaw Cwiklik <ui...@gmail.com>
> wrote:
>
> > Rad, there was a bug in the CPM that I just fixed. The CPM was not
> checking
> > for null before adding a listener to an internal list. This led to the
> NPE
> > as you've reported. The new code should work now. If you dont want to
> update
> > from the SVN just dont call the addStatusCallbackListener(null). This
> would
> > be a workaround for the problem.
> >
> > Jerry C
> >
> >
> > On Mon, Jan 18, 2010 at 3:59 PM, Radwen ANIBA <ar...@gmail.com> wrote:
> >
> >> just before mCPE.process() i've added these
> >>
> >> StatusCallbackListener listner = null ;
> >>            mCPE.addStatusCallbackListener(listner);
> >>
> >> Is this wrong ?
> >>
> >> 2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>
> >>
> >> > Rad, looks like a bad reference to the Callback Listener:
> >> >
> >> >    ArrayList statusCbL = cpEngine.getCallbackListeners();
> >> >    // Notify all listeners that the CPM has finished processing
> >> >    for (int j = 0; j < statusCbL.size(); j++) {
> >> >      BaseStatusCallbackListener st = (BaseStatusCallbackListener)
> >> > statusCbL.get(j);
> >> >      if (!killed) {
> >> >        st.collectionProcessComplete();
> >> >      } else {
> >> >        st.aborted();
> >> >      }
> >> >    }
> >> >
> >> > Line 537: st.collectionProcessComplete();
> >> >
> >> > Do you plug in a listener to the CPM?
> >> >
> >> > Jerry C
> >> >
> >> > On Mon, Jan 18, 2010 at 3:42 PM, Radwen ANIBA <ar...@gmail.com>
> >> wrote:
> >> >
> >> > > Hi ,
> >> > >
> >> > > My application run without any problem except at the end it shows
> this
> >> > > message and I don't really know why
> >> > >
> >> > > Exception in thread "BaseCPMImpl-Thread"
> >> java.lang.NullPointerException
> >> > >    at
> >> > >
> >>
> org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
> >> > >    at java.lang.Thread.run(Thread.java:619)
> >> > >
> >> > > And the process do not finish till I kill it
> >> > >
> >> > > Any idea ?
> >> > >
> >> > > Rad
> >> > >
> >> >
> >>
> >
> >
>

Re: Error in My Application

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Forgot to mention, the fix is against JIRA
UIMA-1727<https://issues.apache.org/jira/browse/UIMA-1727>
*
*
<https://issues.apache.org/jira/browse/UIMA-1727>*Jerry C
*
On Mon, Jan 18, 2010 at 4:22 PM, Jaroslaw Cwiklik <ui...@gmail.com> wrote:

> Rad, there was a bug in the CPM that I just fixed. The CPM was not checking
> for null before adding a listener to an internal list. This led to the NPE
> as you've reported. The new code should work now. If you dont want to update
> from the SVN just dont call the addStatusCallbackListener(null). This would
> be a workaround for the problem.
>
> Jerry C
>
>
> On Mon, Jan 18, 2010 at 3:59 PM, Radwen ANIBA <ar...@gmail.com> wrote:
>
>> just before mCPE.process() i've added these
>>
>> StatusCallbackListener listner = null ;
>>            mCPE.addStatusCallbackListener(listner);
>>
>> Is this wrong ?
>>
>> 2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>
>>
>> > Rad, looks like a bad reference to the Callback Listener:
>> >
>> >    ArrayList statusCbL = cpEngine.getCallbackListeners();
>> >    // Notify all listeners that the CPM has finished processing
>> >    for (int j = 0; j < statusCbL.size(); j++) {
>> >      BaseStatusCallbackListener st = (BaseStatusCallbackListener)
>> > statusCbL.get(j);
>> >      if (!killed) {
>> >        st.collectionProcessComplete();
>> >      } else {
>> >        st.aborted();
>> >      }
>> >    }
>> >
>> > Line 537: st.collectionProcessComplete();
>> >
>> > Do you plug in a listener to the CPM?
>> >
>> > Jerry C
>> >
>> > On Mon, Jan 18, 2010 at 3:42 PM, Radwen ANIBA <ar...@gmail.com>
>> wrote:
>> >
>> > > Hi ,
>> > >
>> > > My application run without any problem except at the end it shows this
>> > > message and I don't really know why
>> > >
>> > > Exception in thread "BaseCPMImpl-Thread"
>> java.lang.NullPointerException
>> > >    at
>> > >
>> org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
>> > >    at java.lang.Thread.run(Thread.java:619)
>> > >
>> > > And the process do not finish till I kill it
>> > >
>> > > Any idea ?
>> > >
>> > > Rad
>> > >
>> >
>>
>
>

Re: Error in My Application

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Rad, there was a bug in the CPM that I just fixed. The CPM was not checking
for null before adding a listener to an internal list. This led to the NPE
as you've reported. The new code should work now. If you dont want to update
from the SVN just dont call the addStatusCallbackListener(null). This would
be a workaround for the problem.

Jerry C

On Mon, Jan 18, 2010 at 3:59 PM, Radwen ANIBA <ar...@gmail.com> wrote:

> just before mCPE.process() i've added these
>
> StatusCallbackListener listner = null ;
>            mCPE.addStatusCallbackListener(listner);
>
> Is this wrong ?
>
> 2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>
>
> > Rad, looks like a bad reference to the Callback Listener:
> >
> >    ArrayList statusCbL = cpEngine.getCallbackListeners();
> >    // Notify all listeners that the CPM has finished processing
> >    for (int j = 0; j < statusCbL.size(); j++) {
> >      BaseStatusCallbackListener st = (BaseStatusCallbackListener)
> > statusCbL.get(j);
> >      if (!killed) {
> >        st.collectionProcessComplete();
> >      } else {
> >        st.aborted();
> >      }
> >    }
> >
> > Line 537: st.collectionProcessComplete();
> >
> > Do you plug in a listener to the CPM?
> >
> > Jerry C
> >
> > On Mon, Jan 18, 2010 at 3:42 PM, Radwen ANIBA <ar...@gmail.com> wrote:
> >
> > > Hi ,
> > >
> > > My application run without any problem except at the end it shows this
> > > message and I don't really know why
> > >
> > > Exception in thread "BaseCPMImpl-Thread" java.lang.NullPointerException
> > >    at
> > >
> org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
> > >    at java.lang.Thread.run(Thread.java:619)
> > >
> > > And the process do not finish till I kill it
> > >
> > > Any idea ?
> > >
> > > Rad
> > >
> >
>

Re: Error in My Application

Posted by Jörn Kottmann <ko...@gmail.com>.
Radwen ANIBA wrote:
> just before mCPE.process() i've added these
>
> StatusCallbackListener listner = null ;
>             mCPE.addStatusCallbackListener(listner);
>
> Is this wrong ?
>   
Yes, do not set it to null. You do not have to call the method
at all if you are not interested in the status.

Maybe we should throw an IllegalArgumentException in this
case, to make the code fail fast.

Jörn

Re: Error in My Application

Posted by Radwen ANIBA <ar...@gmail.com>.
just before mCPE.process() i've added these

StatusCallbackListener listner = null ;
            mCPE.addStatusCallbackListener(listner);

Is this wrong ?

2010/1/18 Jaroslaw Cwiklik <ui...@gmail.com>

> Rad, looks like a bad reference to the Callback Listener:
>
>    ArrayList statusCbL = cpEngine.getCallbackListeners();
>    // Notify all listeners that the CPM has finished processing
>    for (int j = 0; j < statusCbL.size(); j++) {
>      BaseStatusCallbackListener st = (BaseStatusCallbackListener)
> statusCbL.get(j);
>      if (!killed) {
>        st.collectionProcessComplete();
>      } else {
>        st.aborted();
>      }
>    }
>
> Line 537: st.collectionProcessComplete();
>
> Do you plug in a listener to the CPM?
>
> Jerry C
>
> On Mon, Jan 18, 2010 at 3:42 PM, Radwen ANIBA <ar...@gmail.com> wrote:
>
> > Hi ,
> >
> > My application run without any problem except at the end it shows this
> > message and I don't really know why
> >
> > Exception in thread "BaseCPMImpl-Thread" java.lang.NullPointerException
> >    at
> > org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
> >    at java.lang.Thread.run(Thread.java:619)
> >
> > And the process do not finish till I kill it
> >
> > Any idea ?
> >
> > Rad
> >
>

Re: Error in My Application

Posted by Jaroslaw Cwiklik <ui...@gmail.com>.
Rad, looks like a bad reference to the Callback Listener:

    ArrayList statusCbL = cpEngine.getCallbackListeners();
    // Notify all listeners that the CPM has finished processing
    for (int j = 0; j < statusCbL.size(); j++) {
      BaseStatusCallbackListener st = (BaseStatusCallbackListener)
statusCbL.get(j);
      if (!killed) {
        st.collectionProcessComplete();
      } else {
        st.aborted();
      }
    }

Line 537: st.collectionProcessComplete();

Do you plug in a listener to the CPM?

Jerry C

On Mon, Jan 18, 2010 at 3:42 PM, Radwen ANIBA <ar...@gmail.com> wrote:

> Hi ,
>
> My application run without any problem except at the end it shows this
> message and I don't really know why
>
> Exception in thread "BaseCPMImpl-Thread" java.lang.NullPointerException
>    at
> org.apache.uima.collection.impl.cpm.BaseCPMImpl.run(BaseCPMImpl.java:537)
>    at java.lang.Thread.run(Thread.java:619)
>
> And the process do not finish till I kill it
>
> Any idea ?
>
> Rad
>