Last updated March 14, 2012 13:36, by John H. Embretsen
Feedicon  

Integrating with NetBeans

This document describes how you use NetBeans to work on the JET Framework code base.

For Kenai integration and the latest Maven project support, you need NetBans 6.7 or newer. Version 6.8 is faster with regards to issue tracking integration.


Download and Install NetBeans

Download NetBeans 6.7 beta or newer from http://www.netbeans.org (downloads), and install it by following the NetBeans installation instructions. You only need the Java SE package of NetBeans for editing JET.

From the Tools->Plugins, you must install the Maven and Mercurial plugins unless they have been installed by default. If you are using NetBeans version 7 or newer you must install the Team Server plugin in order to get access to Kenai.

Create a Kenai account

Signup at kenai.com, if you don't already have an account. Join the JET project through the web interface.

Log in through NetBeans

From NetBeans 6, select Team->Kenai->Login to Kenai...

From NetBeans 7. select Team->Team Server->Login...

If Kenai is not listed, add it via Add new... in the drop-down box for the Login to field.

Enter your Kenai username and password, and you should get a Kenai dashboard on the left part of the NetBeans window. If you are a member of the JET project, you should find it in this window.

Get the JET source code

In the Kenai dashboard, you can expand the Sources menu item, and press the Get link. It will ask you where to store the data, and get the source for you.

When it is finished reading the source, NetBeans will say that is has finished loading the source and that it has read many projects. It will offer you to open one project, and you can select jet-framework as the project to open.

Now you will have the jet-framework as a project that is available in the Projects window in NetBeans. If you expand jet-framework and Modules you will find projects for the different parts of the JET framework. You can get access to the source code by double clicking on one module, and looking in the Source Package for the project that is now opened.

Build the source

You should now be able to build the source for the JET framework by right clicking on the jeg-framework project and selecting build from the popup menu, or by pressing F11.

If you get this error message:

 Failed to resolve artifact.
 
 Missing:
 ---------
 1) com.sun.jdmk:jmxtools:jar:1.2.1
 2) javax.management:jmxremote:jar:1.0.1_04
 3) javax.management:jmxremote_optional:jar:1.0.1_04

You will have to install these artifacts into the maven that you use with NetBeans. How to do this is dependent on your operating system, see e.g. how to do it on Ubuntu.

More Information

See NetBeans documentation for more information about integration with Kenai.

Run test from inside NetBeans

In the jet-examples project, select project Properties and Run.

Set the following values:

  • Main Class: com.sun.jet.framework.engine.JET
  • Arguments: src/test/jet/jdbcload.xml -v (or some other test name)
  • Working Directory: E.g. /Users/username/jet~framework/jet-examples
  • VM Options: -Xms64m -Xmx512m

In addition you must add runtime dependencies. Right click on the project, and select Add Dependencies. For scope select Runtime. You must add your own test classes, and other libraries that are needed, e.g. jag, jag-ops and jet-load (if it is a load test).

Profiling a test with NetBeans

The profiler in NetBeans is pretty good. You can run a test in JET or JETBatch with embedded JAG and get a full, live, profile of everything that happens.

It seems NetBeans (at least 6.8) are not able to pick up runtime dependencies when profiling, so you have to start the test outside NetBeans, and then attache NetBeans afterwards.

Starting the tests

When you start a normal test run from NetBeans, you can check out how the command line is. Use this as a start. Then you have to add a agentpath to Java, like this:

 -agentpath:/Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/profiler3/lib/deployed/jdk16/mac/libprofilerinterface.jnilib=/Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/profiler3/lib/,5140

(This is for NetBeans 6.8 on Mac OS-X)

The last number is for a port number which NetBeans will attach to.

This is how a full command line looks for me:

 /bin/sh -c cd jet-examples \
  && /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java \
   -agentpath:/Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/profiler3/lib/deployed/jdk16/mac/libprofilerinterface.jnilib=/Applications/NetBeans/NetBeans\ 6.8.app/Contents/Resources/NetBeans/profiler3/lib/,5140 \
  -Xms64m -Xmx512m \
  -classpath /Users/austvik/jet~framework/jet-examples/target/classes:/Users/austvik/.m2/repository/org/apache/derby/derby/10.5.3.0_1/derby-10.5.3.0_1.jar:/Users/austvik/.m2/repository/org/gearman/gearman-java/0.4/gearman-java-0.4.jar:/Users/austvik/.m2/repository/com/sun/jet/jet/1.0-SNAPSHOT/jet-1.0-SNAPSHOT.jar:/Users/austvik/.m2/repository/javax/management/jmxremote/1.0.1_04/jmxremote-1.0.1_04.jar:/Users/austvik/.m2/repository/javax/management/jmxremote_optional/1.0.1_04/jmxremote_optional-1.0.1_04.jar:/Users/austvik/.m2/repository/com/sun/jet/jet-util/1.0-SNAPSHOT/jet-util-1.0-SNAPSHOT.jar:/Users/austvik/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar:/Users/austvik/.m2/repository/com/sun/jet/jag-api/1.0-SNAPSHOT/jag-api-1.0-SNAPSHOT.jar:/Users/austvik/.m2/repository/com/sun/jet/jag-shared/1.0-SNAPSHOT/jag-shared-1.0-SNAPSHOT.jar:/Users/austvik/.m2/repository/com/sun/jet/jag-ops/1.0-SNAPSHOT/jag-ops-1.0-SNAPSHOT.jar:/Users/austvik/.m2/repository/com/sun/jet/jet-load/1.0-SNAPSHOT/jet-load-1.0-SNAPSHOT.jar \
  com.sun.jet.framework.engine.JET src/test/jet/jdbcload.xml -v

When you start the test, it will not start, but Java will hang on this:

 Profiler Agent: Initializing...
 Profiler Agent: Options: >/Applications/NetBeans/NetBeans 6.8.app/Contents/Resources/NetBeans/profiler3/lib/,5140< 
 Profiler Agent: Initialized succesfully

Attaching Profiler

Now you have to attach the NetBeans profiler. Select Profile - Attach Profiler from the menu, and select what and how much you want to profile. When you start the profiler, you will see:

 Profiler Agent: Waiting for connection on port 5140 (Protocol version: 9)
 Profiler Agent: Established local connection with the tool

And JET or JETBatch will start.

  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close