Jump to: navigation, search

Difference between revisions of "Jetty/Tutorial/EclipseRT-Jetty-Starter-Kit"

m
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Jetty Tutorial
 
{{Jetty Tutorial
 
| introduction =  
 
| introduction =  
This tutorial shows how to use the EclipseRT Jetty StarterKit.
+
This tutorial shows how to use the EclipseRT Jetty Starter Kit.
  
 
| details =  
 
| details =  
  
== StarterKit Overview ==
+
== Starter Kit Overview ==
Eclipse RT StarterKit is configured out of the box with
+
EclipseRT Jetty Starter Kit is configured out of the box with
 
* Equinox
 
* Equinox
* P2 support: simpleconfigurator, dropins reconciler, provisioning commands for the OSGi console
+
* p2 support: simpleconfigurator, dropins reconciler, provisioning commands for the OSGi console
 
* slf4j, logback
 
* slf4j, logback
* Jetty-7: servlet-2.5, JSP-2.1, JMX, JNDI, JTA, Websocket and continuations...
+
* Jetty-7: servlet-2.5, JSP-2.1, JMX, JNDI, JTA, Websocket and continuations, OSGi HttpService with equinox.http.servlet ...
* SDK extras: sources, JUnit support and PDE files.
+
* Development additions: sources, JUnit support and PDE files.
  
Current download URL: http://download.eclipse.org/jetty/7.1.3.v20100526/dist/eclipse/
+
Current download URL: http://download.eclipse.org/jetty/7.1.4.v20100610/dist-eclipse/
  
 
== On the command-line ==
 
== On the command-line ==
Line 19: Line 19:
 
=== Launch ===
 
=== Launch ===
 
The starter kit can be launched via the equinox native launcher or directly through java.
 
The starter kit can be launched via the equinox native launcher or directly through java.
 +
Regardless of the platform, the starter kit is packaged with simple shell scripts "start.bat" and "start.sh".
 +
Note that those scripts don't read the ini file read by the native launcher.
  
 
=== Jetty server configuration ===
 
=== Jetty server configuration ===
Line 27: Line 29:
  
 
=== Upgrade and bundle management ===
 
=== Upgrade and bundle management ===
Via P2 (link to the P2 console command controles and the P2 admin UI.)
+
Via p2 (link to the p2 console command controles and the p2 admin UI.)
 +
For example one can add JPA to the starter kit using the p2 provisioning commands:
 +
<source lang="text">
 +
osgi> provaddrepo http://download.eclipse.org/releases/helios
 +
 
 +
osgi> provliu http://download.eclipse.org/releases/helios
 +
...
 +
org.eclipse.persistence.jpa 2.1.0.v20100608-r7540
 +
...
 +
 
 +
osgi> provinstall org.eclipse.persistence.jpa 2.1.0.v20100608-r7540
 +
Installation complete for org.eclipse.persistence.jpa 2.1.0.v20100608-r7540
 +
                                                                                                                                                                                           
 +
</source>
 +
Note that it can take several minutes to install JPA for example.
 +
Note: Please refer to the documentation of each feature added.
 +
 
 +
For example EclipseLink in Helios requires that javax.persistence starts before org.eclipse.persistence.jpa.
 +
[[EclipseLink/Examples/OSGi/Equinox_Byte_Code_Weaving#Equinox_Configuration]]
 +
 
 +
One could also use the p2 Admin application to do this or an ant script as documented by the p2 project.
  
 
=== Dropins reconciler ===
 
=== Dropins reconciler ===
It is possible to add bundles in the dropins folder.
+
It is possible to add bundles in the dropins folder. This is only for development purposes.
This is not a recommended practice.
+
For production it is recommended to publish your bundles and features in a p2 repository and use p2 to install them into the Starter Kit.
  
 
=== J2EE support ===
 
=== J2EE support ===
Line 41: Line 63:
  
 
== With Eclipse PDE ==
 
== With Eclipse PDE ==
The SDK version of the starter kit is packaged with a PDE related files.
+
The version with sources of the starter kit is packaged with a set of files for the PDE.
 
This makes it faster to define the corresponding target platform and launch configuration.
 
This makes it faster to define the corresponding target platform and launch configuration.
  
Line 62: Line 84:
 
  -Djetty.home=${workspace_loc:Jetty Starter Kit} -Dlogback.configurationFile=${workspace_loc:Jetty Starter Kit}/etc/logback.xml
 
  -Djetty.home=${workspace_loc:Jetty Starter Kit} -Dlogback.configurationFile=${workspace_loc:Jetty Starter Kit}/etc/logback.xml
 
</source>
 
</source>
 +
 +
[[Image:17-JOT-Jetty-StarterKit-Launch-Config.png|center|launch Configuration with the EclipseRT Starter Kit]]
  
 
=== Web-bundles and test units ===
 
=== Web-bundles and test units ===
Please refer to [[Jetty/Tutorial/Jetty-OSGi_SDK|Jetty OSGi Target Platform, tutorial]]
+
Please refer to [[Jetty/Tutorial/Jetty-OSGi_SDK#Create_a_first_web-bundle|Jetty OSGi Target Platform, tutorial; Create_a_first_web-bundle]]
  
 
| more = [[Jetty/Feature/Jetty_OSGi|Jetty-OSGi]], [[Jetty/Tutorial/Jetty-OSGi_SDK|Jetty OSGi Target Platform, tutorial]], RFC66, PDE
 
| more = [[Jetty/Feature/Jetty_OSGi|Jetty-OSGi]], [[Jetty/Tutorial/Jetty-OSGi_SDK|Jetty OSGi Target Platform, tutorial]], RFC66, PDE
 
| category = [[Category:Jetty]] [[Category:OSGi]]
 
| category = [[Category:Jetty]] [[Category:OSGi]]
 
}}
 
}}

Revision as of 11:03, 14 June 2010



Introduction

This tutorial shows how to use the EclipseRT Jetty Starter Kit.

Details

Starter Kit Overview

EclipseRT Jetty Starter Kit is configured out of the box with

  • Equinox
  • p2 support: simpleconfigurator, dropins reconciler, provisioning commands for the OSGi console
  • slf4j, logback
  • Jetty-7: servlet-2.5, JSP-2.1, JMX, JNDI, JTA, Websocket and continuations, OSGi HttpService with equinox.http.servlet ...
  • Development additions: sources, JUnit support and PDE files.

Current download URL: http://download.eclipse.org/jetty/7.1.4.v20100610/dist-eclipse/

On the command-line

Launch

The starter kit can be launched via the equinox native launcher or directly through java. Regardless of the platform, the starter kit is packaged with simple shell scripts "start.bat" and "start.sh". Note that those scripts don't read the ini file read by the native launcher.

Jetty server configuration

The jetty server is configured via the etc/jetty.xml file.

Logging configuration

slf4j, logback: configured in etc/logback.xml

Upgrade and bundle management

Via p2 (link to the p2 console command controles and the p2 admin UI.) For example one can add JPA to the starter kit using the p2 provisioning commands:

osgi> provaddrepo http://download.eclipse.org/releases/helios
 
osgi> provliu http://download.eclipse.org/releases/helios
...
org.eclipse.persistence.jpa 2.1.0.v20100608-r7540
...
 
osgi> provinstall org.eclipse.persistence.jpa 2.1.0.v20100608-r7540
Installation complete for org.eclipse.persistence.jpa 2.1.0.v20100608-r7540

Note that it can take several minutes to install JPA for example. Note: Please refer to the documentation of each feature added.

For example EclipseLink in Helios requires that javax.persistence starts before org.eclipse.persistence.jpa. EclipseLink/Examples/OSGi/Equinox_Byte_Code_Weaving#Equinox_Configuration

One could also use the p2 Admin application to do this or an ant script as documented by the p2 project.

Dropins reconciler

It is possible to add bundles in the dropins folder. This is only for development purposes. For production it is recommended to publish your bundles and features in a p2 repository and use p2 to install them into the Starter Kit.

J2EE support

  • Web application can be dropped in the webapps folder.
  • Jetty Context files can be defined in the contexts folder.
  • Shared libraries between webapps can be placed inside lib/ext.

The resulting applications's classloaders behave in the same manner than in the traditional J2EE distribution of Jetty. Those web-applications and shared libraries don't have access to classes provided by OSGi bundles.

With Eclipse PDE

The version with sources of the starter kit is packaged with a set of files for the PDE. This makes it faster to define the corresponding target platform and launch configuration.

Import the Starter Kit in the workspace

Import the downloaded starter kit as a Eclipse Project into your workspace. The project is called "EclipseRT Jetty Starter Kit".

Setup the Target Platform

At the root of the project, open the JettyStarterKitSDK.target file. Click on the top left on "Set As Target Platform."

Define the Target Platform

Note: You can also use the Target Platform definition wizard instead.

Launch configuration

The launch configuration "Start Jetty" is preset.

To create one from scratch, make a new OSGi launch configuration. Add the following system properties to the VM arguments:

 -Djetty.home=${workspace_loc:Jetty Starter Kit} -Dlogback.configurationFile=${workspace_loc:Jetty Starter Kit}/etc/logback.xml
launch Configuration with the EclipseRT Starter Kit

Web-bundles and test units

Please refer to Jetty OSGi Target Platform, tutorial; Create_a_first_web-bundle

Additional Resources

Jetty-OSGi, Jetty OSGi Target Platform, tutorial, RFC66, PDE