You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <ci...@silverbullet.dk> on 2008/09/02 19:55:40 UTC

RE: Async error occurred: java.lang.IllegalStateException when trying to create a basic unit test

Hi Ryan

Are you still having problem with this? Have you checked the source code in 
ActiveMQDestination.java:313 that could give a hint what code the NPE is caused by.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Ryan Gardner [mailto:ryebrye@gmail.com] 
Sent: 29. august 2008 07:34
To: camel-user@activemq.apache.org
Subject: Async error occurred: java.lang.IllegalStateException when trying to create a basic unit test


I'm trying to get my feet wet with Camel - so one of the first things I've
done is create a unit test. 

When the test runs, here's the exception I'm getting:

23:08:07,175 ERROR Service:277 - Async error occurred:
java.lang.NullPointerException
java.lang.NullPointerException
	at
org.apache.activemq.command.ActiveMQDestination.hashCode(ActiveMQDestination.java:313)
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
	at
org.apache.activemq.broker.region.RegionBroker.addDestination(RegionBroker.java:256)
	at
org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:141)
	at
org.apache.activemq.advisory.AdvisoryBroker.addDestination(AdvisoryBroker.java:147)
	at
org.apache.activemq.broker.BrokerFilter.addDestination(BrokerFilter.java:141)
	at
org.apache.activemq.broker.MutableBrokerFilter.addDestination(MutableBrokerFilter.java:148)
	at
org.apache.activemq.broker.region.RegionBroker.addProducer(RegionBroker.java:338)
	at
org.apache.activemq.broker.BrokerFilter.addProducer(BrokerFilter.java:89)
	at
org.apache.activemq.advisory.AdvisoryBroker.addProducer(AdvisoryBroker.java:136)
	at
org.apache.activemq.broker.CompositeDestinationBroker.addProducer(CompositeDestinationBroker.java:56)
	at
org.apache.activemq.broker.MutableBrokerFilter.addProducer(MutableBrokerFilter.java:96)
	at
org.apache.activemq.broker.TransportConnection.processAddProducer(TransportConnection.java:487)
	at org.apache.activemq.command.ProducerInfo.visit(ProducerInfo.java:105)
	at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)
	at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:180)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:104)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:205)
	at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
	at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:637)
23:08:07,183 ERROR Service:277 - Async error occurred:
java.lang.IllegalStateException: Cannot remove a producer that had not been
registered: ID:RyanGardner.local-59513-1219986477776-2:2:1:1
java.lang.IllegalStateException: Cannot remove a producer that had not been
registered: ID:RyanGardner.local-59513-1219986477776-2:2:1:1
	at
org.apache.activemq.broker.TransportConnection.processRemoveProducer(TransportConnection.java:509)
	at org.apache.activemq.command.RemoveInfo.visit(RemoveInfo.java:66)
	at
org.apache.activemq.broker.TransportConnection.service(TransportConnection.java:292)
	at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:180)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:104)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:68)
	at
org.apache.activemq.transport.vm.VMTransport.iterate(VMTransport.java:205)
	at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
	at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:637)

I've posted the whole debug log of the test leading up to that exception
here: 

http://pastebin.us/?show=f6e887a7f

What I'm doing in my test is pulling out a bean that is configured to take a
simple bean, grab a Spring jmsTemplate that is injected into it - and call a
convertAndSend with that bean to a destination. 

So I set up (what I thought) was a simple spring-based configuration for my
camel context:

http://pastebin.us/?show=f5b23a95e 

Then I created (what I hoped) would be a simple unit test: 

http://pastebin.us/?show=f225daceb

I'm new to Camel - so if anyone has any ideas what I'm doing wrong, I'd
appreciate it. 

Here's the versions I'm running against (I switched to 1.5-SNAPSHOT after I
couldn't get 1.4.0 to work... I'll probably switch back to 1.4.0)

<!-- required by both client and server -->
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>1.5-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-jms</artifactId>
        <version>1.5-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-spring</artifactId>
        <version>1.5-SNAPSHOT</version>
    </dependency>
      
    <!-- activeMQ used for messaging -->
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-core</artifactId>
      <version>5.1.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.xbean</groupId>
        <artifactId>xbean-spring</artifactId>
        <version>3.4.3</version>
    </dependency>

-- 
View this message in context: http://www.nabble.com/Async-error-occurred%3A-java.lang.IllegalStateException-when-trying-to-create-a-basic-unit-test-tp19213944s22882p19213944.html
Sent from the Camel - Users mailing list archive at Nabble.com.