blob: 95a22c38dd02fd047abf649b56eb3093230d6d7a [file] [log] [blame]
Chris Custine9b56f8b2009-10-22 15:18:51 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
Guillaume Nodet91fab3b2009-04-27 10:01:58 +000017
Chris Custine9b56f8b2009-10-22 15:18:51 +000018EMBEDDING KARAF IN A WEB APPLICATION
19====================================
20
21Purpose
22-------
23Embed Karaf in a web application.
24
25
26Prerequisites for Running the Example
27-------------------------------------
28You must have the following installed on your machine:
29
30 - JDK 1.5 or higher
31
32 - Maven 2.0.9 or higher
33
34
35Building and Deploying
36----------------------
37You can build and deploy this example in two ways:
38
39- A. Using Jetty: Quick and Easy
40 This option is useful if you want to see the example up and
41 running quickly.
42
43- B. Using Your Favorite Web Container
44 This option is useful if you want to see Karaf running
45 as a web application inside your favorite web container.
46
47
48A. Using Jetty: Quick and Easy
49------------------------------
50To build the example and deploy to Jetty, complete the
51following steps:
52
531. In a command prompt/shell, change to the directory
54 that contains this README.txt file.
55
562. Enter the following Maven command:
57
58 mvn package jetty:run
59
60This Maven command builds the example web application, starts
61Jetty and deploys the web application to Jetty. Once complete,
62you should see the following printed to the console:
63
64[INFO] Started Jetty Server
65[INFO] Starting scanner at interval of 10 seconds.
66
67Running a Client
68----------------
69To test the example, you can use the Apache Felix Karaf client
70to connect to the server and issue a Karaf command. For example,
71try executing the "features:list" command as follows:
72
731. In a command prompt/shell, change to your product
74 installation directory.
75
762. Run the following command:
77
78 java -jar lib/karaf-client.jar features:list
79
80In this case, you should see output similar to the following:
81
82[uninstalled] [2.5.6.SEC01 ] spring karaf-${version}
83[uninstalled] [1.2.0 ] spring-dm karaf-${version}
84[uninstalled] [1.1.0.1-fuse-SNAPSHOT] wrapper karaf-${version}
85[uninstalled] [1.1.0.1-fuse-SNAPSHOT] obr karaf-${version}
86[uninstalled] [1.1.0.1-fuse-SNAPSHOT] http karaf-${version}
87[uninstalled] [1.1.0.1-fuse-SNAPSHOT] webconsole karaf-${version}
88[installed ] [1.1.0.1-fuse-SNAPSHOT] ssh karaf-${version}
89[installed ] [1.1.0.1-fuse-SNAPSHOT] management karaf-${version}
90
91
92B. Using Your Favorite Web Container
93------------------------------------
94You can deploy the web application to your favorite web
95container, by completing the following steps:
96
971. In a command prompt/shell, change to the directory
98 that contains this README.txt file.
99
1002. Enter the following command:
101
102 mvn package
103
104Maven builds the web application, web-${version}.war, and
105saves it in the target directory of this example. Deploy this
106WAR file to your favorite web container. Once the application
107is running, you can test it using the Apache Felix Karaf client
108as described in the "Running a Client" section above.