You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2009/03/24 15:38:45 UTC

javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session

Hello,

I wrote a small Apache Camel UIMA AS driver component to send
a URI to my processing pipeline. It then uses the URI to retrieve
the actual CAS from a hbase database and after processing is
done the CAS is written back to hbase, like it is described in the 
getting started.

I first created a small sample which worked fine for me,
but now always this exception is thrown:

javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be 
used for an non-transacted Session
    at 
org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:300)
    at 
org.apache.uima.adapter.jms.client.ActiveMQMessageSender.initializeProducer(ActiveMQMessageSender.java:61)
    at 
org.apache.uima.adapter.jms.client.BaseMessageSender.run(BaseMessageSender.java:141)
    at java.lang.Thread.run(Thread.java:619)


In my eyes the cause for the exception is this call in ActiveMQMessageSender
line 61: session = connection.createSession(false, 0);

We try to create a transcated session (thats what 0 stands for) and set 
transacted to false,
which is invalid usage of the API, right ? The same call can be found in 
the trunk version
of that class.

I really wonder why it worked first for me, but breaks now.

Jörn

Re: javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session

Posted by Eddie Epstein <ea...@gmail.com>.
Hi Jörn,

Unless you did an SVN update, I don't understand how it worked
and then didn't. I also don't understand how Apache Camel is
being used.

The UIMA AS client API handles all JMS interactions transparently.
A minimal application calling a UIMA AS service would look
something like this:
-------------------------------
    uimaEEEngine = new BaseUIMAAsynchronousEngine_impl();
    Map<String,Object> appCtx = new HashMap<String,Object>();
    // Add Broker URI
    appCtx.put(UimaAsynchronousEngine.ServerUri, brokerUrl);
    // Add Queue Name
    appCtx.put(UimaAsynchronousEngine.Endpoint, endpoint);
    // Add the Cas Pool Size
    appCtx.put(UimaAsynchronousEngine.CasPoolSize, casPoolSize);
    //initialize
    uimaEEEngine.initialize(appCtx);

    // Loop
    {
       // get an empty CAS
       CAS cas = uimaEEEngine.getCAS();

       // initialize CAS ...

       // call service asynchronously
       uimaEEEngine.sendCAS(cas);
     }

-------------------------------------------------------

The loop will block waiting for an empty CAS, so the cas pool
size should be at least as big as the number of service instances.

Can you give more details of the client code? Can you use
the test application driver, runRemoteAsyncAE to test the service?

Regards,
Eddie


On Tue, Mar 24, 2009 at 10:38 AM, Jörn Kottmann <ko...@gmail.com> wrote:
> Hello,
>
> I wrote a small Apache Camel UIMA AS driver component to send
> a URI to my processing pipeline. It then uses the URI to retrieve
> the actual CAS from a hbase database and after processing is
> done the CAS is written back to hbase, like it is described in the getting
> started.
>
> I first created a small sample which worked fine for me,
> but now always this exception is thrown:
>
> javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used
> for an non-transacted Session
>   at
> org.apache.activemq.ActiveMQConnection.createSession(ActiveMQConnection.java:300)
>   at
> org.apache.uima.adapter.jms.client.ActiveMQMessageSender.initializeProducer(ActiveMQMessageSender.java:61)
>   at
> org.apache.uima.adapter.jms.client.BaseMessageSender.run(BaseMessageSender.java:141)
>   at java.lang.Thread.run(Thread.java:619)
>
>
> In my eyes the cause for the exception is this call in ActiveMQMessageSender
> line 61: session = connection.createSession(false, 0);
>
> We try to create a transcated session (thats what 0 stands for) and set
> transacted to false,
> which is invalid usage of the API, right ? The same call can be found in the
> trunk version
> of that class.
>
> I really wonder why it worked first for me, but breaks now.
>
> Jörn
>

Re: javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session

Posted by Jörn Kottmann <ko...@gmail.com>.
Eddie Epstein wrote:
> Is the AMQ broker different when running with runRemoteAsyncAE versus when
> running inside a camel component? Perhaps the camel broker is setup to require
> transactional context, unlike the UIMA AS broker configuration. If
> this is it, try
> running a separate broker for UIMA AS.
>   

Its the same AMQ broker. Do not you thing the call we do inside
the UIMA AS code is incorrect ?

connection.createSession(false, 0);

For me it looks like a conflict to say disable to transacted and enable
transacted the same time, don't you think so ?

Jörn

Re: javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session

Posted by Eddie Epstein <ea...@gmail.com>.
Is the AMQ broker different when running with runRemoteAsyncAE versus when
running inside a camel component? Perhaps the camel broker is setup to require
transactional context, unlike the UIMA AS broker configuration. If
this is it, try
running a separate broker for UIMA AS.

Eddie


On Thu, Mar 26, 2009 at 6:01 AM, Jörn Kottmann <ko...@gmail.com> wrote:
>> Can you use
>> the test application driver, runRemoteAsyncAE to test the service?
>
> yes
>
> Jörn
>

Re: javax.jms.JMSException: acknowledgeMode SESSION_TRANSACTED cannot be used for an non-transacted Session

Posted by Jörn Kottmann <ko...@gmail.com>.
> Unless you did an SVN update, I don't understand how it worked
> and then didn't. I also don't understand how Apache Camel is
> being used.

I used the 2.2.2 release code for my test, but the invalid API call
is also in the current trunk.

In camel the string body of the in message is copied to the CAS object,
it is expect that the string body is a URI which can be used to retrieve
an actual CAS from hbase in a CAS Multiplier.

> The UIMA AS client API handles all JMS interactions transparently.
> A minimal application calling a UIMA AS service would look
> something like this:
> -------------------------------
>    uimaEEEngine = new BaseUIMAAsynchronousEngine_impl();
>    Map<String,Object> appCtx = new HashMap<String,Object>();
>    // Add Broker URI
>    appCtx.put(UimaAsynchronousEngine.ServerUri, brokerUrl);
>    // Add Queue Name
>    appCtx.put(UimaAsynchronousEngine.Endpoint, endpoint);
>    // Add the Cas Pool Size
>    appCtx.put(UimaAsynchronousEngine.CasPoolSize, casPoolSize);
>    //initialize
>    uimaEEEngine.initialize(appCtx);

My code looks like this and prints out the exception in the initialize 
method.

It only fails if it runs as camel component, for some strange reason.

>    // Loop
>    {
>       // get an empty CAS
>       CAS cas = uimaEEEngine.getCAS();
>
>       // initialize CAS ...
>
>       // call service asynchronously
>       uimaEEEngine.sendCAS(cas);
>     }
>
> -------------------------------------------------------
>
> The loop will block waiting for an empty CAS, so the cas pool
> size should be at least as big as the number of service instances.

Does UIMA AS waits with sending back the input CAS with the URI until 
the new
CAS which is created in the CAS Multiplier is processed successful ?

>
> Can you give more details of the client code?
Here is my client code:

        uimaAsEngine =
            new BaseUIMAAsynchronousEngine_impl();
       
        uimaAsEngine.addStatusCallbackListener(new 
UimaStatusCallbackListener());

        Map<String,Object> appCtx = new HashMap<String,Object>();
        appCtx.put(UimaAsynchronousEngine.ServerUri, "tcp://karkand:61616");
        appCtx.put(UimaAsynchronousEngine.Endpoint, "TextAnalysisQueue");
        appCtx.put(UimaAsynchronousEngine.CasPoolSize, 1);

        uimaAsEngine.initialize(appCtx);

> Can you use
> the test application driver, runRemoteAsyncAE to test the service?
yes

Jörn