You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by MichaelAtSAG <me...@gmail.com> on 2013/10/02 19:07:06 UTC

Moving from Spring 3.0.6 to 3.2.3 results in exception - Cannot find any Camel Context from the Application Context.

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.

Re: Moving from Spring 3.0.6 to 3.2.3 results in exception - Cannot find any Camel Context from the Application Context.

Posted by Christian Müller <ch...@gmail.com>.
Camel 2.11 also supports Spring 3.2.x. So it SHOULD work.
Can you assemble a small sample project which shows the issue? Than it's
much easier for us to dig into the issue.

Best,
Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Wed, Oct 9, 2013 at 11:46 PM, MichaelAtSAG <me...@gmail.com>wrote:

> Apache camel 2.11
>
>
>
> --
> 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-tp5740776p5741252.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Moving from Spring 3.0.6 to 3.2.3 results in exception - Cannot find any Camel Context from the Application Context.

Posted by MichaelAtSAG <me...@gmail.com>.
Apache camel 2.11



--
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-tp5740776p5741252.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Moving from Spring 3.0.6 to 3.2.3 results in exception - Cannot find any Camel Context from the Application Context.

Posted by Christian Müller <ch...@gmail.com>.
You should mention the Camel version you are using...

Best,
Christian
Am 02.10.2013 19:07 schrieb "MichaelAtSAG" <me...@gmail.com>:

> 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.
>