You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Jean-Baptiste Onofré <jb...@nanthrax.net> on 2012/08/19 01:24:58 UTC

Re: Embedding in webapp

Hi, sorry for the delay in the answer.

Do you use a "standard" Karaf directory structure in 
/opt/tomcat/webapps/osgi ? I mean, do you have the etc folder, the 
deploy folder, etc.

If so, calling launc() on Karaf main will load etc/config.properties, 
and so will try to start a "normal" Karaf process including the startup 
of features defined in org.apache.karaf.features.cfg, loading the 
fileinstall handling the deploy folder, etc.

Regards
JB

On 07/28/2012 08:27 AM, Mansour Al Akeel wrote:
> I need to start karaf from a web application. I have it embedded,
> however I need to include sshd, and hot deploy services. Here's the code
> I have so far:
>
> private void initOSGIContainer() {
>          org.apache.karaf.main.Main m = new org.apache.karaf.main.Main(
>                  new String[] { "server" });
>
>          String KARAF_HOME = "/opt/tomcat/webapps/osgi/";
>
>          Path homeDir = Paths.get(KARAF_HOME);
>          if (!homeDir.toFile().exists())
>              homeDir.toFile().mkdirs();
>
>          System.setProperty(Main.PROP_KARAF_HOME, KARAF_HOME);
>          try {
>              m.launch();
>          } catch (Exception e1) {
>              e1.printStackTrace();
>          }
>
>      }
>
>
> Any advice about how to include the sshd shell and be able to deploy
> bundles by copying them to the "/deploy" directory.
> Thank you.

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com