In this post I will show how to debug
java classes in Oracle Event Processing applications. We may need to use a Java
class for many reasons such as to create custom adapters, Event Beans, DAO object
and so on.
I will demonstrate how configure the debugger in
JDeveloper using a HelloWorld sample project here, but obviously the principles
could be applied to any OEP project.
Create the HelloWorld Application
- In Oracle JDeveloper, select File > New > Application
- In the New Gallery dialog, select OEP Application and click OK.
- In the Create OEP Application wizard, provide HelloWorldApp for the name and click Next.
- Provide HelloWorld for the project name, select OEP Suite and click Next.
- In the Configure Java Settings dialog, click Next to accept the defaults.
- In the Configure OEP technology settings dialog in the OEP Application Template Name drop-down list, select HelloWorld.
- In the Configure OEP technology settings dialog in the OEP Server Connections drop-down list, select your server connection.
- Click Finish.
Start the OEP Server with debug option
To enable debug functionality, you have to start the server with the -debug option as demonstrated below:
Windows
startwlevs.cmd -debug
|
Linux
./startwlevs.sh -debug
|
The following message is displayed in the Server Console:
Configure the Debug/Run properties in JDeveloper
- Double click on the project to open the Project Properties dialog
- In the Project Properties dialog in the left window, select Run/Debug.
- In the right panel under Run/Debug, accept the default settings and click Edit .
- Select Launch Settings in the left window, and in the right window, select the Remote Debugging check box
- Select Tool Settings > Debugger > Remote in the left window, and in the right panel set the host and port parameters
In this example, the host
is LocalHost and the port is 8453.
- Click OK and click OK again to dismiss the dialogs.
Set Breakpoint in the HelloWorldBean
- To set breakpoints, open
the
HelloWorldBean.java
. file in the project. - Select the required line and press F5 where you want to toggle a breakpoint on.
Deploy the Project
- Right-click the project and select Deploy > New Deployment Profile from the context menu.
- In the Create Deployment Profile dialog in the Profile Type drop-down list, select OEP Project Deployment Profile.
- In the Create Deployment Profile dialog in the Deployment Profile Name field, provide helloworld as a unique name for the profile.
- Click OK.
- In the Deployment Properties dialog, check that the information is correct.
Make any corrections that are needed.
- Click OK and Save.
- Right-click the project and select Deploy > helloworld
- Click Finish.
Now
you should see the HelloWorld messages printed in the server console as shown
below:
Start Debugging
You can also select the Debug button on the tool bar (red ladybug icon).
- In the Attach to JPDA Debugger dialog, check that the information is correct.
- Click OK.
The Debugging Log panel
prints messages that show that the debugger is connected to the server.
And that’s it. Enjoy :)