Developing OSGi Web examples using Maven,apache servicemix

Source: Internet
Author: User

One: Create Maven's WebApp project Ppweb

Pom.xml content is as follows:

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" ><modelversion >4.0.0</modelversion><groupid>com.lala</groupid><artifactid>ppweb</artifactid ><packaging>war</packaging><version>1.0.0</version><name>ppweb Maven Webapp< /name><url>http://maven.apache.org</url><dependencies><dependency><groupid> Junit</groupid><artifactid>junit</artifactid><version>4.12</version><scope >test</scope></dependency><dependency><groupId>javax.servlet</groupId>< Artifactid>jsp-api</artifactid><version>2.0</version><scope>provided</scope> </dependency><dependency><groupid>javax.servlet</groupid><artifactid>servlet-api </artifactid><version>2.5</version><scope>provided</scope></dependency></dependencies> <build><finalName>ppweb</finalName><plugins><plugin><groupId> Org.apache.maven.plugins</groupid><artifactid>maven-compiler-plugin</artifactid><version >3.3</version><configuration><source>1.7</source><target>1.7</target> </configuration></plugin><plugin> <groupid>org.apache.tomcat.maven</groupid&gt                  ;                  <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <path>/</path> <port>9090</port&                      Gt <uriEncoding>UTF-8</uriEncoding> </configuration> </plugin><plugi N><groupid>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.6</version>< configuration><archive><manifest><addclasspath>false</addclasspath>< classpathprefix>web-inf/lib/</classpathprefix></manifest><manifestentries>< bundle-manifestversion>2</bundle-manifestversion><class-path>${project.build.finalname}.jar< /class-path><bundle-name>${project.groupid}.${project. Artifactid}</bundle-name><bundle-symbolicname>${project.groupid}.${project. artifactid}</bundle-symbolicname><bundle-version>${project.version}</bundle-version>< Bundle-vendor>${project.groupid}</bundle-vendor><import-package>org.osgi.framework, javax.servlet.http,javax.servlet</import-package><embed-dependency>*</embed-dependency>< Dynamicimport-package>*</dynamicimport-package><web-contextpath>/ppweb</web-contextpath> <bundle-claSspath>.,web-inf/classes</bundle-classpath></manifestentries></archive></configuration ></plugin></plugins></build></project>

Note: Here's the Tomcat7-maven-plugin plugin, optional, here is for the convenience of running locally (MVN tomcat7:run)


Two:

Edit the src/main/java/webapp/index.jsp file to add some content


Three:

Download Apache-servicemix, and unzip


Four:

Packaging the above Web project, MVN package

Throw the resulting war into the Apache-servicemix's deploy directory


Finally, start Apache-servicemix, execute Bin/servicemix.bat

In the pop-up window, enter list to see the bundle lists


See, the Ppweb project here has been successfully installed.


Open the browser, enter Http://127.0.0.1:8181/ppweb, you can access

Note that the Web port defaults to 8181

Here the/ppweb, is the configuration of the above Web-contextpath, need to remain consistent

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Developing OSGi Web examples using Maven,apache servicemix

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.