You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jared Whiklo <jw...@gmail.com> on 2017/09/26 13:47:50 UTC

Spark-rest in OSGI

Hi all,

I'm fairly new to Camel and very new to OSGI, but I was attempting to
migrate a WAR deployable webapp to be a Karaf deployable feature.

It seems to go well until I tried it on my staging server in which there
are existing bundles deployed.

I have narrowed it down to the spark-rest configuration. The new feature
and one of the old both have lines like...

restConfiguration().component("spark-rest").host("localhost").port(restPortNum);

Here [1] and here [2].

This causes one of the camel contexts to refuse to start up. If I
comment out one of the rest endpoint configuration lines and rest routes
then they both load.

It seems to me that they should be able to both operate using different
ports or even the same port with different paths.

But I am clearly missing something simple...can anyone clue me in to it?

cheers,
jared

[1]
https://github.com/whikloj/islandora-1x-derivative-toolkit/blob/master/islandora-1x-gatekeeper/src/main/java/ca/umanitoba/dam/islandora/derivatives/gatekeeper/ImageRoutes.java#L82
[2]
https://github.com/uml-digitalinitiatives/islandora-1x-solr-indexer/blob/osgi-package/src/main/java/ca/umanitoba/dam/islandora/fc3indexer/FedoraSolrIndexer.java#L64
-- 
Jared Whiklo
jwhiklo@gmail.com
--------------------------------------------------
Oh, they have the Internet on computers now. -- Homer Simpson

Re: Spark-rest in OSGI

Posted by Jared Whiklo <jw...@gmail.com>.
Ahhhh thank you very much Claus. I will switch it to servlet.

cheers,
jared

On 2017-09-26 8:53 AM, Claus Ibsen wrote:
> I would not recommend using spark-rest in OSGi - its best for a single JVM only.
> It has a bunch of static code that dont go well in osgi.
> 
> Use one of the others like servlet or jetty
> 
> On Tue, Sep 26, 2017 at 3:47 PM, Jared Whiklo <jw...@gmail.com> wrote:
>> Hi all,
>>
>> I'm fairly new to Camel and very new to OSGI, but I was attempting to
>> migrate a WAR deployable webapp to be a Karaf deployable feature.
>>
>> It seems to go well until I tried it on my staging server in which there
>> are existing bundles deployed.
>>
>> I have narrowed it down to the spark-rest configuration. The new feature
>> and one of the old both have lines like...
>>
>> restConfiguration().component("spark-rest").host("localhost").port(restPortNum);
>>
>> Here [1] and here [2].
>>
>> This causes one of the camel contexts to refuse to start up. If I
>> comment out one of the rest endpoint configuration lines and rest routes
>> then they both load.
>>
>> It seems to me that they should be able to both operate using different
>> ports or even the same port with different paths.
>>
>> But I am clearly missing something simple...can anyone clue me in to it?
>>
>> cheers,
>> jared
>>
>> [1]
>> https://github.com/whikloj/islandora-1x-derivative-toolkit/blob/master/islandora-1x-gatekeeper/src/main/java/ca/umanitoba/dam/islandora/derivatives/gatekeeper/ImageRoutes.java#L82
>> [2]
>> https://github.com/uml-digitalinitiatives/islandora-1x-solr-indexer/blob/osgi-package/src/main/java/ca/umanitoba/dam/islandora/fc3indexer/FedoraSolrIndexer.java#L64
>> --
>> Jared Whiklo
>> jwhiklo@gmail.com
>> --------------------------------------------------
>> Oh, they have the Internet on computers now. -- Homer Simpson
> 
> 
> 

-- 
Jared Whiklo
jwhiklo@gmail.com
--------------------------------------------------
I've learned that we are responsible for what we do, unless we are
celebrities.

Re: Spark-rest in OSGI

Posted by Claus Ibsen <cl...@gmail.com>.
I would not recommend using spark-rest in OSGi - its best for a single JVM only.
It has a bunch of static code that dont go well in osgi.

Use one of the others like servlet or jetty

On Tue, Sep 26, 2017 at 3:47 PM, Jared Whiklo <jw...@gmail.com> wrote:
> Hi all,
>
> I'm fairly new to Camel and very new to OSGI, but I was attempting to
> migrate a WAR deployable webapp to be a Karaf deployable feature.
>
> It seems to go well until I tried it on my staging server in which there
> are existing bundles deployed.
>
> I have narrowed it down to the spark-rest configuration. The new feature
> and one of the old both have lines like...
>
> restConfiguration().component("spark-rest").host("localhost").port(restPortNum);
>
> Here [1] and here [2].
>
> This causes one of the camel contexts to refuse to start up. If I
> comment out one of the rest endpoint configuration lines and rest routes
> then they both load.
>
> It seems to me that they should be able to both operate using different
> ports or even the same port with different paths.
>
> But I am clearly missing something simple...can anyone clue me in to it?
>
> cheers,
> jared
>
> [1]
> https://github.com/whikloj/islandora-1x-derivative-toolkit/blob/master/islandora-1x-gatekeeper/src/main/java/ca/umanitoba/dam/islandora/derivatives/gatekeeper/ImageRoutes.java#L82
> [2]
> https://github.com/uml-digitalinitiatives/islandora-1x-solr-indexer/blob/osgi-package/src/main/java/ca/umanitoba/dam/islandora/fc3indexer/FedoraSolrIndexer.java#L64
> --
> Jared Whiklo
> jwhiklo@gmail.com
> --------------------------------------------------
> Oh, they have the Internet on computers now. -- Homer Simpson



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2