Hi,

You got this kind of exception, because you didn't specify the context path. Please change the RouteBuilder configure method like this

from("jetty:http://localhost:9080/?matchOnUriPrefix=true";).to("mock:one");

Willem


hdev wrote:
Hi,
when I try to start a CamelContext with a simple route
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;


public class Main {

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

                camelContext = new DefaultCamelContext();
                camelContext.addRoutes(new RouteBuilder() {
                        public void configure() {
                                
from("jetty:http://localhost:9080?matchOnUriPrefix=true";)
                                        .to("mock:one");
                        }
                });     
                camelContext.start();
                Thread.sleep(10000);                            
        }
}

using jetty-6.1.9 i get the following Output and Exception

20.03.2010 14:07:25 org.apache.camel.impl.DefaultCamelContext doStart
INFO: Apache Camel 2.2.0 (CamelContext:camel-1) is starting
20.03.2010 14:07:25 org.apache.camel.impl.DefaultCamelContext
createManagementStrategy
INFO: JMX enabled. Using DefaultManagedLifecycleStrategy.
20.03.2010 14:07:27 org.apache.camel.component.jetty.JettyHttpComponent
connect
WARNUNG: You use localhost interface! It means that no external connections
will be available. Don't you want to use 0.0.0.0 instead (all network
interfaces)?
2010-03-20 14:07:27.996::INFO:  Logging to STDERR via
org.mortbay.log.StdErrLog
2010-03-20 14:07:27.996::INFO:  jetty-6.1.9
Exception in thread "main" java.lang.IllegalArgumentException: Illegal
context spec:null
        at
org.mortbay.jetty.handler.ContextHandlerCollection.mapContexts(ContextHandlerCollection.java:82)
        at
org.mortbay.jetty.handler.ContextHandlerCollection.setHandlers(ContextHandlerCollection.java:149)
        at
org.mortbay.jetty.handler.HandlerCollection.addHandler(HandlerCollection.java:197)
        at org.mortbay.jetty.Server.addHandler(Server.java:591)
        at org.mortbay.jetty.servlet.Context.<init>(Context.java:124)
        at org.mortbay.jetty.servlet.Context.<init>(Context.java:73)
        at
org.apache.camel.component.jetty.JettyHttpComponent.createServletForConnector(JettyHttpComponent.java:356)
        at
org.apache.camel.component.jetty.JettyHttpComponent.connect(JettyHttpComponent.java:159)
        at
org.apache.camel.component.http.HttpEndpoint.connect(HttpEndpoint.java:111)
        at
org.apache.camel.component.http.HttpConsumer.doStart(HttpConsumer.java:50)
        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:53)
        at 
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:49)
        at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:989)
        at test.Main.main(Main.java:22)

The Class is started in Eclipse. The Libraries come from Camel 2.2.0 and ActiveMQ 5.3.0 releases. I am not
using maven but have downloaded the libs explicitly.

since all posts i found concerning this Exception gave me no clue for
solving my problem, i am posting here.

thanks i advance
Henning

Reply via email to