Is it possible to install and start a non-OSGi war from maven?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Is it possible to install and start a non-OSGi war from maven?

Steinar Bang
Hi,

Is it possible to start a non-OSGi war from maven?

I tried
 karaf@root()> feature:install war
 karaf@root()> bundle:install wrap:mvn:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
 Bundle ID: 104
 karaf@root()> bundle:list
 START LEVEL 100 , List Threshold: 50
  ID | State     | Lvl | Version | Name
 ----+-----------+-----+---------+--------------------------------------------------------------------------
  28 | Active    |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
 104 | Installed |  80 | 0       | wrap_mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
 karaf@root()> bundle:start 104
 karaf@root()> bundle:list
 START LEVEL 100 , List Threshold: 50
  ID | State  | Lvl | Version | Name
 ----+--------+-----+---------+-----------------------------------------------------------------------------
  28 | Active |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
 104 | Active |  80 | 0       | wrap_mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
 karaf@root()>

But as far as I could tell nothing was up and running.

Is there some extra invocation that would make the war start?

Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to install and start a non-OSGi war from maven?

jbonofre
Hi Steinar,

You should not use wrap here but directly war as pax-web provides a war extender.

So, using web protocol with war artifact should work.

Regards
JB

On 12/19/2017 10:39 PM, Steinar Bang wrote:

> Hi,
>
> Is it possible to start a non-OSGi war from maven?
>
> I tried
>   karaf@root()> feature:install war
>   karaf@root()> bundle:install wrap:mvn:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
>   Bundle ID: 104
>   karaf@root()> bundle:list
>   START LEVEL 100 , List Threshold: 50
>    ID | State     | Lvl | Version | Name
>   ----+-----------+-----+---------+--------------------------------------------------------------------------
>    28 | Active    |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
>   104 | Installed |  80 | 0       | wrap_mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
>   karaf@root()> bundle:start 104
>   karaf@root()> bundle:list
>   START LEVEL 100 , List Threshold: 50
>    ID | State  | Lvl | Version | Name
>   ----+--------+-----+---------+-----------------------------------------------------------------------------
>    28 | Active |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
>   104 | Active |  80 | 0       | wrap_mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
>   karaf@root()>
>
> But as far as I could tell nothing was up and running.
>
> Is there some extra invocation that would make the war start?
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to install and start a non-OSGi war from maven?

Steinar Bang
>>>>> Jean-Baptiste Onofré <[hidden email]>:

> You should not use wrap here but directly war as pax-web provides a war extender.

> So, using web protocol with war artifact should work.

Hi, thanks,

I tried with "war:" but didn't have more success with that.  Are there
console commands that can be used to query the war extender for what/if
anything has been picked up? (it could be the path setting that is wrong...?)

 karaf@root()> feature:install war
 karaf@root()> bundle:install war:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
 Bundle IDs:
 Error executing command: Error installing bundles:
         Unable to install bundle war:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war: org.osgi.framework.BundleException: Unable to cache bundle: war:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
 karaf@root()> bundle:install war:mvn:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
 Bundle ID: 105
 karaf@root()> bundle:list
 START LEVEL 100 , List Threshold: 50
  ID | State     | Lvl | Version | Name
 ----+-----------+-----+---------+-------------------------------------------------------------------
  28 | Active    |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
 105 | Installed |  80 | 0       | mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
 karaf@root()> bundle:start 105
 karaf@root()> bundle:list
 START LEVEL 100 , List Threshold: 50
  ID | State  | Lvl | Version | Name
 ----+--------+-----+---------+----------------------------------------------------------------------
  28 | Active |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
 105 | Active |  80 | 0       | mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
 karaf@root()>

Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to install and start a non-OSGi war from maven?

jbonofre
Did you take a look on the documentation ?

https://karaf.apache.org/manual/latest/webcontainer

You can see the usage of webbundle to deploy war and the corresponding command.

Regards
JB

On 12/20/2017 08:04 AM, Steinar Bang wrote:

>>>>>> Jean-Baptiste Onofré <[hidden email]>:
>
>> You should not use wrap here but directly war as pax-web provides a war extender.
>
>> So, using web protocol with war artifact should work.
>
> Hi, thanks,
>
> I tried with "war:" but didn't have more success with that.  Are there
> console commands that can be used to query the war extender for what/if
> anything has been picked up? (it could be the path setting that is wrong...?)
>
>   karaf@root()> feature:install war
>   karaf@root()> bundle:install war:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
>   Bundle IDs:
>   Error executing command: Error installing bundles:
>           Unable to install bundle war:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war: org.osgi.framework.BundleException: Unable to cache bundle: war:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
>   karaf@root()> bundle:install war:mvn:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war
>   Bundle ID: 105
>   karaf@root()> bundle:list
>   START LEVEL 100 , List Threshold: 50
>    ID | State     | Lvl | Version | Name
>   ----+-----------+-----+---------+-------------------------------------------------------------------
>    28 | Active    |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
>   105 | Installed |  80 | 0       | mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
>   karaf@root()> bundle:start 105
>   karaf@root()> bundle:list
>   START LEVEL 100 , List Threshold: 50
>    ID | State  | Lvl | Version | Name
>   ----+--------+-----+---------+----------------------------------------------------------------------
>    28 | Active |  80 | 4.1.2   | Apache Karaf :: OSGi Services :: Event
>   105 | Active |  80 | 0       | mvn_no.priv.bang.sinna_sinna-application_1.0.0-SNAPSHOT_war
>   karaf@root()>
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Is it possible to install and start a non-OSGi war from maven?

Steinar Bang
>>>>> Jean-Baptiste Onofré <[hidden email]>:

> Did you take a look on the documentation ?
> https://karaf.apache.org/manual/latest/webcontainer

> You can see the usage of webbundle to deploy war and the corresponding command.

Ok, the correct invocations are:
 karaf@root()> feature:install war
 karaf@root()> bundle:install -s "webbundle:mvn:no.priv.bang.sinna/sinna-application/1.0.0-SNAPSHOT/war?Bundle-SymbolicName=sinna-war&Web-ContextPath=/sinna"
 Bundle ID: 104
 karaf@root()> web:list
 ID  | State       | Web-State   | Level | Web-ContextPath  | Name
 ----+-------------+-------------+-------+------------------+--------------
 104 | Active      | Deploying   | 80    | /sinna           | sinna-war (0)
 karaf@root()> web:list
 ID  | State       | Web-State   | Level | Web-ContextPath  | Name
 ----+-------------+-------------+-------+------------------+--------------
 104 | Active      | Deployed    | 80    | /sinna           | sinna-war (0)
 karaf@root()>