Camel Hive Issue

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Camel Hive Issue

VinothKR
Hi,
 I was trying to connect to hive through camel using jdbc and got IllegalMonitorStateException. In exchange i was able to see the data fetched from hive table but error was thrown when JDBCProducer tried to close the result set.

Logs:
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
[uaasRoute         ] [uaasRoute         ] [direct://hivein                                                               ] [      3690]
[uaasRoute         ] [setBody1          ] [setBody[constant{select * from uaas_cl_poc.proactive_gcplimit}]               ] [         0]
[uaasRoute         ] [to1               ] [jdbc:hive-ds?resetAutoCommit=false                                            ] [      3690]

Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
       Id                  ID-PHX2MYMV32-54123-1459807338148-0-2
       ExchangePattern     InOut
       Headers             {breadcrumbId=ID-PHX2MYMV32-54123-1459807338148-0-1, CamelRedelivered=false, CamelRedeliveryCounter=0}
       BodyType            String
       Body                select * from uaas_cl_poc.proactive_gcplimit
]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.lang.IllegalMonitorStateException
       at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
       at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
       at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
       at org.apache.hive.jdbc.HiveStatement.closeClientOperation(HiveStatement.java:177)
       at org.apache.hive.jdbc.HiveQueryResultSet.close(HiveQueryResultSet.java:293)
       at org.apache.camel.component.jdbc.JdbcProducer.closeQuietly(JdbcProducer.java:246)
       at org.apache.camel.component.jdbc.JdbcProducer.doCreateAndExecuteSqlStatement(JdbcProducer.java:236)
       at org.apache.camel.component.jdbc.JdbcProducer.createAndExecuteSqlStatement(JdbcProducer.java:123)
       at org.apache.camel.component.jdbc.JdbcProducer.processingSqlWithoutSettingAutoCommit(JdbcProducer.java:111)
       at org.apache.camel.component.jdbc.JdbcProducer.process(JdbcProducer.java:67)


Log showing data fetched from table:
Exception in thread "main" org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-PHX2MYMV32-54123-1459807338148-0-2][Message: [{proactive_gcplimit.spend=100.0, proactive_gcplimit.pd=10.0, proactive_gcplimit.ead=10.0, proactive_gcplimit.lgd=12345.0, proactive_gcplimit.obligorid=23456, proactive_gcplimit.caseid=null, proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.09, proactive_gcplimit.sic=corp, proactive_gcplimit.final_rating=null, proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null}, {proactive_gcplimit.spend=90.0, proactive_gcplimit.pd=9.0, proactive_gcplimit.ead=9.0, proactive_gcplimit.lgd=12346.0, proactive_gcplimit.obligorid=23457, proactive_gcplimit.caseid=null, proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.01, proactive_gcplimit.sic=obl, proactive_gcplimit.final_rating=null, proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null}]]
       at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1658)
       at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:646)
       at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)
       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)
       at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)
       at aexp.uaas.camel.standalone.StandaloneTest.main(StandaloneTest.java:23)
Caused by: java.lang.IllegalMonitorStateException
       at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)


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

Camel Route:
<route id="uaasRoute">
<from uri="direct:hivein"/>
<setBody>
<constant>select * from uaas_cl_poc.proactive_gcplimit</constant>
</setBody>
<to uri="jdbc:hive-ds?resetAutoCommit=false"/>
<to uri="mock:result"/>
</route>

Hive Datasource Bean

<bean id="hive-driver" class="org.apache.hadoop.hive.jdbc.HiveDriver" />

<bean id="hive-ds"
        class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="org.apache.hive.jdbc.HiveDriver" />
<property name="url"
        value="jdbc:hive2://url" />
<property name="username" value="uname" />
<property name="password" value="pwd" />
</bean>

Java Code:
CamelContext camel = SpringCamelContext.springCamelContext(appContext);
ProducerTemplate template = camel.createProducerTemplate();
camel.start();
Object out = template.requestBody("direct:hivein","Test");
System.out.println(out);
camel.stop();

Please assist.
Thanks,
Vinoth.
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

Claus Ibsen-2
What version of Camel do you use?

On Tue, Apr 5, 2016 at 9:13 PM, VinothKR <[hidden email]> wrote:

> Hi,
>  I was trying to connect to hive through camel using jdbc and got
> IllegalMonitorStateException. In exchange i was able to see the data fetched
> from hive table but error was thrown when JDBCProducer tried to close the
> result set.
>
> *Logs:*
> Message History
> ---------------------------------------------------------------------------------------------------------------------------------------
> RouteId              ProcessorId          Processor
> Elapsed (ms)
> [uaasRoute         ] [uaasRoute         ] [direct://hivein
> ] [      3690]
> [uaasRoute         ] [setBody1          ] [setBody[constant{select * from
> uaas_cl_poc.proactive_gcplimit}]               ] [         0]
> [uaasRoute         ] [to1               ]
> [jdbc:hive-ds?resetAutoCommit=false
> ] [      3690]
>
> Exchange
> ---------------------------------------------------------------------------------------------------------------------------------------
> Exchange[
>        Id                  ID-PHX2MYMV32-54123-1459807338148-0-2
>        ExchangePattern     InOut
>        Headers
> {breadcrumbId=ID-PHX2MYMV32-54123-1459807338148-0-1, CamelRedelivered=false,
> CamelRedeliveryCounter=0}
>        BodyType            String
>        Body                select * from uaas_cl_poc.proactive_gcplimit
> ]
>
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
> java.lang.IllegalMonitorStateException
>        at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown
> Source)
>        at
> java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown
> Source)
>        at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
>        at
> org.apache.hive.jdbc.HiveStatement.closeClientOperation(HiveStatement.java:177)
>        at
> org.apache.hive.jdbc.HiveQueryResultSet.close(HiveQueryResultSet.java:293)
>        at
> org.apache.camel.component.jdbc.JdbcProducer.closeQuietly(JdbcProducer.java:246)
>        at
> org.apache.camel.component.jdbc.JdbcProducer.doCreateAndExecuteSqlStatement(JdbcProducer.java:236)
>        at
> org.apache.camel.component.jdbc.JdbcProducer.createAndExecuteSqlStatement(JdbcProducer.java:123)
>        at
> org.apache.camel.component.jdbc.JdbcProducer.processingSqlWithoutSettingAutoCommit(JdbcProducer.java:111)
>        at
> org.apache.camel.component.jdbc.JdbcProducer.process(JdbcProducer.java:67)
>
>
> Log showing data fetched from table:
> Exception in thread "main" org.apache.camel.CamelExecutionException:
> Exception occurred during execution on the exchange:
> Exchange[ID-PHX2MYMV32-54123-1459807338148-0-2][Message:
> [{proactive_gcplimit.spend=100.0, proactive_gcplimit.pd=10.0,
> proactive_gcplimit.ead=10.0, proactive_gcplimit.lgd=12345.0,
> proactive_gcplimit.obligorid=23456, proactive_gcplimit.caseid=null,
> proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.09,
> proactive_gcplimit.sic=corp, proactive_gcplimit.final_rating=null,
> proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null},
> {proactive_gcplimit.spend=90.0, proactive_gcplimit.pd=9.0,
> proactive_gcplimit.ead=9.0, proactive_gcplimit.lgd=12346.0,
> proactive_gcplimit.obligorid=23457, proactive_gcplimit.caseid=null,
> proactive_gcplimit.timestamp=null, proactive_gcplimit.source=0.01,
> proactive_gcplimit.sic=obl, proactive_gcplimit.final_rating=null,
> proactive_gcplimit.cid_level=null, proactive_gcplimit.mkt_code=null}]]
>        at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1658)
>        at
> org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:646)
>        at
> org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:471)
>        at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:133)
>        at
> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:149)
>        at
> org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:301)
>        at
> aexp.uaas.camel.standalone.StandaloneTest.main(StandaloneTest.java:23)
> Caused by: java.lang.IllegalMonitorStateException
>        at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown
> Source)
>
>
> ----------------------------------------------------------------------------------------------------------------
>
> *Camel Route:*
> <route id="uaasRoute">
> <from uri="direct:hivein"/>
> <setBody>
> <constant>select * from uaas_cl_poc.proactive_gcplimit</constant>
> </setBody>
> <to uri="jdbc:hive-ds?resetAutoCommit=false"/>
> <to uri="mock:result"/>
> </route>
>
> *Hive Datasource Bean*
>
> <bean id="hive-driver" class="org.apache.hadoop.hive.jdbc.HiveDriver" />
>
> <bean id="hive-ds"
>         class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
> <property name="driverClass" value="org.apache.hive.jdbc.HiveDriver" />
> <property name="url"
>         value="jdbc:hive2://url" />
> <property name="username" value="uname" />
> <property name="password" value="pwd" />
> </bean>
>
> *Java Code:*
> CamelContext camel = SpringCamelContext.springCamelContext(appContext);
> ProducerTemplate template = camel.createProducerTemplate();
> camel.start();
> Object out = template.requestBody("direct:hivein","Test");
> System.out.println(out);
> camel.stop();
>
> Please assist.
> Thanks,
> Vinoth.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Hive-Issue-tp5780522.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

VinothKR
It is camel 2.16.1 version
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

VinothKR
I was able to make it work with a older version of camel 2.13.2. But with the 2.16.1 version it is throwing this issue.
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

VinothKR
I was able to make it work with a older version of camel 2.13.2. But with the 2.16.1 version it is throwing this issue. Ideally I would be happy to upgrade to a newer version of Camel if this issue could be addressed using any higher version, instead of reverting back to a previous one.
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

Claus Ibsen-2
Hi

I logged a ticket to avoid attempting to close if already closed
https://issues.apache.org/jira/browse/CAMEL-9845



On Wed, Apr 6, 2016 at 7:43 PM, VinothKR <[hidden email]> wrote:

> I was able to make it work with a older version of camel 2.13.2. But with the
> 2.16.1 version it is throwing this issue. Ideally I would be happy to
> upgrade to a newer version of Camel if this issue could be addressed using
> any higher version, instead of reverting back to a previous one.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-Hive-Issue-tp5780522p5780614.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

VinothKR
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Camel Hive Issue

VinothKR
Hi Claus,
The latest version available in Maven in 2.17.0
Can you please publish the resolving code to 2.17.0 version as well.

Thanks,
Vinoth.