Skip to content

Commit

Permalink
Issue 13 - enable JMX beans
Browse files Browse the repository at this point in the history
enable jetty jmx beans by default, because they're really useful (and
requested in issue 13)
  • Loading branch information
devfbe committed Aug 12, 2016
1 parent ec897af commit dd48220
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jarlotte-jettyinitializer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
<artifactId>apache-jsp</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>de.metacoder</groupId>
<artifactId>jarlotte-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@
package de.metacoder.jarlotte.jettyinitializer;

import de.metacoder.jarlotte.api.JarlotteInitializer;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;

import java.io.File;
import java.lang.management.ManagementFactory;

public class Initializer implements JarlotteInitializer {

Expand All @@ -42,6 +45,11 @@ public void initialize(File webAppDir) {

server = new Server(jettyPort);

MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
server.addEventListener(mbContainer);
server.addBean(mbContainer);
server.addBean(Log.getLog());

// required for working JSPs
final Configuration.ClassList classlist = Configuration.ClassList.setServerDefault( server );
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");
Expand Down

0 comments on commit dd48220

Please sign in to comment.