I. Purpose of the document
The purpose of this article is to allow developers to enter the development stage as soon as possible, avoid spending too much energy and time on environment settings, simplify development environment settings, and improve work efficiency, play the role of R & D support.
The final expected result of this article is that readers can simply copy and paste the configuration content by following the instructions in this article and the provided environment configuration content, quickly build a static html runtime environment in the osgi environment. In addition, this article summarizes some problems that may be encountered during the development process and the solutions to the problems.
Ii. Expected readers
Developers engaged in osgi design and development in the eclipse environment.
Iii. content of this article
This article describes how to set the Equinox runtime environment in the eclipse development environment. Use an example to describe the process of environment creation.
Iv. Development Environment
JDK 1.5
Eclipse 3.3
V. Runtime Environment
Windows XP + SP2
Vi. Other Instructions
If you want to see more clearly in this article, drag and drop the image to enlarge it.
VII. Steps
1. Create an environment
1) create a plug-in project:
2) enter the project name and select equinox as the target platform:
3) no modification, next
4) no changes, finish
2. Project Structure
3. Add content
1)create a new directory webrootand an index.html File
Note: webroot is located in the root directory of the project. The index.html content is in any HTML format.
The reference content of index.html is shown in the figure below.
- <! -- Index.html reference -->
- <HTML>
- HTML hello
- </Html>
2) Create the plugin. xml file under the project root directory
The content of plugin. XML is as follows. You can directly copy the following content for use.
- <Plugin>
- <Extension point = "org. Eclipse. Equinox. http. Registry. Resources">
- <Resource
- Alias = "/Web"
- Base-name = "/webroot"/>
- </Extension>
- </Plugin>
At this time, manifest. MF will report an error.
3) Modify manifest. MF
A. Add it after bundle-symbolicname; singleton: = true
B. Add require-bundle content
The modified manifes. MF content is as follows:
- Manifest-version: 1.0
- Bundle-manifestversion: 2
- Bundle-Name: HTML plug-in
- Bundle-symbolicname: cn.tuscany.osgi.example.html; singleton: = true
- Bundle-version: 1.0.0
- Require-Bundle: org. Apache. commons. logging,
- Org. Eclipse. osgi. Services,
- Javax. servlet,
- Org. mortbay. jetty,
- Org. Eclipse. Equinox. http. jetty,
- Org. Eclipse. Equinox. http. servlet,
- Org. Eclipse. Equinox. Common,
- Org. Eclipse. Equinox. Registry,
- Org. Eclipse. Equinox. http. Registry
Note: there must be an empty line in the last line, and no space is allowed;
4. Run the application
1) Select "Run open run dialog..." from the tool menu...
2) pop-up window
3) double-click osgi framework
Click deseletc Al, modify the value of name to osgi_html_test, and then click Apply.
4) Select the cn.org.tuscany.osgi.test.html project in the workspace and click Add required bundles.
5) Click Run. The console displays the following:
6) Open IE and enter http: // localhost/web/index.html in the address bar.
7) display interface
VIII. Dependent bundle Information
Except for org. Apache. commons. Logging, other bundle comes with eclipse.
Org. Apache. commons. Logging can be found online.
IX. Possible Problems
1. manifest. MF format problems
There must be an empty row in the last line of the manifest. MF file, and there cannot be any space;
2. jetty Service Startup Problems
Check whether other Web applications on the local machine occupy port 80.
<End>