You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Brian Stiles (JIRA)" <ji...@apache.org> on 2010/07/13 19:18:51 UTC

[jira] Created: (CAMEL-2942) CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet

CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet
-------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-2942
                 URL: https://issues.apache.org/activemq/browse/CAMEL-2942
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-servlet
    Affects Versions: 2.3.0
            Reporter: Brian Stiles


CamelHttpTransportServlet.destroy removes the servlet from a static map named CAMEL_SERVLET_MAP prior to stopping its associated Spring application context.  If that context defines a route using a servletEndpoint, the route is shutdown AFTER the servlet is removed from the map.  The shutdown code then looks for the servlet in the map by calling CamelHttpTransportServlet.getCamelServlet.  The servlet can't be found, and the ensuing exception is logged (copied below).

It seems to me that CamelHttpTransportServlet.destroy should be defined like this:
    
    public void destroy() {
        // Removal was here
        if (applicationContext != null) {
            applicationContext.stop();
        }
        // Moved the removal to here
        CAMEL_SERVLET_MAP.remove(servletName);
    }

so that the servlet is removed from the map after the context is stopped.

I know for sure that removal of the servlet from the map before the context is stopped causes this problem when my route is shutdown.  I DON'T know for sure that my overall configuration is correct, though I think it is valid.

If the above change is not obviously correct, or if there are further questions, please let me know, and I'll work up a sample that demonstrates the problem to help answer any questions.

--

2010-07-13 09:06:23,918 [Camel Thread 0 - ShutdownTask] WARN  org.apache.camel.impl.DefaultShutdownStrategy at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:219)
         Error occurred while shutting down route: Consumer[/relay]. This exception will be ignored.
java.lang.IllegalArgumentException: Cannot find the deployed servlet, please configure the ServletComponent or configure a org.apache.camel.component.servlet.CamelHttpTransportServlet servlet in web.xml 
	at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
	at org.apache.camel.component.servlet.ServletComponent.disconnect(ServletComponent.java:116)
	at org.apache.camel.component.http.HttpEndpoint.disconnect(HttpEndpoint.java:152)
	at org.apache.camel.component.http.HttpConsumer.doStop(HttpConsumer.java:56)
	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:86)
	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:107)
	at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:100)
	at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:217)
	at org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:413)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:637)



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-2942) CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-2942.
---------------------------------

    Fix Version/s: 2.5.0
       Resolution: Fixed

Committed the patch with thanks to Brian.

> CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2942
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2942
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-servlet
>    Affects Versions: 2.3.0
>            Reporter: Brian Stiles
>            Assignee: Willem Jiang
>             Fix For: 2.5.0
>
>
> CamelHttpTransportServlet.destroy removes the servlet from a static map named CAMEL_SERVLET_MAP prior to stopping its associated Spring application context.  If that context defines a route using a servletEndpoint, the route is shutdown AFTER the servlet is removed from the map.  The shutdown code then looks for the servlet in the map by calling CamelHttpTransportServlet.getCamelServlet.  The servlet can't be found, and the ensuing exception is logged (copied below).
> It seems to me that CamelHttpTransportServlet.destroy should be defined like this:
>     
>     public void destroy() {
>         // Removal was here
>         if (applicationContext != null) {
>             applicationContext.stop();
>         }
>         // Moved the removal to here
>         CAMEL_SERVLET_MAP.remove(servletName);
>     }
> so that the servlet is removed from the map after the context is stopped.
> I know for sure that removal of the servlet from the map before the context is stopped causes this problem when my route is shutdown.  I DON'T know for sure that my overall configuration is correct, though I think it is valid.
> If the above change is not obviously correct, or if there are further questions, please let me know, and I'll work up a sample that demonstrates the problem to help answer any questions.
> --
> 2010-07-13 09:06:23,918 [Camel Thread 0 - ShutdownTask] WARN  org.apache.camel.impl.DefaultShutdownStrategy at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:219)
>          Error occurred while shutting down route: Consumer[/relay]. This exception will be ignored.
> java.lang.IllegalArgumentException: Cannot find the deployed servlet, please configure the ServletComponent or configure a org.apache.camel.component.servlet.CamelHttpTransportServlet servlet in web.xml 
> 	at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
> 	at org.apache.camel.component.servlet.ServletComponent.disconnect(ServletComponent.java:116)
> 	at org.apache.camel.component.http.HttpEndpoint.disconnect(HttpEndpoint.java:152)
> 	at org.apache.camel.component.http.HttpConsumer.doStop(HttpConsumer.java:56)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:86)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:107)
> 	at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:100)
> 	at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:217)
> 	at org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:413)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:637)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2942) CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet

Posted by "Brian Stiles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60640#action_60640 ] 

Brian Stiles commented on CAMEL-2942:
-------------------------------------

Fantastic.  Thanks for the quick response!

> CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2942
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2942
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-servlet
>    Affects Versions: 2.3.0
>            Reporter: Brian Stiles
>            Assignee: Willem Jiang
>             Fix For: 2.5.0
>
>
> CamelHttpTransportServlet.destroy removes the servlet from a static map named CAMEL_SERVLET_MAP prior to stopping its associated Spring application context.  If that context defines a route using a servletEndpoint, the route is shutdown AFTER the servlet is removed from the map.  The shutdown code then looks for the servlet in the map by calling CamelHttpTransportServlet.getCamelServlet.  The servlet can't be found, and the ensuing exception is logged (copied below).
> It seems to me that CamelHttpTransportServlet.destroy should be defined like this:
>     
>     public void destroy() {
>         // Removal was here
>         if (applicationContext != null) {
>             applicationContext.stop();
>         }
>         // Moved the removal to here
>         CAMEL_SERVLET_MAP.remove(servletName);
>     }
> so that the servlet is removed from the map after the context is stopped.
> I know for sure that removal of the servlet from the map before the context is stopped causes this problem when my route is shutdown.  I DON'T know for sure that my overall configuration is correct, though I think it is valid.
> If the above change is not obviously correct, or if there are further questions, please let me know, and I'll work up a sample that demonstrates the problem to help answer any questions.
> --
> 2010-07-13 09:06:23,918 [Camel Thread 0 - ShutdownTask] WARN  org.apache.camel.impl.DefaultShutdownStrategy at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:219)
>          Error occurred while shutting down route: Consumer[/relay]. This exception will be ignored.
> java.lang.IllegalArgumentException: Cannot find the deployed servlet, please configure the ServletComponent or configure a org.apache.camel.component.servlet.CamelHttpTransportServlet servlet in web.xml 
> 	at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
> 	at org.apache.camel.component.servlet.ServletComponent.disconnect(ServletComponent.java:116)
> 	at org.apache.camel.component.http.HttpEndpoint.disconnect(HttpEndpoint.java:152)
> 	at org.apache.camel.component.http.HttpConsumer.doStop(HttpConsumer.java:56)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:86)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:107)
> 	at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:100)
> 	at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:217)
> 	at org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:413)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:637)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-2942) CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-2942:
-----------------------------------

    Assignee: Willem Jiang

> CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2942
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2942
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-servlet
>    Affects Versions: 2.3.0
>            Reporter: Brian Stiles
>            Assignee: Willem Jiang
>
> CamelHttpTransportServlet.destroy removes the servlet from a static map named CAMEL_SERVLET_MAP prior to stopping its associated Spring application context.  If that context defines a route using a servletEndpoint, the route is shutdown AFTER the servlet is removed from the map.  The shutdown code then looks for the servlet in the map by calling CamelHttpTransportServlet.getCamelServlet.  The servlet can't be found, and the ensuing exception is logged (copied below).
> It seems to me that CamelHttpTransportServlet.destroy should be defined like this:
>     
>     public void destroy() {
>         // Removal was here
>         if (applicationContext != null) {
>             applicationContext.stop();
>         }
>         // Moved the removal to here
>         CAMEL_SERVLET_MAP.remove(servletName);
>     }
> so that the servlet is removed from the map after the context is stopped.
> I know for sure that removal of the servlet from the map before the context is stopped causes this problem when my route is shutdown.  I DON'T know for sure that my overall configuration is correct, though I think it is valid.
> If the above change is not obviously correct, or if there are further questions, please let me know, and I'll work up a sample that demonstrates the problem to help answer any questions.
> --
> 2010-07-13 09:06:23,918 [Camel Thread 0 - ShutdownTask] WARN  org.apache.camel.impl.DefaultShutdownStrategy at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:219)
>          Error occurred while shutting down route: Consumer[/relay]. This exception will be ignored.
> java.lang.IllegalArgumentException: Cannot find the deployed servlet, please configure the ServletComponent or configure a org.apache.camel.component.servlet.CamelHttpTransportServlet servlet in web.xml 
> 	at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
> 	at org.apache.camel.component.servlet.ServletComponent.disconnect(ServletComponent.java:116)
> 	at org.apache.camel.component.http.HttpEndpoint.disconnect(HttpEndpoint.java:152)
> 	at org.apache.camel.component.http.HttpConsumer.doStop(HttpConsumer.java:56)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:86)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:107)
> 	at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:100)
> 	at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:217)
> 	at org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:413)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:637)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-2942) CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-2942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=60639#action_60639 ] 

Willem Jiang commented on CAMEL-2942:
-------------------------------------

Yeah, we need to remove the the ServletMap after the application context is stopped.
Thanks for pointing that out, I will commit the fix shortly.


> CamelHttpTransportServlet.destroy causes java.lang.IllegalArgumentException: Cannot find the deployed servlet
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-2942
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-2942
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-servlet
>    Affects Versions: 2.3.0
>            Reporter: Brian Stiles
>            Assignee: Willem Jiang
>
> CamelHttpTransportServlet.destroy removes the servlet from a static map named CAMEL_SERVLET_MAP prior to stopping its associated Spring application context.  If that context defines a route using a servletEndpoint, the route is shutdown AFTER the servlet is removed from the map.  The shutdown code then looks for the servlet in the map by calling CamelHttpTransportServlet.getCamelServlet.  The servlet can't be found, and the ensuing exception is logged (copied below).
> It seems to me that CamelHttpTransportServlet.destroy should be defined like this:
>     
>     public void destroy() {
>         // Removal was here
>         if (applicationContext != null) {
>             applicationContext.stop();
>         }
>         // Moved the removal to here
>         CAMEL_SERVLET_MAP.remove(servletName);
>     }
> so that the servlet is removed from the map after the context is stopped.
> I know for sure that removal of the servlet from the map before the context is stopped causes this problem when my route is shutdown.  I DON'T know for sure that my overall configuration is correct, though I think it is valid.
> If the above change is not obviously correct, or if there are further questions, please let me know, and I'll work up a sample that demonstrates the problem to help answer any questions.
> --
> 2010-07-13 09:06:23,918 [Camel Thread 0 - ShutdownTask] WARN  org.apache.camel.impl.DefaultShutdownStrategy at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:219)
>          Error occurred while shutting down route: Consumer[/relay]. This exception will be ignored.
> java.lang.IllegalArgumentException: Cannot find the deployed servlet, please configure the ServletComponent or configure a org.apache.camel.component.servlet.CamelHttpTransportServlet servlet in web.xml 
> 	at org.apache.camel.component.servlet.ServletComponent.getCamelServlet(ServletComponent.java:55)
> 	at org.apache.camel.component.servlet.ServletComponent.disconnect(ServletComponent.java:116)
> 	at org.apache.camel.component.http.HttpEndpoint.disconnect(HttpEndpoint.java:152)
> 	at org.apache.camel.component.http.HttpConsumer.doStop(HttpConsumer.java:56)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:86)
> 	at org.apache.camel.impl.ServiceSupport.stop(ServiceSupport.java:107)
> 	at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:100)
> 	at org.apache.camel.impl.DefaultShutdownStrategy.shutdownNow(DefaultShutdownStrategy.java:217)
> 	at org.apache.camel.impl.DefaultShutdownStrategy$ShutdownTask.run(DefaultShutdownStrategy.java:413)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:637)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.