Guys,

Thanks for the pointer to Pax Web. I've been looking over the documentation
and have a couple of questions:

1. is Pax-Web mainly just an extension of the OSGi HTTPService with awesome
Jetty connectivity?
2. Can I configure multiple connectors? My application relies on SSL set up
using the embedded SslSocketConnector/SelectChannelConnector classes of
jetty.
3. Can I harden it strictly for my application? I have some security
requirements that I need to be very careful with... mainly that would mean
insuring that there is not any external facing servlets other than mine
(aka, no admin) etc...

What are the disadvantages of using embedded Felix? I assumed that it would
facilitate easier packaging and deployment, is that not true?

Thanks,

E

On Fri, Jun 15, 2012 at 2:57 AM, Achim Nierbeck <[email protected]>wrote:

> And if you want to have some more stuff like JAAS or Logging out of
> the box working for you
> use Apache Karaf which uses Felix as the OSGi framework and brings
> along everything you need for Pax Web :)
>
> regards, Achim
>
> 2012/6/15 Allen Lau <[email protected]>:
> > Unless you really need to embed Felix, why not run the Felix distribution
> > and add something like Pax-Web which embeds Jetty to be
> > your WAR/WAB web container?
> >
> > On Thu, Jun 14, 2012 at 2:03 PM, Evan Ruff
> > <[email protected]>wrote:
> >
> >> Hey guys,
> >>
> >> I'm just getting started with Felix and OSGi in general. I've
> >> been cursing around trying to find some information about using Felix
> and
> >> I've gotten stuck on the most trivial example! I think I must be missing
> >> some sort of basic concept and I was hoping someone could tell me what
> I'm
> >> doing wrong?
> >>
> >> For a little background, I'm trying to migrate a web-app to a more
> modular,
> >> OSGi based, installable application. I want to distribute my application
> >> and currently, that requires the administrator to set up a Jetty server
> and
> >> install my Webapp. I'd much rather have a single application that
> contains
> >> it's own Jetty server and then have the web-apps and their supporting
> J2EE
> >> pieces be installed as OSGi modules.
> >>
> >> To start, I've created a new Java Project, added felix to the class path
> >> and spun up the following main:
> >> public static void main( String[] args ) throws BundleException
> >>  {
> >> FrameworkFactory frameworkFactory = ServiceLoader.load(
> >> FrameworkFactory.class ).iterator().next();
> >>  Map<String, String> config = new HashMap<String, String>();
> >> Framework framework = frameworkFactory.newFramework( config );
> >>  framework.start();
> >>  BundleContext context = framework.getBundleContext();
> >> List<Bundle> installedBundles = new LinkedList<Bundle>();
> >>
> >> installedBundles.add( context.installBundle(
> >> "file:lib/org.apache.felix.http.bundle-2.2.0.jar" ) );
> >>  installedBundles.add( context.installBundle(
> >> "file:lib/org.apache.felix.log-1.0.1.jar" ) );
> >>  installedBundles.add( context.installBundle(
> >> "file:plugins/com.payPlum.HelloServlet_1.0.0.201206141509.jar" ) );
> >>
> >> for ( Bundle bundle : installedBundles )
> >> {
> >>  System.out.println( "Starting Bundle: " + bundle.getSymbolicName() );
> >> bundle.start();
> >>  }
> >> }
> >>
> >> Which I pulled out of a  tutorial about embedding Felix.
> >>
> >> I'm running into trouble when I get to the HelloServlet bundle. The
> >> HelloServlet bundle is the simpliest thing I could write based off of
> the
> >> HelloOSGi tutorials that were around. It's a pretty basic Activator,
> >> registering the servlet as described in the Felix docs:
> >>
> >> public void start( BundleContext context ) throws Exception
> >> {
> >>  ServiceReference<HttpService> sRef = context.getServiceReference(
> >> HttpService.class );
> >> if (sRef != null)
> >>  {
> >> HttpService service = (HttpService) context.getService( sRef );
> >>  service.registerServlet( "/hello", new HelloServlet(), null, null );
> >> }
> >>  }
> >>
> >> The HelloServlet bundle has org.osgi.framework and
> org.osgi.service.http in
> >> the "Import-Package" part of the manifest.
> >>
> >> When I run everything, I get a "Unable to resolve 4.0: missing
> requirement
> >> [4.0] osgi.wiring.package;
> >> (&(osgi.wiring.package=org.osgi.service.http)(version>=1.2.1))"
> exception
> >> when starting the HelloServlet bundle. I assume this is because my Felix
> >> container isn't registering th http-bundle properly.
> >>
> >> How do I get this sort of thing to work in an embedded scenario like
> this?
> >>
> >> FWIW, I had: config.put( Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA,
> >> "org.osgi.service.http; version=4.0.0" ); Iin there and, when that
> >> happened, I was getting a NoClassDefFoundError NamespaceException,
> assuming
> >> that it was looking for something other than the felix.http.bundle.
> >>
> >> I really appreciate any help you guys can give me. Thanks!
> >>
> >> E
> >>
>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/>
> Committer & Project Lead
> OPS4J Pax for Vaadin
> <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project
> Lead
> blog <http://notizblog.nierbeck.de/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to