You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tereza Nedelescu <tn...@tagged.com> on 2011/08/10 06:01:18 UTC

How can I insert data in Solr from Camel ?

Hi,

I tried inserting data into Solr through Camel using two ways:
1 - from the *processor*, calling Java code that inserts data to Solr
2 - using the Solr component from this website:
http://46.252.16.133/?q=espace/ispace/solrcomponent

In both cases, I ran into exceptions that prevented the program from
inserting data into Solr. 
*In Case 1* - simply by calling code executing
                 solrServer = new
CommonsHttpSolrServer("http://localhost:8983/solr");
it gave the following exception

SEVERE: Failed delivery for exchangeId: ID-myId. Exhausted after delivery
attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
occurred during execution on the exchange:
Exchange[/home/tnedelescu/Logs_fresh/inDir/file.txt]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange:
Exchange[/home/tnedelescu/Logs_fresh/inDir/file.txt]
	at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
	at
org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:271)
        .......................................
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
        ...................

*In Case 2*, I got the following error:
SEVERE: Failed delivery for exchangeId: ID-myId. Exhausted after delivery
attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
occurred during execution on the exchange: Exchange[null]
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[null]
	at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
	at
org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:271)

I tested that exchange.getOut().getBody() is not null when it exits
"proces(exchange)".

If anybody inserted data to Solr, at the same time involving Camel, please,
let me know how to do it. 

Thank you,
Tereza



--
View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4684539.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How can I insert data in Solr from Camel ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The 1st error seems like the solr component is compiled against an old
Camel release or old JDK etc. You may want to recompile the solr
component with the same Camel version you are using.

On Wed, Aug 10, 2011 at 6:01 AM, Tereza Nedelescu <tn...@tagged.com> wrote:
> Hi,
>
> I tried inserting data into Solr through Camel using two ways:
> 1 - from the *processor*, calling Java code that inserts data to Solr
> 2 - using the Solr component from this website:
> http://46.252.16.133/?q=espace/ispace/solrcomponent
>
> In both cases, I ran into exceptions that prevented the program from
> inserting data into Solr.
> *In Case 1* - simply by calling code executing
>                 solrServer = new
> CommonsHttpSolrServer("http://localhost:8983/solr");
> it gave the following exception
>
> SEVERE: Failed delivery for exchangeId: ID-myId. Exhausted after delivery
> attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
> occurred during execution on the exchange:
> Exchange[/home/tnedelescu/Logs_fresh/inDir/file.txt]
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange:
> Exchange[/home/tnedelescu/Logs_fresh/inDir/file.txt]
>        at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
>        at
> org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:271)
>        .......................................
> Caused by: java.lang.IncompatibleClassChangeError: Implementing class
>        at java.lang.ClassLoader.defineClass1(Native Method)
>        at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
>        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
>        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>        ...................
>
> *In Case 2*, I got the following error:
> SEVERE: Failed delivery for exchangeId: ID-myId. Exhausted after delivery
> attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
> occurred during execution on the exchange: Exchange[null]
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[null]
>        at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
>        at
> org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:271)
>
> I tested that exchange.getOut().getBody() is not null when it exits
> "proces(exchange)".
>
> If anybody inserted data to Solr, at the same time involving Camel, please,
> let me know how to do it.
>
> Thank you,
> Tereza
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4684539.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: How can I insert data in Solr from Camel ?

Posted by Bilgin Ibryam <bi...@gmail.com>.
Thanks Gert, but we created a basic camel-solr component that does the job, see

https://issues.apache.org/jira/browse/CAMEL-4539

Bilgin

On Sun, Oct 16, 2011 at 9:40 AM, Gert Villemos <gv...@yahoo.de> wrote:
> See  http://www.villemos.com/?q=ispace/components
> http://www.villemos.com/?q=ispace/components .
>
> You need the 'Aperture' component for text extraction and the 'Solr'
> component for injection / retrieval.
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4906609.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How can I insert data in Solr from Camel ?

Posted by Gert Villemos <gv...@yahoo.de>.
See  http://www.villemos.com/?q=ispace/components
http://www.villemos.com/?q=ispace/components .

You need the 'Aperture' component for text extraction and the 'Solr'
component for injection / retrieval.

--
View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4906609.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How can I insert data in Solr from Camel ?

Posted by Bilgin Ibryam <bi...@gmail.com>.
Hi all,

I also want to import documents into Solr, and for now I'm trying to
do it with http4 component.

Is there already an camel-solr component available, where?
If not, does it make sense to create one or try to achieve it using
http or http4?

Regards,
Bilgin Ibryam

On Sun, Sep 25, 2011 at 11:08 PM, Gert Villemos <gv...@yahoo.de> wrote:
> The Solr component has been compiled against Camel 2.7.0. I will be migrating
> it to the latest Camel version soon.
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4839539.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: How can I insert data in Solr from Camel ?

Posted by Gert Villemos <gv...@yahoo.de>.
The Solr component has been compiled against Camel 2.7.0. I will be migrating
it to the latest Camel version soon.


--
View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4839539.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: How can I insert data in Solr from Camel ?

Posted by James Talbut <jt...@tardis.spudsoft>.
I don't write to solr, but I do query it (and writing should work equivalently).
My route for querying is just:
    <route id="SolrQuery">
      <from uri="direct:solrQuery" />
      <setHeader headerName="CamelHttpQuery">
        <simple>${body}</simple>
      </setHeader>
      <to uri="http://server:8983/solr/test/select/?disableStreamCache=true" />
      <convertBodyTo type="java.lang.String" />
      <unmarshal ref="solrToMap"/>
    </route>

That route takes in the query string for solr as the body and then returns the data from solr as a map.

You might find it simpler to ignore java code for calling solr, and just talk http to it.

Jim

On Tue, Aug 09, 2011 at 09:01:18PM -0700, Tereza Nedelescu wrote:
> Hi,
> 
> I tried inserting data into Solr through Camel using two ways:
> 1 - from the *processor*, calling Java code that inserts data to Solr
> 2 - using the Solr component from this website:
> http://46.252.16.133/?q=espace/ispace/solrcomponent
> 
> In both cases, I ran into exceptions that prevented the program from
> inserting data into Solr. 
> *In Case 1* - simply by calling code executing
>                  solrServer = new
> CommonsHttpSolrServer("http://localhost:8983/solr");
> it gave the following exception
> 
> SEVERE: Failed delivery for exchangeId: ID-myId. Exhausted after delivery
> attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
> occurred during execution on the exchange:
> Exchange[/home/tnedelescu/Logs_fresh/inDir/file.txt]
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange:
> Exchange[/home/tnedelescu/Logs_fresh/inDir/file.txt]
> 	at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at
> org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:271)
>         .......................................
> Caused by: java.lang.IncompatibleClassChangeError: Implementing class
> 	at java.lang.ClassLoader.defineClass1(Native Method)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
> 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
>         ...................
> 
> *In Case 2*, I got the following error:
> SEVERE: Failed delivery for exchangeId: ID-myId. Exhausted after delivery
> attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
> occurred during execution on the exchange: Exchange[null]
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[null]
> 	at
> org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at
> org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:271)
> 
> I tested that exchange.getOut().getBody() is not null when it exits
> "proces(exchange)".
> 
> If anybody inserted data to Solr, at the same time involving Camel, please,
> let me know how to do it. 
> 
> Thank you,
> Tereza
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-can-I-insert-data-in-Solr-from-Camel-tp4684539p4684539.html
> Sent from the Camel - Users mailing list archive at Nabble.com.