So I'm brushing up on the Camel-GAE
component, and all the tutorials/code samples I've found seem to indicate that you must use the Spring DSL (XML) in order to get Camel running on GAE.
This is because Camel-GAE
depends on Camel-Servlet
, and the only code samples I've found for configuring a CamelServlet
in web.xml
involve:
<web-app>
<servlet>
<servlet-name>CamelServlet</servlet-name>
<display-name>Camel Http Transport Servlet</display-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>appctx.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CamelServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
I'm really not a huge fan of Spring, and would prefer to do all my DI with something like GIN or Guice. Is there any way to create a Camel Servlet and define its CamelContext
without using Spring? Thanks in advance.
A web.xml file does not require to use Spring. So there is no dependency requirement from there. I just think when camel-gae was created, the examples and tutorials was web applications, and for that it was easier to bootstrap Camel using a spring context listener. This is no longer needed: http://camel.apache.org/servlet-tomcat-no-spring-example.html
I think we should look into this, and I logged a ticket: https://issues.apache.org/jira/browse/CAMEL-6030
I noticed its spring dependency while I was upgrading camel-gae to use a newer GAE version.
So I'm brushing up on the Camel-GAE
component, and all the tutorials/code samples I've found seem to indicate that you must use the Spring DSL (XML) in order to get Camel running on GAE.
This is because Camel-GAE
depends on Camel-Servlet
, and the only code samples I've found for configuring a CamelServlet
in web.xml
involve:
<web-app>
<servlet>
<servlet-name>CamelServlet</servlet-name>
<display-name>Camel Http Transport Servlet</display-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>appctx.xml</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>CamelServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
I'm really not a huge fan of Spring, and would prefer to do all my DI with something like GIN or Guice. Is there any way to create a Camel Servlet and define its CamelContext
without using Spring? Thanks in advance.
Update - error you get when you use JNDI registry on GAE:
java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details.
at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
at org.apache.camel.impl.JndiRegistry.createContext(JndiRegistry.java:103)
at org.apache.camel.impl.JndiRegistry.getContext(JndiRegistry.java:92)
at org.apache.camel.impl.JndiRegistry.lookup(JndiRegistry.java:65)
at org.apache.camel.impl.JndiRegistry.lookup(JndiRegistry.java:47)
at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:62)
at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1557)
at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1444)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1412)
at com.ourapp.server.servlets.CamelServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)