Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Debugging Java procedures

584252Jun 21 2007
Hi All,

I am quite new to running Java in the database. I would like to be able to debug my code and after having read multiple articles, blogs and posts I still could not get it to work and I would greatly appreciate any help.

I am using JDeveloper 11g. It is a new installation with all settings still set to the default. I am also happy to go back to an earlier version if that would help. The database is Oracle 10.2.0.1. This is what I do:

1. Create a Java stored procedure for testing:

package com.greet;
public class Greetings {
public static String hello() {
return "Hello";
}
}

2. Compile the class with debug and load into database.

3. Do the following in JDeveloper:
3.1 Create a new Application and Project.
3.2 Go to Project Settings
1 Import the source file into my Project
2 Edit Run/Debug/Profile settings
a Launch Settings -> Check Remote Debugging and Profiling
b Debugger\Remote -> Select Listen for JPDA
c Click Ok
3 Click Ok
3.3 Open the Source file and set a breakpoint on line 4 (return "Hello";).
3.4 Click Debug, leave port set to default (4000) and Click ok.
3.5 Verify in Run Manager that Debug Listener is listed under processes.

4. Do the following in the Database:
4.1 Create the following procedure in the same schema as the Java code:
create or replace FUNCTION hello RETURN VARCHAR
AS LANGUAGE JAVA
NAME 'com.greet.Greetings.hello() return java.lang.String';
4.2 Run the function in a session to make sure it returns "Hello".
4.3 Execute the following block:
declare
n VARCHAR(200);
begin
DBMS_DEBUG_JDWP.CONNECT_TCP( '<my ip>', '4000' );
n := SU_CRAM.hello();
DBMS_DEBUG_JDWP.DISCONNECT;
end;
4.4 I see the following in the JDeveloper debugging log:
Debugger accepted connection from remote process on port 4000.
Processing 280 classes that have already been prepared...
Finished processing prepared classes.
Debugger disconnected from remote process.

It seems that the Oracle session does connect to the Debugger but JDeveloper never stops at the Breakpoint.

Again, any help will be greatly appreciated.

Regards,
Herman
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 19 2007
Added on Jun 21 2007
0 comments
383 views