camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MichaelAtSAG <mebevilac...@gmail.com>
Subject java.lang.ArrayIndexOutOfBoundsException when receiving from JMS
Date Tue, 03 Dec 2013 18:55:44 GMT
Hello,

This application connects to JMS and routes the message to a websocket
endpoint. Every 15th message or so, the following exception is raised:

Exception:

[Camel (TwitterApp1) thread #1 -
JmsConsumer[Event::WebM::Communication::Twitter::1.1::TweetReceived]]
EndpointMessageListener                  WARN  Execution of JMS message
listener failed. Caused by: [org.apache.camel.RuntimeCamelException -
java.lang.ArrayIndexOutOfBoundsException]
org.apache.camel.RuntimeCamelException:
java.lang.ArrayIndexOutOfBoundsException
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1344)
	at
org.apache.camel.component.jms.EndpointMessageListener$EndpointMessageListenerAsyncCallback.done(EndpointMessageListener.java:186)
	at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:107)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:562)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:500)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:468)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1096)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1088)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:985)
	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)
Caused by: java.lang.ArrayIndexOutOfBoundsException


Route:

    <beans profile="TwitterApp">
        <camelContext id="TwitterApp1"
xmlns="http://camel.apache.org/schema/spring" autoStartup="true">

            <propertyPlaceholder id="twitterProperties"
location="twitterApp.properties" />

            <endpoint id="webappWebsocketNERVEndpointOut"
uri="websocket://{{wsHost}}:{{wsPort}}/nerv-tweet-fromJMS?staticResources=classpath:.&amp;sendToAll=true"
/>

            
            <endpoint id="twitterProducer"
               
uri="twitter://timeline/user?consumerKey={{consumerKey}}&amp;consumerSecret={{consumerSecret}}&amp;accessToken={{accessToken}}&amp;accessTokenSecret={{accessTokenSecret}}"
/>

            <onException>
               
<exception>org.apache.camel.RuntimeCamelException</exception>
               
<exception>java.lang.ArrayIndexOutOfBoundsException</exception>
                <handled>
                    <constant>true</constant>
                </handled>
                <to id="streamOut" uri="stream:out" />
                <transform>
                    <simple>In exception loop!</simple>
                </transform>
                <to id="streamOutSimple" uri="stream:out" />
            </onException>

            <route id="TweetReceivedFromJMS">

                <from id="NERVJMS1"
uri="nervJMS1:topic:Event::WebM::Communication::Twitter::1.1::TweetReceived"
/>
                
                
                <transform>
                    <simple>JMS Channel processing tweet event from
@${header.Status$User$ScreenName} at ${header.$Event$Start}</simple>
                </transform>
                
                <to uri="webappWebsocketNERVEndpointOut" />
            </route>

        </camelContext>

NERVJMS1 bean:


<?xml version="1.0" encoding="UTF-8"?>
<beans  xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd 
            http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

    <beans profile="suite-wide">

        <bean id="nervJMS1"
class="org.apache.camel.component.jms.JmsComponent">
            <property name="connectionFactory" ref="cachedConnectionFactory"
/>
            <property name="destinationResolver"
ref="defaultDestinationResolver" />
        </bean>

        <bean id="cachedConnectionFactory"
class="org.springframework.jms.connection.CachingConnectionFactory">
            <property name="targetConnectionFactory"
ref="jndiObjectFactoryBean" />
            <property name="sessionCacheSize" value="2000" />
            <property name="cacheProducers" value="false" />
        </bean>

        <bean id="jndiObjectFactoryBean"
class="org.springframework.jndi.JndiObjectFactoryBean"
depends-on="defaultDestinationResolver">
            <property name="jndiTemplate" ref="jndiTemplateNirvana" />
            <property name="jndiName" ref="eventFactory" />
        </bean>

        <bean id="defaultDestinationResolver"
class="com.softwareag.eda.jndi.NervResolver"
depends-on="jndiTemplateNirvana" init-method="init">
            <property name="jndiTemplate" ref="jndiTemplateNirvana" />
            <property name="classLoader">
                <null />
            </property>
        </bean>

        <bean id="jndiTemplateNirvana"
class="org.springframework.jndi.JndiTemplate">
            <property name="environment">
                <map>
                    <entry key="java.naming.factory.initial"
value="com.pcbsys.nirvana.nSpace.NirvanaContextFactory" />
                    <entry key="java.naming.provider.url"
value="nsp://localhost:9000" />
                    <entry key="connectionFactory" value-ref="eventFactory"
/>
                </map>
            </property>
        </bean>

        <bean id="eventFactory" class="java.lang.String">
            <constructor-arg value="EventFactory" />
        </bean>

    </beans>

</beans>

Two questions:

1. How to prevent the exception from happening?
2. Why does the exception handler not capture the exception?



--
View this message in context: http://camel.465427.n5.nabble.com/java-lang-ArrayIndexOutOfBoundsException-when-receiving-from-JMS-tp5744262.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message