Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Jetty/Feature/JBoss"

< Jetty‎ | Feature
(New page: == Configuring Jetty in JBoss == To build and run Jetty in JBoss, you need the following: # JDK 1.4 (for JBoss 4.0.5) or JDK 1.5 (for JBoss 4.2.x) - what about JBoss 5 and 6 (released 12...)
 
m
Line 3: Line 3:
 
To build and run Jetty in JBoss, you need the following:
 
To build and run Jetty in JBoss, you need the following:
  
# JDK 1.4 (for JBoss 4.0.5) or JDK 1.5 (for JBoss 4.2.x) - what about JBoss 5 and 6 (released 12/28/10) and 7 (beta)?
+
# JDK 1.4 (for JBoss 4.0.5) or JDK 1.5 (for JBoss 4.2.x)  
 
# Maven 2.0.4 or later
 
# Maven 2.0.4 or later
 
# A JBoss installation  
 
# A JBoss installation  
 
# JBoss-Jetty module in Jetty (this is in the Jetty-src, under contrib/jboss)
 
# JBoss-Jetty module in Jetty (this is in the Jetty-src, under contrib/jboss)
  
Note: It is not possible to build the Jetty-JBoss module with versions of JBoss prior to 4.0.5. For '''runtime''' compability, see the [#JBoss-matrix Compatibility Matrix] below. Some JBoss 4.0.x versions require jsp-2.0 to be used, as the JBoss web console application appears to be incompatible with jsp-2.1.
+
{{note|It is not possible to build the JBoss-Jetty module with versions of JBoss prior to 4.0.5. For ''runtime'' compability, see the [[#Compatibility Matrix]] below. Some JBoss 4.0.x versions require jsp-2.0, as the JBoss web console application appears to be incompatible with jsp-2.1.}}
  
==Building the Jetty-JBoss Module==
+
==Building the JBoss-Jetty Module==
  
After checking out the Jetty-JBoss module, go to the command line and <tt>cd</tt> to its home directory. Run:
+
After checking out the JBoss-Jetty module, go to the command line and <tt>cd</tt> to its home directory. Run:
  
 
<source lang="java">
 
<source lang="java">
Line 22: Line 22:
 
where:
 
where:
  
* '''path-to-jboss''' is the location of your JBoss installation and '''jboss-version''' is the version number of your JBoss installation.
+
* ''path-to-jboss'' is the location of your JBoss installation and ''jboss-version'' is the version number of your JBoss installation.
* building with profile '''jdk1.4''' includes '''jsp-2.0''' in the SAR, and building with profile '''jdk1.5''' includes '''jsp-2.1''' instead.
+
* building with profile jdk1.4 includes jsp-2.0 in the SAR, and building with profile jdk1.5 includes jsp-2.1 instead.
  
 
Another way to build it is to edit the <tt>pom.xml</tt>. Edit the <properties> section and fill in the values for the <jboss.home> and <jboss.version> properties. Once you set these in the <tt>pom.xml</tt>, you can do the build with:
 
Another way to build it is to edit the <tt>pom.xml</tt>. Edit the <properties> section and fill in the values for the <jboss.home> and <jboss.version> properties. Once you set these in the <tt>pom.xml</tt>, you can do the build with:
Line 33: Line 33:
 
</source>
 
</source>
  
=== Installing the Jetty-JBoss Module ===
+
== Installing the Jetty-JBoss Module ==
  
 
# Delete the Tomcat files. In JBoss 4.0.x, delete <tt>$JBOSS-HOME/server/default/deploy/jbossweb-tomcat55.sar</tt><nowiki>; in JBoss 4.2.x, delete </nowiki><tt>$JBOSS-HOME/server/default/deploy/jboss-web.deployer</tt> (or from whichever deployment directory you are using).
 
# Delete the Tomcat files. In JBoss 4.0.x, delete <tt>$JBOSS-HOME/server/default/deploy/jbossweb-tomcat55.sar</tt><nowiki>; in JBoss 4.2.x, delete </nowiki><tt>$JBOSS-HOME/server/default/deploy/jboss-web.deployer</tt> (or from whichever deployment directory you are using).
# Ensure you have built the Jetty-JBoss module in <tt>$jetty.home/modules/contrib/jetty-jboss</tt>
+
# Ensure you have built the Jetty-JBoss module in <tt>$jetty.home/modules/contrib/jetty-jboss</tt>.
# Copy the <tt>$jetty.home/modules/contrib/jetty-jboss/target/jetty-JETTY-VERSION-jboss-JBOSS-VERSION.sar</tt> to your JBoss deploy directory (where '''JETTY-VERSION''' is the version of jetty you are using and '''JBOSS-VERSION''' is the version of JBoss).
+
# Copy the <tt>$jetty.home/modules/contrib/jetty-jboss/target/jetty-JETTY-VERSION-jboss-JBOSS-VERSION.sar</tt> to your JBoss deploy directory (where '''JETTY-VERSION''' is the version of Jetty you are using and '''JBOSS-VERSION''' is the version of JBoss).
 +
# Notice that the JBoss web-console refers to a Tomcat servlet; you might want to comment that out to make it usable. To do so, edit the <tt>$JBOSS-HOME/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/web.xml</tt> file and comment out this section:
  
Notice that the JBoss web-console refers to a Tomcat servlet; you might want to comment that out to make it usable. To do so, edit the <tt>$JBOSS-HOME/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/web.xml</tt> file and comment out this section:
+
<source lang="java">
 
+
<Souce lang="java">
+
  
 
   
 
   
Line 58: Line 57:
 
=== Configuring the JettyJBoss Module ===
 
=== Configuring the JettyJBoss Module ===
  
By default, Jetty is configured to:
+
By default, Jetty is configured with the following:
  
* have a thread pool containing a minimum of 10 and a maximum of 250 threads
+
* A thread pool containing a minimum of 10 and a maximum of 250 threads
* a [http://download.eclipse.org/jetty/stable-7/apidocs/index.html?org/eclipse/jetty/server/nio/SelectChannelConnector.html SelectChannelConnector] on port 8080
+
* A [http://download.eclipse.org/jetty/stable-7/apidocs/index.html?org/eclipse/jetty/server/nio/SelectChannelConnector.html SelectChannelConnector] on port 8080
  
 
This configuration is contained in the <tt>META-INF/jboss-service.xml</tt> file inside the SAR.
 
This configuration is contained in the <tt>META-INF/jboss-service.xml</tt> file inside the SAR.
  
To change the port, add other types of connectors- [/display/JETTY/Ssl+Connector+Guide SSL], [/display/JETTY/Configuring+AJP13+Using+mod_jk AJP13] - configure a [/display/JETTY/Logging+Requests request log], or change the [/display/JETTY/Bounded+ThreadPool thread pool], you need to un-pack the SAR to a temporary directory, edit the <tt>META-INF/jboss-service.xml</tt> file, repack it and copy the modified SAR to the JBoss deploy directory.
+
To change the port, add other types of connectors–([[Jetty/Reference/SSL_Connectors|SSL]], [[Jetty/Howto/Configure_AJP13|AJP13]]–configure a [[Jetty/Howto/Configure_Request_Logs|request log]], or change the [http://download.eclipse.org/jetty/stable-7/apidocs/index.html?org/eclipse/jetty/util/thread/QueuedThreadPool.html thread pool], you need to un-pack the SAR to a temporary directory, edit the <tt>META-INF/jboss-service.xml</tt> file, repack it and copy the modified SAR to the JBoss deploy directory.
  
 
=== Enabling Statistics ===
 
=== Enabling Statistics ===
Line 88: Line 87:
 
Now re-jar the modified SAR. You can use the StatisticsHandlerMBean to retrieve the statistics using the JMX console.
 
Now re-jar the modified SAR. You can use the StatisticsHandlerMBean to retrieve the statistics using the JMX console.
  
<div class="panelMacro">
 
 
{| class="tipMacro"
 
|-
 
| valign="top" |
 
[[Image:check.gif]]
 
| Using jetty-7 there is an org.eclipse.jetty.servlet.StatisticsServlet that you can configure in the JBoss management webapps instead of the Tomcat org.jboss.web.tomcat.service.StatusServlet servlet.
 
|}
 
  
</div>
+
{{note|Jetty 7 has a [http://download.eclipse.org/jetty/stable-7/apidocs/index.html?org/eclipse/jetty/servlet/StatisticsServlet.html Statistics Servlet] that you can configure in the JBoss management webapps instead of the Tomcat org.jboss.web.tomcat.service.StatusServlet servlet.}}
  
=== Configuration note about Jetty-SAR and Struts Tiles usage ===
+
=== Using Jetty-SAR and Struts Tiles ===
  
 
If you are using Struts Tiles for your web-application, you should probably edit <tt>webdefault.xml</tt> in the SAR and change <tt>dirAllowed</tt> to <tt>false</tt>. If you do not, when you try to insert a tile value (or override one) with an empty value, then Jetty will supply a directory listing for that tile.
 
If you are using Struts Tiles for your web-application, you should probably edit <tt>webdefault.xml</tt> in the SAR and change <tt>dirAllowed</tt> to <tt>false</tt>. If you do not, when you try to insert a tile value (or override one) with an empty value, then Jetty will supply a directory listing for that tile.
  
==Versions Matrix==
+
==Compatibility Matrix==
  
 
<br /> Version compatibility matrix:
 
<br /> Version compatibility matrix:
Line 110: Line 101:
  
 
|-
 
|-
! scope=col width ="50" | Jetty Version
+
! scope=col width ="75" | Jetty Version
! scope=col width ="50" | JBoss Version
+
! scope=col width ="75" | JBoss Version
! scope=col width ="50" | JVM Version
+
! scope=col width ="75" | JVM Version
 
|-
 
|-
 
| 6.1.0
 
| 6.1.0

Revision as of 15:08, 21 April 2011

Configuring Jetty in JBoss

To build and run Jetty in JBoss, you need the following:

  1. JDK 1.4 (for JBoss 4.0.5) or JDK 1.5 (for JBoss 4.2.x)
  2. Maven 2.0.4 or later
  3. A JBoss installation
  4. JBoss-Jetty module in Jetty (this is in the Jetty-src, under contrib/jboss)
Note.png
It is not possible to build the JBoss-Jetty module with versions of JBoss prior to 4.0.5. For runtime compability, see the #Compatibility Matrix below. Some JBoss 4.0.x versions require jsp-2.0, as the JBoss web console application appears to be incompatible with jsp-2.1.


Building the JBoss-Jetty Module

After checking out the JBoss-Jetty module, go to the command line and cd to its home directory. Run:

 mvn -P[jdk1.4|jdk1.5] -Djboss.home=path-to-jboss -Djboss.version=jboss-version clean install

where:

  • path-to-jboss is the location of your JBoss installation and jboss-version is the version number of your JBoss installation.
  • building with profile jdk1.4 includes jsp-2.0 in the SAR, and building with profile jdk1.5 includes jsp-2.1 instead.

Another way to build it is to edit the pom.xml. Edit the <properties> section and fill in the values for the <jboss.home> and <jboss.version> properties. Once you set these in the pom.xml, you can do the build with:

 mvn clean install

Installing the Jetty-JBoss Module

  1. Delete the Tomcat files. In JBoss 4.0.x, delete $JBOSS-HOME/server/default/deploy/jbossweb-tomcat55.sar; in JBoss 4.2.x, delete $JBOSS-HOME/server/default/deploy/jboss-web.deployer (or from whichever deployment directory you are using).
  2. Ensure you have built the Jetty-JBoss module in $jetty.home/modules/contrib/jetty-jboss.
  3. Copy the $jetty.home/modules/contrib/jetty-jboss/target/jetty-JETTY-VERSION-jboss-JBOSS-VERSION.sar to your JBoss deploy directory (where JETTY-VERSION is the version of Jetty you are using and JBOSS-VERSION is the version of JBoss).
  4. Notice that the JBoss web-console refers to a Tomcat servlet; you might want to comment that out to make it usable. To do so, edit the $JBOSS-HOME/server/default/deploy/management/console-mgr.sar/web-console.war/WEB-INF/web.xml file and comment out this section:
 
 <servlet>
     <servlet-name>Status Servlet</servlet-name>
     <servlet-class>org.jboss.web.tomcat.tc5.StatusServlet<span class="code-tag"></servlet-class>
 </servlet>
 
 <servlet-mapping>
     <servlet-name>Status Servlet</servlet-name>
     <url-pattern>/status</url-pattern>
 </servlet-mapping>

Configuring the JettyJBoss Module

By default, Jetty is configured with the following:

This configuration is contained in the META-INF/jboss-service.xml file inside the SAR.

To change the port, add other types of connectors–(SSL, AJP13–configure a request log, or change the thread pool, you need to un-pack the SAR to a temporary directory, edit the META-INF/jboss-service.xml file, repack it and copy the modified SAR to the JBoss deploy directory.

Enabling Statistics

Edit the META-INF/jboss-service.xml file from the SAR (you need to unpack it first). Uncomment the following lines:

 
    <!-- Uncomment for statistics
       <New id="StatsHandler" class="org.eclipse.jetty.handler.StatisticsHandler">
        <Set name="handlers">
     -->
 
     <!-- Uncomment for statistics
       </Set>
      </New>
     -->

Now re-jar the modified SAR. You can use the StatisticsHandlerMBean to retrieve the statistics using the JMX console.


Note.png
Jetty 7 has a Statistics Servlet that you can configure in the JBoss management webapps instead of the Tomcat org.jboss.web.tomcat.service.StatusServlet servlet.


Using Jetty-SAR and Struts Tiles

If you are using Struts Tiles for your web-application, you should probably edit webdefault.xml in the SAR and change dirAllowed to false. If you do not, when you try to insert a tile value (or override one) with an empty value, then Jetty will supply a directory listing for that tile.

Compatibility Matrix


Version compatibility matrix:

Jetty Version JBoss Version JVM Version
6.1.0 4.0.5.GA JDK 1.4
6.1.1 4.0.5.GA JDK 1.4
6.1.2 4.0.5.GA JDK 1.4
6.1.3 4.0.5.GA JDK 1.4
6.1.4 4.0.5.GA JDK 1.4
6.1.5 4.0.5.GA JDK 1.4
6.1.6 4.0.5.GA JDK 1.4
6.1.6 4.2.0.GA JDK 1.5
6.1.8 4.0.5.GA JDK 1.5
6.1.12rc2 4.2.3 GA JDK 1.5
6.1.17 4.0.5.GA JDK 1.5
6.1.18 4.0.5.GA JDK 1.5
6.1.21 4.2.3.GA JDK1.5

Back to the top