# Profiling Jetty
Since JettyLauncher creates a new Run... option thingummy watchamacall (r-o-t-w for short), (and other app-launcher plug-ins are variations on the same theme), it gets a big tricky to link it to a profiler since profilers generally specify their own r-o-t-w's and never the twain shall meet unless one of the two sides has specifically catered for the joyous union. The Tomcats and JBosses and Resins of the world generally have the joyous-union support, but Jetty's a little less lucky. As a side note, I'm sure it's all quite doable via remote profiling anyway, but local profiling seems a lot easier and preferable in many cases.
The trick I eventually used for Eclipse Profiler (and YourKit), was to kick-start Jetty as a normal Java app. It's not that hard, really, and the Jetty tutorial has all the code you need to do it. I simply wrapped the tutorial code into a class, like so:
Then I did this:
public class MyJettyLauncher
{
public static void main (String[] args) {
try {
Server server = new Server();
SocketListener listener = new SocketListener();
listener.setPort(8080);
server.addListener(listener);
server.addWebApplication("/","./webapps/myapp/");
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
- Created a new Eclipse project
- linked all the .jar files in the Jetty's
libandextdirectories into the project's build path. - created a class with the above code.
- edited the web app context and directory arguments.
- Set up a new r-o-t-w thingy and enabled profiling on the app server, which is now just a plain old Java app.
File under: java : {2005.06.03 21:54}