I have an Oracle Db with stored java procedures, which I load new procedures here and then.
I would like to be able to debug these java procedures, with a same debug methodology like setting the App server in Debug mode.
is it possible? how can I do that?
Thanks
I think you'll want to use JDeveloper which you can also use to debug the app server. It's not as good an IDE as, well, almost any other IDE, but it works well enough for debugging tasks.
The Oracle JDeveloper has support for debugging java stored procedures. You will need to compile the java classes using the -g option so that the debugging information is generated in teh class files, i.e.
javac $JAVA_OPTS -g file_names
After that, you will need to write a dummy pl/sql package-procedure that invokes this java stored procedure. Then right click on the pl/sql procedure name and select 'Debug'.
After that you can step through the pl/sql and java code just as if you were debugging a regular java class. Since you compiled the java class using the -g option, you can watch variables, evaluate expressions etc. If you didn't use the -g option, you will still be able to step through the code in the debugger, but you will not be able to watch the variables/expressions.
Another option is to use the Java Logging framework.
You can then copy logging.properties, with your specified Handler into the folder ORACLE_HOME/javavm/lib
来源:https://stackoverflow.com/questions/5665984/how-to-debug-java-stored-procedures-in-oracle