Use glassfish3 to publish osgi applications

Source: Internet
Author: User
Tags glassfish
1. First knowledge of osgi

Osgi features: Hot swapping and modular programming. It seems very attractive, but if you are a beginner, I think you will be suffering from a lot of problems at the beginning. Many concepts need to be understood, and many mistakes are just ClassNoFinded, you may be bored. There are also so many annoying configurations when constructing an osgi project (for details about how to build an eclipse-based osgi application, refer to Lin Hao's open doc, of course, you can also buy the OSGi principle and best practice he wrote. I personally feel a little old, but as a beginner, without other better Chinese materials, still worth reading)

2. osgi application debugging and release

After a period of understanding of OSGi, it is easy to build, debug, and release OSGi applications. Maven-bundle-plugin can be used for building. This maven plug-in can be used for debugging.

For more information, see the following example:

Http://www.ops4j.org/projects/pax/construct/

Release: I use glassfish3 here. glassfish itself is a basic OSGi web Application server and provides support for Web Application Bundle (WAB), which is part of OSGi specification 4.2. You can easily publish web applications.

After downloading glassfish3, start it with bin/asadmin. bat and enter start-domain.

Open http: // 127.0.0.1: 8080 to view the glassfish document page.

Http: // 127.0.0.1: 4848 is the Management page

If everything goes well, you can copy the bundle you made to domains/domain1/autodeploy/bundles to release your bundle. If it still doesn't work,

You also need to perform the following operations (this problem does not exist for the latest version ):

asadmin delete-jvm-options --target server-config -Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command
asadmin create-jvm-options --target server-config -Dorg.glassfish.additionalOSGiBundlesToStart=org.apache.felix.shell,org.apache.felix.gogo.runtime,org.apache.felix.gogo.shell,org.apache.felix.gogo.command,org.apache.felix.shell.remote,org.apache.felix.fileinstall


In this way, you can directly copy your bundleDomains/domain1/autodeploy/bundles,

How can I view the status of your released bundle?

Cmd

Telnet local host 6666
It is equivalent to opening the felix Console (glassfish is based on felix by default)

In this case, you can enter help to view available commands,

Common Commands include:

You can add-l to the bundle list to display the position of the bundle.
Start n starts a bundle n as the bundle id .. You can see this number in the ps command.
Stop n stop a bundle
Install url to install a bundle
Update n update a bundle

For the help of a single command, you can use help ps

More articles worth your reference include:

Http://blogs.oracle.com/arungupta/entry/osgi_application_development_using_glassfish

Http://netbeans.org/kb/docs/javaee/maven-osgiservice-cdi.html? Intcmp = 1, 925655

This article is not original. For more information, see the source and share my happiness with you.
Http://www.cnblogs.com/weirhp

 

 

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.