camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Cook <>
Subject trouble with camel spring web example
Date Mon, 05 Jun 2017 14:06:13 GMT
I am trying to work through an example from the camel website, namely camel-example-servlet-tomcat.
I want to get a web application working that takes input from a web service request and uses
it as the data with which to start a camel route. I am running Tomcat 7.0.63, Netbeans 8.02,
Windows 10 Pro. Java 1.7, Maven 3.0.4.

I can build the application; when I run it the initial page appears, with the link that's
supposed to invoke the camel-based route; on clicking that link, or on entering any variation
of its URL, I get 404, resource not available.

I tried copying the source for CamelHttpTransportServlet to another class and configuring
that one as CamelServlet, so that I could set breakpoints and see what is happening. I can
hit breakpoints there but still don't know why it isn't working.

I do not understand what part of this invokes .start() on Camel, and wonder if I'm missing
some step that does that. One difficulty I have with the documentation is that it seems to
treat all the examples as a block, invoking parent poms and giving instructions on compiling
all of them together; I didn't want to do this but finally attempted it; it requires not only
a more recent version of Maven than we use in my shop but a more recent version of Java, so
that route is really frought. This example is so simple, surely someone can tell me what I'm
doing wrong.

I have the following web.xml:


        <web-app version="1.1"


                <!-- listener-class>org.apache.camel.component.servletlistener.SimpleCamelServletContextListener</listener-class

                </init-param  -->


            <!-- all our webservices are mapped under this URI pattern -->



and the following camel-config.xml


          <camelContext xmlns="">

            <route id="helloRoute">
              <!-- incoming requests from the servlet is routed -->
              <from uri="servlet:CamelServlet"/>
                  <!-- is there a header with the key name? -->
                  <!-- yes so return back a message to the user -->
                    <simple>Hi I am ${sysenv.HOSTNAME}. Hello ${} how are
you today?</simple>
                  <!-- if no name parameter then output a syntax to the user -->
                    <constant>Add a name parameter to uri, eg ?name=foo</constant>




Here's the pom.xml as well; I don't think it's related but of course don't know.

    <project xmlns="" xmlns:xsi=""




            <!-- Camel -->
            <dependency><groupId>org.apache.camel</groupId>     <artifactId>camel-core</artifactId>
            <version>${camel-version}</version>    </dependency>
            <dependency><groupId>org.apache.camel</groupId>     <artifactId>camel-spring</artifactId>
          <version>${camel-version}</version>    </dependency>
            <dependency><groupId>org.apache.camel</groupId>     <artifactId>camel-servlet</artifactId>
         <version>${camel-version}</version>    </dependency>
            <dependency><groupId>org.apache.camel</groupId>     <artifactId>camel-servletlistener</artifactId>
 <version>${camel-version}</version>    </dependency>
            <!-- spring -->
            <dependency><groupId>org.springframework</groupId>  <artifactId>spring-web</artifactId>
    <version>${spring-version}</version>    </dependency>

            <dependency><groupId>javax.servlet</groupId>        <artifactId>javax.servlet-api</artifactId><version>3.1.0</version>

            <!-- logging -->
            <!--dependency><groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api
          </artifactId>   <version>log4j-version</version> <scope>runtime</scope>
            <!--dependency><groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core
         </artifactId>   <version>log4j-version</version> <scope>runtime</scope>
            <!--dependency><groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl
   </artifactId>   <version>log4j-version</version> <scope>runtime</scope>



                <!-- CXF wsdl2java generator, will plugin to the compile goal -->


The contents of this email and any attachments to it may contain Customer Proprietary Network
Information (CPNI) as defined by the FCC and/or privileged and confidential information from
Access Point, Inc. Any and all of this information is only for the viewing or use of the intended
recipient. If you are not the intended recipient, you are hereby notified that any disclosure,
copying, distribution or use of, or the taking of any action in reliance upon, the information
contained in this e-mail, or any of the attachments to this e-mail, is strictly prohibited
and that this e-mail and all of the attachments to this e-mail, if any, must be immediately
returned to Access Point, Inc. or destroyed and, in either case, this e-mail and all attachments
to this e-mail must be immediately deleted from your computer without making any copies hereof.
If you have received this e-mail in error, please notify Access Point, Inc. by e-mail immediately.

View raw message