You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by domiko <do...@gmail.com> on 2012/06/04 11:08:50 UTC

Re: Using CamelHttpTransportServlet

Hey Willem,

I'm using Camel 2.6 (we cannot upgrade from Java 5) and I'm having issues
with the Servlet component.
I'm getting the following exception:

2012-jun-04 10:53:26 org.springframework.web.context.ContextLoader
initWebApplicationContext
ALLVARLIG: Context initialization failed
org.apache.camel.RuntimeCamelException: 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.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
	at
org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
	at
org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:237)
	at
org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
	at
org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
	at
org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
	at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
	at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
	at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
	at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
	.....

I'm using the standard conf in web.xml

	<servlet>
		<servlet-name>CamelServlet</servlet-name>
	
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>CamelServlet</servlet-name>
		<url-pattern>/s/*</url-pattern>
	</servlet-mapping>

	<context-param>
		<param-name>contextConfigLocation</param-name>
	
<param-value>classpath:/META-INF/spring/applicationContext.xml</param-value>
	</context-param>

	<listener>
	 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>


Do you have an idea what could have gone wrong?
**Note:A CXF servlet is also configured in the same web.xml and works fine
when I remove the CamelServlet.
**Note:My project is a regular Eclipse web app targeting WebLogic that I
tested Tomcat.

Rgds,
Dominique.


--
View this message in context: http://camel.465427.n5.nabble.com/Using-CamelHttpTransportServlet-tp4832859p5713933.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using CamelHttpTransportServlet

Posted by domiko <do...@gmail.com>.
Hey Willem,

I've used a Spring DispatcherServlet to load the context specifying the
appropriate load-on-startup order.
Good news:
My CamelServlet now works and my CamelContext loads fine
Bad news:
My CXFServlet for SOAP services doesn't work anymore, it thinks it's loaded
outside an ApplicationContext.

Back porting camel-servlet 2.7 sounds daunting (for me at least) but it
seems it's my only option (unless there is another way to get HTTP requests
i.e. force usage of SOAP).
I'll keep you posted.

Thanks and regards,
Dominique.

--
View this message in context: http://camel.465427.n5.nabble.com/Using-CamelHttpTransportServlet-tp4832859p5713965.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using CamelHttpTransportServlet

Posted by Willem Jiang <wi...@gmail.com>.
As you are using Spring to load the configure, it cann't tell if the 
camel transport servlet is started or not If you are using camel 2.6.0.
I'm afraid you need to upgrade the camel version, or just back port the 
camel-servlet part to camel 2.6.0.

On Mon Jun  4 17:08:50 2012, domiko wrote:
> Hey Willem,
>
> I'm using Camel 2.6 (we cannot upgrade from Java 5) and I'm having issues
> with the Servlet component.
> I'm getting the following exception:
>
> 2012-jun-04 10:53:26 org.springframework.web.context.ContextLoader
> initWebApplicationContext
> ALLVARLIG: Context initialization failed
> org.apache.camel.RuntimeCamelException: 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.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
> 	at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:103)
> 	at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:237)
> 	at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
> 	at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
> 	at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
> 	at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
> 	at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
> 	at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
> 	at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
> 	at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
> 	at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
> 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
> 	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
> 	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
> 	at org.apache.catalina.core.StandardService.start(StandardService.java:448)
> 	at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
> 	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
> 	.....
>
> I'm using the standard conf in web.xml
>
> 	<servlet>
> 		<servlet-name>CamelServlet</servlet-name>
> 	
> <servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
> 		<load-on-startup>1</load-on-startup>
> 	</servlet>
> 	<servlet-mapping>
> 		<servlet-name>CamelServlet</servlet-name>
> 		<url-pattern>/s/*</url-pattern>
> 	</servlet-mapping>
>
> 	<context-param>
> 		<param-name>contextConfigLocation</param-name>
> 	
> <param-value>classpath:/META-INF/spring/applicationContext.xml</param-value>
> 	</context-param>
>
> 	<listener>
> 	
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> 	</listener>
>
>
> Do you have an idea what could have gone wrong?
> **Note:A CXF servlet is also configured in the same web.xml and works fine
> when I remove the CamelServlet.
> **Note:My project is a regular Eclipse web app targeting WebLogic that I
> tested Tomcat.
>
> Rgds,
> Dominique.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-CamelHttpTransportServlet-tp4832859p5713933.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
Willem
----------------------------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
         http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang


Re: Using CamelHttpTransportServlet

Posted by domiko <do...@gmail.com>.
Nevermind my question.

A similar question was asked earlier ...
http://camel.465427.n5.nabble.com/Camel-and-Tomcat-td3386793.html

--
View this message in context: http://camel.465427.n5.nabble.com/Using-CamelHttpTransportServlet-tp4832859p5713950.html
Sent from the Camel - Users mailing list archive at Nabble.com.