You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2017/12/19 21:39:42 UTC

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

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?


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

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:

> 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()>


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

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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é <jb...@nanthrax.net>:
> 
>> 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é
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

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

Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofré <jb...@nanthrax.net>:

> 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()>


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

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
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é
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com