karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Nierbeck <bcanh...@googlemail.com>
Subject Re: war deployment servlet spec 3
Date Fri, 28 Jul 2017 05:53:55 GMT
Hi Matt,

it depends on what kind of Servlet3 application you deploy.
As Karaf doesn't use jetty directly but uses Pax Web as intermediate layer
for the deployment and management of web applications in an OSGi manner.
Actually you can also replace Jetty with undertow or Tomcat.

Never the less, you have a couple different ways of deploying your web
application.
1)
Let's go the easiest for non OSGi people. You drop your non-OSGi war in the
deploy folder or
install it with a war-URL handler attached, e.g.
war:my.groupId/myArtifact/version
That'll make sure your non-OSGi war is transformed into a OSGi war where
the myArtifact will be used as the web-ContextPath.

2)
You create a OSGi war, and add a web-ContextPath to it.
These WABs just need this manifest header, which makes sure the wab is
going to be identified as such.
2a) use a regular WAR with web.xml, the WAB-Extender will make sure to
retrieve everthing needed from the web.xml and will make sure the war is
deployed as such, but also that parts are available as OSGi services
2b) use a regular WAR without web.xml, the WEB-Extender will check for
annotated Servlet classes and will make sure the complete war is deployed
correctly, again also registering parts as services

3)
Use the HttpService, is the "old" OSGi way of registering plain Servlets
and resources, and requires an Activator class where those services are
registered with the HttpService

4)
The WebContainer (non-Standardised), is the PaxWeb Extension of the
HttpService, which provides a way to register all possible services around
servlets.

5)
The Whiteboard extender will listen to any registered Service like Servlet
and will make sure it's handled by the underlying container.
5a) the OSGi standard one, with all Props and possibilities in the spec.
5b) the original Pax Web one, which uses a different set of Properties

In your case it sounds like your looking for 2b), so make sure you do have
a web-ContextPath in the manifest header.

All kind of different ways can also be seen in the samples of Pax-Web [1]

regards, Achim

[1] - https://github.com/ops4j/org.ops4j.pax.web/tree/master/samples


2017-07-28 5:13 GMT+02:00 Matthew Shaw <Matthew.Shaw@ambulance.qld.gov.au>:

> Hi All,
>
>
>
> I’m using karaf 4.1.1 deploying a servlet 3 enabled war using the
> bundle:install command. It installs successfully and the bundle moves to a
> state of active. However the app is not starting up. On the latest karaf
> doco it does state that there needs to be a web.xml in the war for the war
> feature to work. However, I’ve noticed that internally karaf is using
> jetty9 which supports servlet 3 ie. No web.xml.
>
>
>
> How can I get this to work?
>
>
>
> Cheers,
>
> Matt.
>
> This email, including any attachments sent with it, is confidential and
> for the sole use of the intended recipient(s). This confidentiality is not
> waived or lost, if you receive it and you are not the intended
> recipient(s), or if it is transmitted/received in error.
>
> Any unauthorised use, alteration, disclosure, distribution or review of
> this email is strictly prohibited. The information contained in this email,
> including any attachment sent with it, may be subject to a statutory duty
> of confidentiality if it relates to health service matters.
>
> If you are not the intended recipient(s), or if you have received this
> email in error, you are asked to immediately notify the sender. You should
> also delete this email, and any copies, from your computer system network
> and destroy any hard copies produced.
>
> If not an intended recipient of this email, you must not copy, distribute
> or take any action(s) that relies on it; any form of disclosure,
> modification, distribution and/or publication of this email is also
> prohibited.
>
> Although the Queensland Ambulance Service takes all reasonable steps to
> ensure this email does not contain malicious software, the Queensland
> Ambulance Service does not accept responsibility for the consequences if
> any person's computer inadvertently suffers any disruption to services,
> loss of information, harm or is infected with a virus, other malicious
> computer programme or code that may occur as a consequence of receiving
> this email.
>
> Unless stated otherwise, this email represents only the views of the
> sender and not the views of the Queensland Government.
>
> ************************************************************
> ********************
>
> The content presented in this publication is distributed by the Queensland
> Government as an information source only. The State of Queensland makes no
> statements, representations or warranties about the accuracy, completeness
> or reliability of any information contained in this publication. The State
> of Queensland disclaims all responsibility and all liability (including
> without limitation for liability in negligence) for all expenses, losses,
> damages and costs you might incur as a result of the information being
> inaccurate or incomplete in any way, and for any reason reliance was placed
> on such information.
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Mime
View raw message