I have tried the nightly snapshot below and the problem still exists there. 
Here is how you can reproduce it.

1. Download fresh copy and install
2. Edit conf/activemq.xml and change broker line to 
<broker xmlns="http://activemq.apache.org/schema/core"; brokerName="localhost" 
dataDirectory="${activemq.data}" schedulerSupport="true">

3. Go to admin console and create a topic, 
http://localhost:8161/admin/topics.jsp
4. Go to admin console and create durable subscriber to topic above 
http://localhost:8161/admin/subscribers.jsp
5. Delete the durable subscriber using link on same page and it will fail

Repeat all steps above but this time set schedulerSupport=false. Then it will 
delete the durable without any errors.

I looked at your unit test and it looks fine, all I can think of is running 
activemq from the usual way is behaving differently to the unit test somehow.

On 07/02/2014, at 3:41 PM, Christian Posta <christian.po...@gmail.com> wrote:

> Actually, I cannot reproduce this on trunk:
> 
> https://github.com/christian-posta/activemq/blob/AMQ-durable-sub-test/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQdurableSubTest.java#L50
> 
> 
> Can you try with a nightly snapshot?
> 
> https://repository.apache.org/content/repositories/snapshots/org/apache/activemq/apache-activemq/5.10-SNAPSHOT/
> 
> On Thu, Feb 6, 2014 at 5:21 PM, Christian Posta
> <christian.po...@gmail.com> wrote:
>> Looks like a bug..... Can you open a JIRA?
>> 
>> On Wed, Feb 5, 2014 at 9:39 PM, Minh Tran <minh.t...@winning.com.au> wrote:
>>> Hi,
>>> 
>>> Getting the following exception when attempting to delete the durable 
>>> subscriber in the admin console. Using 5.9.0.
>>> 
>>> 2014-02-06 15:25:44,042 | WARN  | /admin/deleteSubscriber.action | 
>>> org.eclipse.jetty.servlet.ServletHandler | qtp1100010806-60
>>> java.lang.ClassCastException: 
>>> org.apache.activemq.broker.scheduler.SchedulerBroker cannot be cast to 
>>> org.apache.activemq.broker.region.RegionBroker
>>>        at 
>>> org.apache.activemq.advisory.AdvisoryBroker.removeSubscription(AdvisoryBroker.java:280)
>>>        at 
>>> org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:112)
>>>        at 
>>> org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:112)
>>>        at 
>>> org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:112)
>>>        at 
>>> org.apache.activemq.broker.BrokerFilter.removeSubscription(BrokerFilter.java:112)
>>>        at 
>>> org.apache.activemq.broker.MutableBrokerFilter.removeSubscription(MutableBrokerFilter.java:117)
>>>        at 
>>> org.apache.activemq.broker.jmx.BrokerView.destroyDurableSubscriber(BrokerView.java:430)
>>>        at 
>>> org.apache.activemq.web.controller.DeleteSubscriber.handleRequest(DeleteSubscriber.java:38)
>>>        at 
>>> org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
>>>        at 
>>> org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
>>>        at 
>>> org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
>>>        at 
>>> org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
>>>        at 
>>> org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
>>>        at 
>>> org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:652)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1320)
>>>        at org.apache.activemq.web.AuditFilter.doFilter(AuditFilter.java:59)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
>>>        at 
>>> org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
>>>        at 
>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
>>>        at 
>>> org.apache.activemq.web.filter.ApplicationContextFilter.doFilter(ApplicationContextFilter.java:102)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
>>>        at 
>>> com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
>>>        at 
>>> com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1291)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:443)
>>>        at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
>>>        at 
>>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
>>>        at 
>>> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
>>>        at 
>>> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1044)
>>>        at 
>>> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:372)
>>>        at 
>>> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:189)
>>>        at 
>>> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:978)
>>>        at 
>>> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
>>>        at 
>>> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
>>>        at 
>>> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)
>>>        at 
>>> org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
>>>        at 
>>> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
>>>        at org.eclipse.jetty.server.Server.handle(Server.java:367)
>>>        at 
>>> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486)
>>>        at 
>>> org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
>>>        at 
>>> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
>>>        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:640)
>>>        at 
>>> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
>>>        at 
>>> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
>>>        at 
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
>>>        at 
>>> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
>>>        at 
>>> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
>>>        at 
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
>>>        at java.lang.Thread.run(Thread.java:695)
>>> 
>>> If I turn off the scheduler in activemq.xml, then this problem goes away so 
>>> it's related to the scheduler. This is a very nasty bug because without the 
>>> ability to delete durable subscribers, dormant durables will eventually 
>>> bring down the server. The offlineDurableSubcriberTimeout doesn't seem to 
>>> kill the durable subscriber either. Below is a config I use on the broker.
>>> 
>>> <broker xmlns="http://activemq.apache.org/schema/core"; 
>>> brokerName="localhost" dataDirectory="${activemq.data}" 
>>> offlineDurableSubscriberTimeout="172800000" 
>>> offlineDurableSubscriberTaskSchedule="3600000" schedulerSupport="true" 
>>> useJmx="true">
>>> 
>> 
>> 
>> 
>> --
>> Christian Posta
>> http://www.christianposta.com/blog
>> twitter: @christianposta
> 
> 
> 
> -- 
> Christian Posta
> http://www.christianposta.com/blog
> twitter: @christianposta

Reply via email to