You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Oliver Newell <ol...@LL.mit.edu> on 2009/01/20 18:04:07 UTC

Running Servlets in a ServiceMix 4 instance

Hi -

I would like to run some servlets inside a ServiceMix 4 instance. I did 
some searching but haven't found any specific examples. I did come 
across some examples on the Web that discuss how to run servlets in a 
Jetty servlet container that is embedded in an OSGI container, and that 
is along the lines of what I am trying to do. I see that ServiceMix 4 
includes the jetty-6.1.12rc1 bundle, so I think I'm almost there...

I imagine this is a pretty common use case, and I just didn't come 
across the right document/thread in my search. Can anyone steer me in 
the right direction?

Thanks!

-Oliver


Re: Running Servlets in a ServiceMix 4 instance

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

It depends that you want to do exactly.

You can embed the servlet logic as a marshaler for the HTTP component.

If you want to deploy something like a war containing servlet/jsp, I think it's possible
using a servicemix-bean that launch jetty (same as jetty:run-war maven plugin goal).

For example, you can define a bean that do :

Server server = new Server(8080);
Context root = new Context(server, "/", Context.SESSIONS);
root.addServlet(new ServletHolder(new MyServlet("foobar")), "/");
server.start();

your servlet will be available on the 8080 port number.

Regards
JB


On Tuesday 20 January 2009 - 12:04, Oliver Newell wrote:
>
> Hi -
>
> I would like to run some servlets inside a ServiceMix 4 instance. I did  
> some searching but haven't found any specific examples. I did come  
> across some examples on the Web that discuss how to run servlets in a  
> Jetty servlet container that is embedded in an OSGI container, and that  
> is along the lines of what I am trying to do. I see that ServiceMix 4  
> includes the jetty-6.1.12rc1 bundle, so I think I'm almost there...
>
> I imagine this is a pretty common use case, and I just didn't come  
> across the right document/thread in my search. Can anyone steer me in  
> the right direction?
>
> Thanks!
>
> -Oliver
>

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: Running Servlets in a ServiceMix 4 instance

Posted by Juan José Vázquez Delgado <ju...@gmail.com>.
Hi,

On the other hand, you could try Apache Sling [1] over SMX4 [2].

[1] http://incubator.apache.org/sling/site/index.html
[2] http://servicemix.apache.org/SMX4KNL/running-apache-sling-on-servicemix-kernel.html

BR,

Juanjo

On Tue, Jan 20, 2009 at 11:27 PM, Newell, Oliver <ol...@ll.mit.edu> wrote:
> Hi JB -
>
> Thanks very much for the suggestions. I'll try them out and post my experience....
>
> -Oliver
>
>
> -----Original Message-----
> From: jb@nanthrax.net [mailto:jb@nanthrax.net]
> Sent: Tuesday, January 20, 2009 2:40 PM
> To: users@servicemix.apache.org
> Subject: Re: Running Servlets in a ServiceMix 4 instance
>
> Another solution (especially for SMX3) is to modify the conf/servicemix.xml that launch
> your POJO calling Jetty and your servlet at the SMX startup (Spring based).
>
> Regards
> JB
>
> On Tuesday 20 January 2009 - 12:04, Oliver Newell wrote:
>>
>> Hi -
>>
>> I would like to run some servlets inside a ServiceMix 4 instance. I did
>> some searching but haven't found any specific examples. I did come
>> across some examples on the Web that discuss how to run servlets in a
>> Jetty servlet container that is embedded in an OSGI container, and that
>> is along the lines of what I am trying to do. I see that ServiceMix 4
>> includes the jetty-6.1.12rc1 bundle, so I think I'm almost there...
>>
>> I imagine this is a pretty common use case, and I just didn't come
>> across the right document/thread in my search. Can anyone steer me in
>> the right direction?
>>
>> Thanks!
>>
>> -Oliver
>>
>
> --
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
>

RE: Running Servlets in a ServiceMix 4 instance

Posted by "Newell, Oliver" <ol...@ll.mit.edu>.
Hi JB -

Thanks very much for the suggestions. I'll try them out and post my experience....

-Oliver


-----Original Message-----
From: jb@nanthrax.net [mailto:jb@nanthrax.net] 
Sent: Tuesday, January 20, 2009 2:40 PM
To: users@servicemix.apache.org
Subject: Re: Running Servlets in a ServiceMix 4 instance

Another solution (especially for SMX3) is to modify the conf/servicemix.xml that launch 
your POJO calling Jetty and your servlet at the SMX startup (Spring based).

Regards
JB

On Tuesday 20 January 2009 - 12:04, Oliver Newell wrote:
>
> Hi -
>
> I would like to run some servlets inside a ServiceMix 4 instance. I did  
> some searching but haven't found any specific examples. I did come  
> across some examples on the Web that discuss how to run servlets in a  
> Jetty servlet container that is embedded in an OSGI container, and that  
> is along the lines of what I am trying to do. I see that ServiceMix 4  
> includes the jetty-6.1.12rc1 bundle, so I think I'm almost there...
>
> I imagine this is a pretty common use case, and I just didn't come  
> across the right document/thread in my search. Can anyone steer me in  
> the right direction?
>
> Thanks!
>
> -Oliver
>

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: Running Servlets in a ServiceMix 4 instance

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Another solution (especially for SMX3) is to modify the conf/servicemix.xml that launch 
your POJO calling Jetty and your servlet at the SMX startup (Spring based).

Regards
JB

On Tuesday 20 January 2009 - 12:04, Oliver Newell wrote:
>
> Hi -
>
> I would like to run some servlets inside a ServiceMix 4 instance. I did  
> some searching but haven't found any specific examples. I did come  
> across some examples on the Web that discuss how to run servlets in a  
> Jetty servlet container that is embedded in an OSGI container, and that  
> is along the lines of what I am trying to do. I see that ServiceMix 4  
> includes the jetty-6.1.12rc1 bundle, so I think I'm almost there...
>
> I imagine this is a pretty common use case, and I just didn't come  
> across the right document/thread in my search. Can anyone steer me in  
> the right direction?
>
> Thanks!
>
> -Oliver
>

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: Running Servlets in a ServiceMix 4 instance

Posted by Russ Chan <gr...@gmail.com>.
Thanks Chris,

That fixed it for me.

Russ


On Sat, Jan 31, 2009 at 6:52 PM, Chris Custine <cc...@apache.org> wrote:

> There was a missing repository entry for the OPS4J maven repo in the
> release
> you are using.  Append the entry "http://repository.ops4j.org/maven2" to
> the
> property org.ops4j.pax.url.mvn.repositories at the bottom of
> etc/org.ops4j.pax.url.mvn.cfg and restart.  You should be able to install
> the web feature after that.  This has been fixed in SNAPSHOTs.
>
> Chris
>
> --
> Chris Custine
> My Blog :: http://blog.organicelement.com
> Apache ServiceMix :: http://servicemix.apache.org
> Apache Directory Server :: http://directory.apache.org
>
>
> On Sat, Jan 31, 2009 at 1:20 PM, Russ Chan <gr...@gmail.com> wrote:
>
> > Hmmm - I've just tried this - it doesn't seem to work for me.
> >
> > Here's the output of my features listUrl:
> >
> > servicemix> features listUrl
> >
> >
> mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.features/4.0-m2-SNAPSHOT/xml/features
> > http://svn.apache.org/repos/asf/servicemix/smx4/obr-repo/features.xml
> >
> >
> mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.0.0.3-fuse/xml/features
> >
> >
> mvn:org.apache.servicemix.features/apache-servicemix/4.0.0.3-fuse/xml/features
> >
> >
> > The output when I try to install from the console:
> >
> > features install web
> > ERROR RuntimeException: URL [mvn:org.ops4j.pax.url/pax-url-war/0.3.2]
> could
> > not be resolved. (enable TRACE logging for details)
> >
> > Looking at the log it appears that the pax-url-war bundle is no longer in
> > the default areas... any ideas if there's a new URL that I can add to
> find
> > this?
> >
> > Thanks,
> > Russ
> >
> >
> >
> >
> >
> > On Thu, Jan 22, 2009 at 4:47 AM, Gert Vanthienen
> > <ge...@skynet.be>wrote:
> >
> > > Oliver,
> > >
> > > There is a 'web' feature available for ServiceMix 4.  If you downloaded
> > the
> > > full ServiceMix 4, the features url should already have been added and
> > you
> > > can just type 'features/install web' to install the feature.  Once
> > > installed, you can just drop a war file with servlets in the deploy
> > > directory.
> > >
> > > Regards,
> > >
> > > Gert
> > >
> > >
> > > Oliver Newell wrote:
> > >
> > >>
> > >> Hi -
> > >>
> > >> I would like to run some servlets inside a ServiceMix 4 instance. I
> did
> > >> some searching but haven't found any specific examples. I did come
> > across
> > >> some examples on the Web that discuss how to run servlets in a Jetty
> > servlet
> > >> container that is embedded in an OSGI container, and that is along the
> > lines
> > >> of what I am trying to do. I see that ServiceMix 4 includes the
> > >> jetty-6.1.12rc1 bundle, so I think I'm almost there...
> > >>
> > >> I imagine this is a pretty common use case, and I just didn't come
> > across
> > >> the right document/thread in my search. Can anyone steer me in the
> right
> > >> direction?
> > >>
> > >> Thanks!
> > >>
> > >> -Oliver
> > >>
> > >>
> > >>
> > >
> >
>

Re: Running Servlets in a ServiceMix 4 instance

Posted by Chris Custine <cc...@apache.org>.
There was a missing repository entry for the OPS4J maven repo in the release
you are using.  Append the entry "http://repository.ops4j.org/maven2" to the
property org.ops4j.pax.url.mvn.repositories at the bottom of
etc/org.ops4j.pax.url.mvn.cfg and restart.  You should be able to install
the web feature after that.  This has been fixed in SNAPSHOTs.

Chris

--
Chris Custine
My Blog :: http://blog.organicelement.com
Apache ServiceMix :: http://servicemix.apache.org
Apache Directory Server :: http://directory.apache.org


On Sat, Jan 31, 2009 at 1:20 PM, Russ Chan <gr...@gmail.com> wrote:

> Hmmm - I've just tried this - it doesn't seem to work for me.
>
> Here's the output of my features listUrl:
>
> servicemix> features listUrl
>
> mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.features/4.0-m2-SNAPSHOT/xml/features
> http://svn.apache.org/repos/asf/servicemix/smx4/obr-repo/features.xml
>
> mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.0.0.3-fuse/xml/features
>
> mvn:org.apache.servicemix.features/apache-servicemix/4.0.0.3-fuse/xml/features
>
>
> The output when I try to install from the console:
>
> features install web
> ERROR RuntimeException: URL [mvn:org.ops4j.pax.url/pax-url-war/0.3.2] could
> not be resolved. (enable TRACE logging for details)
>
> Looking at the log it appears that the pax-url-war bundle is no longer in
> the default areas... any ideas if there's a new URL that I can add to find
> this?
>
> Thanks,
> Russ
>
>
>
>
>
> On Thu, Jan 22, 2009 at 4:47 AM, Gert Vanthienen
> <ge...@skynet.be>wrote:
>
> > Oliver,
> >
> > There is a 'web' feature available for ServiceMix 4.  If you downloaded
> the
> > full ServiceMix 4, the features url should already have been added and
> you
> > can just type 'features/install web' to install the feature.  Once
> > installed, you can just drop a war file with servlets in the deploy
> > directory.
> >
> > Regards,
> >
> > Gert
> >
> >
> > Oliver Newell wrote:
> >
> >>
> >> Hi -
> >>
> >> I would like to run some servlets inside a ServiceMix 4 instance. I did
> >> some searching but haven't found any specific examples. I did come
> across
> >> some examples on the Web that discuss how to run servlets in a Jetty
> servlet
> >> container that is embedded in an OSGI container, and that is along the
> lines
> >> of what I am trying to do. I see that ServiceMix 4 includes the
> >> jetty-6.1.12rc1 bundle, so I think I'm almost there...
> >>
> >> I imagine this is a pretty common use case, and I just didn't come
> across
> >> the right document/thread in my search. Can anyone steer me in the right
> >> direction?
> >>
> >> Thanks!
> >>
> >> -Oliver
> >>
> >>
> >>
> >
>

Re: Running Servlets in a ServiceMix 4 instance

Posted by Russ Chan <gr...@gmail.com>.
Hmmm - I've just tried this - it doesn't seem to work for me.

Here's the output of my features listUrl:

servicemix> features listUrl
mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.features/4.0-m2-SNAPSHOT/xml/features
http://svn.apache.org/repos/asf/servicemix/smx4/obr-repo/features.xml
mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.0.0.3-fuse/xml/features
mvn:org.apache.servicemix.features/apache-servicemix/4.0.0.3-fuse/xml/features


The output when I try to install from the console:

features install web
ERROR RuntimeException: URL [mvn:org.ops4j.pax.url/pax-url-war/0.3.2] could
not be resolved. (enable TRACE logging for details)

Looking at the log it appears that the pax-url-war bundle is no longer in
the default areas... any ideas if there's a new URL that I can add to find
this?

Thanks,
Russ





On Thu, Jan 22, 2009 at 4:47 AM, Gert Vanthienen
<ge...@skynet.be>wrote:

> Oliver,
>
> There is a 'web' feature available for ServiceMix 4.  If you downloaded the
> full ServiceMix 4, the features url should already have been added and you
> can just type 'features/install web' to install the feature.  Once
> installed, you can just drop a war file with servlets in the deploy
> directory.
>
> Regards,
>
> Gert
>
>
> Oliver Newell wrote:
>
>>
>> Hi -
>>
>> I would like to run some servlets inside a ServiceMix 4 instance. I did
>> some searching but haven't found any specific examples. I did come across
>> some examples on the Web that discuss how to run servlets in a Jetty servlet
>> container that is embedded in an OSGI container, and that is along the lines
>> of what I am trying to do. I see that ServiceMix 4 includes the
>> jetty-6.1.12rc1 bundle, so I think I'm almost there...
>>
>> I imagine this is a pretty common use case, and I just didn't come across
>> the right document/thread in my search. Can anyone steer me in the right
>> direction?
>>
>> Thanks!
>>
>> -Oliver
>>
>>
>>
>

Re: Running Servlets in a ServiceMix 4 instance

Posted by Gert Vanthienen <ge...@skynet.be>.
Oliver,

There is a 'web' feature available for ServiceMix 4.  If you downloaded 
the full ServiceMix 4, the features url should already have been added 
and you can just type 'features/install web' to install the feature.  
Once installed, you can just drop a war file with servlets in the deploy 
directory.

Regards,

Gert

Oliver Newell wrote:
>
> Hi -
>
> I would like to run some servlets inside a ServiceMix 4 instance. I 
> did some searching but haven't found any specific examples. I did come 
> across some examples on the Web that discuss how to run servlets in a 
> Jetty servlet container that is embedded in an OSGI container, and 
> that is along the lines of what I am trying to do. I see that 
> ServiceMix 4 includes the jetty-6.1.12rc1 bundle, so I think I'm 
> almost there...
>
> I imagine this is a pretty common use case, and I just didn't come 
> across the right document/thread in my search. Can anyone steer me in 
> the right direction?
>
> Thanks!
>
> -Oliver
>
>