Overview

We have built a Camel application that runs as both stand-alone jar and
webapp in tomcat. The application works fine in Spring version 3.0.6, yet
results in exceptions when moved to use Spring version 3.2.3. The only
change is moving the application Spring dependency from 3.0.6 to 3.2.3.

Exception</&lt;h2>
Exception in thread "main" org.apache.camel.CamelException: Cannot find any
Camel Context from the Application Context. Please check your Application
Context setting
        at
org.apache.camel.main.MainSupport.postProcessContext(MainSupport.java:388)
        at org.apache.camel.spring.Main.doStart(Main.java:145)
        at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
        at org.apache.camel.main.MainSupport.run(MainSupport.java:148)
        at
com.softwareag.eda.nerv.example.twitter.NERVTwitterWebSocketMain.main(NERVTwitterWebSocketMain.java:43)

Project layout

<http://camel.465427.n5.nabble.com/file/n5740776/nerv_twitter_layout.png> 

 Code 

Java


package com.softwareag.eda.nerv.example.twitter;

import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * A main to start this example.
 */
public final class NERVTwitterWebSocketMain {

        private static final Logger LOGGER = Logger
                        .getLogger(NERVTwitterWebSocketMain.class);
        
        private NERVTwitterWebSocketMain() {
                // to pass checkstyle we have a private constructor
        }

        public static void main(String[] args) throws Exception {

                Properties props = new Properties();
                InputStream in = NERVTwitterWebSocketMain.class
                                .getResourceAsStream("/twitterApp.properties");
                props.load(in);
                in.close();

                // create a new Camel Spring Main so we can easily start Camel
                org.apache.camel.spring.Main springMain = new
org.apache.camel.spring.Main();
                springMain.enableHangupSupport();
                springMain.run();

        }
}

web.xml


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
         http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>

    <context-param>
        <description>Context parameters for Spring
ContextLoaderListener</description>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:META-INF/spring/*.xml</param-value>
    </context-param>

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

    <welcome-file-list>
        <welcome-file>nerv-twitter.html</welcome-file>
    </welcome-file-list>

</web-app>


Solution

I suspect something has changed with the web.xml convention, yet have been
able to resolve.
* What has changed between Spring 3.0.6 to 3.2.3 that would cause the Camel
Spring DSL files to not be found?
** How do I resolve?
* If there is a better forum to post to, please advise.

Thanks!!
Michael



--
View this message in context: 
http://camel.465427.n5.nabble.com/Moving-from-Spring-3-0-6-to-3-2-3-results-in-exception-Cannot-find-any-Camel-Context-from-the-Applic-tp5740776.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to