uima-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaroslaw Cwiklik <uim...@gmail.com>
Subject Re: java.lang.NullPointerException when running fast client
Date Thu, 09 Feb 2012 14:37:21 GMT
Florin, your problem is that you are using one CAS instance with asynch
sendCAS(). Your main() is calling sendCAS(CAS) where the CAS is being
serialized. Serialization is an expensive operation and on a slow machine
may exceed your 100ms sleep. While the CAS is being serialized you calling
reset() on it causing NPE.
You should use synchronous sendAndReceive() instead of sendCAS().
Alternatively, wait for a service to reply before sending another CAS. UIMA
AS client allows you to plug in a callback listener which is called when a
reply is received.

Jerry C


On Thu, Feb 9, 2012 at 8:41 AM, Spico Florin <spicoflorin@gmail.com> wrote:

> Hello!
>  My UIMA AS client is using UimaAsynchronousEngine for sending messages to
> a UIMA pipeline. If the process of sending is fast (with 100 ms delay or
> without any delay) the attached exception(java.lang.NullPointerException)
> is thrown. Please advice. Thank you.
>  Regards,
>  Florin
>
> My code is:
>
>
> //constructor
> Client() {
>   cas = CasCreationUtils.createCas(uimaTypeDescriptors);
> }
>
> //main method
> main() {
>  Client client = new Client();
>  for (int i = 0; i < 100000; i++) {
>            System.out.println("Sending message #"+i);
>            client.sendToUIMA("Test message:"+i);
>            Thread.sleep(100);
>   }
> }
>
>  public void sendToUIMA(String msg) throws Exception {
>        JCas jcas = cas.getJCas();
>        jcas.reset();
>        jcas.setDocumentText(msg);
>        uimaEEEngine.sendCAS(jcas.getCas());
>
>
>    }
>
>
>
>
> org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl$2
> onMessage
> WARNING:
> java.lang.NullPointerException
>    at
>
> org.apache.uima.cas.impl.XmiCasDeserializer$XmiCasDeserializerHandler.handleFeature(XmiCasDeserializer.java:769)
>    at
>
> org.apache.uima.cas.impl.XmiCasDeserializer$XmiCasDeserializerHandler.readFS(XmiCasDeserializer.java:734)
>    at
>
> org.apache.uima.cas.impl.XmiCasDeserializer$XmiCasDeserializerHandler.readFS(XmiCasDeserializer.java:509)
>    at
>
> org.apache.uima.cas.impl.XmiCasDeserializer$XmiCasDeserializerHandler.startElement(XmiCasDeserializer.java:391)
>    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
> Source)
>    at
> org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
> Source)
>    at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)
>    at
>
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)
>    at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
>    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>    at
>
> org.apache.uima.aae.UimaSerializer.deserializeCasFromXmi(UimaSerializer.java:191)
>    at
>
> org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.deserialize(BaseUIMAAsynchronousEngineCommon_impl.java:1613)
>    at
>
> org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.deserializeCAS(BaseUIMAAsynchronousEngineCommon_impl.java:1646)
>    at
>
> org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.deserializeAndCompleteProcessingReply(BaseUIMAAsynchronousEngineCommon_impl.java:1883)
>    at
>
> org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl.handleProcessReply(BaseUIMAAsynchronousEngineCommon_impl.java:1208)
>    at
>
> org.apache.uima.adapter.jms.client.BaseUIMAAsynchronousEngineCommon_impl$2.run(BaseUIMAAsynchronousEngineCommon_impl.java:1714)
>    at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>    at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>    at java.lang.Thread.run(Thread.java:722)
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message