I don't know if you are running the test with maven?
If so , you can use maven archetypes to create the router module[1].
Then run the router by typing " maven camel:run".
If you are using ant or something, you don't need to put the MyTest.jar into the lib/optional directory, you just need to make sure camel can find this jar in the class path.

[1] http://cwiki.apache.org/CAMEL/creating-a-new-spring-based-camel-route.html

Willem

Vadim Chekan wrote:
Good, tutorial helped a little bit.
Now I've stuck with this:
DEBUG ResolverUtil                   - Searching for implementations
of org.apache.camel.builder.RouteBuilder in packages:
[org.mycompany.test]
DEBUG ResolverUtil                   - Found: []

I've compiled and put to lib/optional/MyTest.jar the following code:
========================================================
package org.mycompany.test;

import org.apache.camel.builder.RouteBuilder;

public class Mover1 extends RouteBuilder {
        public void configure() throws Exception {
                from("messagemq:vadim1").to("messagemq:vadim2");
        }
}
======================================================

Any clues why my class in not found?

Vadim.

On Fri, Jul 4, 2008 at 12:24 AM, Claus Ibsen <[EMAIL PROTECTED]> wrote:
Hi Vlad

Ah you are digging into the auto discovery feature from the <package> tag.
E.g. from the tutorial, where there is a <package> tag in the camel context.

   <!-- declare a camel context that scans for classes that is RouteBuilder
        in the package org.apache.camel.example.server -->
   <camel:camelContext id="camel">
       <camel:package>org.apache.camel.example.server</camel:package>
       <!-- enable JMX connector so we can connect to the server and browse mbeans 
-->
       <!-- Camel will log at INFO level the service URI to use for connecting 
with jconsole -->
       <camel:jmxAgent id="agent" createConnector="true"/>
   </camel:camelContext>

Yes it will look for classes in the package that extends RouteBuilder.
The RouteBuilder has a configure() method where you define the camel routing in 
Java DSL.

You can check out the tutorial:
http://activemq.apache.org/camel/tutorials.html

So this is a good way to "kick-start" your camel context that its spring 
configured but you can use the Java DSL that is more powerful than XML. However Camel 
supports both, and mix/match.



Med venlig hilsen

Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Vadim Chekan [mailto:[EMAIL PROTECTED]
Sent: 4. juli 2008 02:05
To: [email protected]
Subject: Re: MS SQL Message Service endpoint

Thanks Claus,
I'm slowly digging through it.
Following things are still not clear to me:
What are the conventions on classes in the package? Should class
implement main() method to be called? Or any class inherited from
RouteBuilder will be instaniated? I'm trying to understand how camel
decides from "package" which class and method to call.

Vadim.

On Wed, Jul 2, 2008 at 10:33 PM, Claus Ibsen <[EMAIL PROTECTED]> wrote:
Hi

Created ticket CAMEL-658 for improving the wiki documentation.

Thanks for reporting your troubles with it, we want to improve it.


Med venlig hilsen

Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Claus Ibsen [mailto:[EMAIL PROTECTED]
Sent: 3. juli 2008 07:29
To: [email protected]
Subject: RE: MS SQL Message Service endpoint

Hi Vlad

Thanks for the investigations. Yes there could be an odd issue with the JDBC 
component, as I would assume it could consume from the database = reading.

As a work around or how to get it working, you can get an endpoint in front to 
kick it off.

from("timer://kickoff?delay=10000").setBody("select * from 
xxxx").to("jdbc:msServiceBroker").to("activemq:aspcust1");


This is from a unit test in camel-jdbc. The timer fires every 10th second and 
queries the database and send the result to the mock. In your case the activemq 
instead.

               from("timer://kickoff?period=10000").
                   setBody(constant("select * from customer")).
                   to("jdbc:testdb").
                   to("mock:result");

Notice that the result is a list of map objects, each row is a map with the 
columnname as the key. From another unit test:

       // assertions of the response
       assertNotNull(out);
       assertNotNull(out.getOut());
       ArrayList<HashMap<String, Object>> data = 
out.getOut().getBody(ArrayList.class);
       assertNotNull("out body could not be converted to an ArrayList - was: "
           + out.getOut().getBody(), data);
       assertEquals(2, data.size());
       HashMap<String, Object> row = data.get(0);
       assertEquals("cust1", row.get("ID"));
       assertEquals("jstrachan", row.get("NAME"));
       row = data.get(1);
       assertEquals("cust2", row.get("ID"));
       assertEquals("nsandhu", row.get("NAME"));

Med venlig hilsen

Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: Vadim Chekan [mailto:[EMAIL PROTECTED]
Sent: 3. juli 2008 01:33
To: [email protected]
Subject: Re: MS SQL Message Service endpoint

Ok, I got this one. My ActiveMQ installation does not contain camel-jdbc.jar.
It runs fine now but it gives me "Failed to execute main task. Reason:
java.lang.NoClassDefFoundError:
org/springframework/aop/support/AopUtils".
Copied spring-aop-2.5.1.jar

Ok, now:
Caused by: org.apache.camel.RuntimeCamelException: A JDBC Consumer would be the
server side of database! No such support here at
org.apache.camel.component.jdbc.JdbcEndpoint.createConsumer(JdbcEndpoint.java:56)

Hmm, I remember seeing this exception in the source code but I do not
understand it. why <from uri="jdbc:msServiceBroker" /> tries to create
a consumer. I thought that "from" is a message producer, right?


On Wed, Jul 2, 2008 at 12:33 PM, Vadim Chekan <[EMAIL PROTECTED]> wrote:
Here is my progress:
First of all it complained about DriverManagerDataSource class so I've
downloaded spring-jdbc-2.5.1.jar and put it to lib/optional
Now I'm getting
=======================================
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found
for: jdbc:msServiceBroker
       at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelCo
=======================================

My configuration is:
===============================================================
  <camelContext id="camel"
xmlns="http://activemq.apache.org/camel/schema/spring";>
          <route>
                  <from uri="jdbc:msServiceBroker" />
                  <to uri="activemq:aspcust1" />
          </route>
  </camelContext>

       <bean id="msServiceBroker"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
               <property name="driverClassName" 
value="net.sourceforge.jtds.jdbc.Driver"/>
               <property name="url"
value="jdbc:jtds:sqlserver://aspcust1/LogQueue;instance=main"/>
               <property name="username" value="****"/>
               <property name="password" value="****"/>
       </bean>
===============================================================

I thought that it it the way this thing works: after jdbc uri you
specify a bean, but apparently I got it wrong. I'm trying to define
endpoint explicitly now withing camel context.
Any help please?

BTW: there is an error in schema location in default configuration
file: http://activemq.apache.org/schema/core/activemq-core.xsd does
not exist. I had to change it to
http://activemq.apache.org/schema/core/activemq-core-5.1.0.xsd to make
my Visual Studio hints working ;)

--
From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified


--
From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified


--
From RFC 2631: In ASN.1, EXPLICIT tagging is implicit unless IMPLICIT
is explicitly specified





Reply via email to