Java Reference
In-Depth Information
When you print the current value of m_shape , you can finally see why it failed:
AWT-EventQueue-0[1] print m_shape
m_shape = null
If you're an experienced Java programmer this should be familiar; no special OSG i
knowledge is required. But take another look at the command where you attached
your source directory:
use org.foo.paint/src
This command has no knowledge of bundles or class versions; it merely provides a list
of candidate source files for jdb to compare to debugged classes. Jdb allows only one
version of a given source file to be used at any one time, which makes life difficult
when you're debugging an OSG i application containing multiple bundle versions. You
have to know which particular collection of source directories to enable for each
debug session.
DEBUGGING WITH ECLIPSE
Thankfully, this is merely a limitation of jdb. If you use an IDE such as Eclipse, which
knows that multiple versions of a class can coexist in the same JVM , you don't have to
worry about which source relates to which bundle version. The IDE manages that asso-
ciation for you as you debug your application.
To see this in action, generate Eclipse project files for the two paint examples from
chapters 4 and 8:
$ cd ../../chapter04/paint-example
$ ant clean pde
$ cd ../../chapter08/debugging-bundles
$ ant clean pde
Now import these two directories into Eclipse as existing projects. You should end up
with 10 new projects: half marked version 4, the rest version 6. To debug these bun-
dles in Equinox, the OSG i framework used by Eclipse, click the drop-down arrow next
to the bug icon (circled at the top of figure 8.2), and select Debug Configurations.
Doing so opens the Debug Configurations dialog box. Follow these instructions to
configure a minimal Eclipse target platform for debugging the paint example:
Double-click OSG i Framework.
1
Change the name from New_configuration to ch8_debugging_example.
2
Deselect Include Optional Dependencies as well as Add New Workspace Bundles.
3
Select Validate Bundles Automatically.
4
Deselect the top-level Target Platform.
5
Click Add Required Bundles.
6
Click Apply.
7
When you're happy with your selection, click the Debug button to launch the debug-
ger. Two different paint frames appear, as shown in figure 8.3. This is because you
have two versions of the code running simultaneously in the same JVM .
Search WWH ::




Custom Search