23 November 2005

Dumping System Properties with OC4J

A Simple Dump of System Properties from a JSP With OC4J

A point was made recenttly that a query on Google returned zero hits for showing how to print details of the runtime environment with OC4J.

So here’s my attempt at getting at least one hit for how to do this.

Assumption – OC4J is running somewhere

Step1 – Open a text editor.

Step 2 – Enter the following into the editor.

<%@ page import="java.util.*, java.io.*"%>
<h3>System Properties</h3>
<hr/>
<pre>
<%
Properties props = System.getProperties();
props.list(new PrintWriter(out));
%>
</pre>

Step 3 – Save the file as $ORACLE_HOME/j2ee/home/default-web-app/sysprops.jsp

Step 4 – Access the page from a browser http://localhost:8888/sysprops.


4 comments:

Sankar Baskaran said...

this is very useful.

Anonymous said...

Hi, not sure if you get comments that are this old. But though I'd give it a try anyway.

I have found the post helpful.

However what I would like to be able to do is within the application look up the name of the application as deployed.

Are you aware if this can be done. Any advice is greatly appreciated.

Thank you.

Anonymous said...

Hi, I made the comment above. However after a little more research I think I have a possible solution. Posted it to the same question that someone else asked on the Oracle Forums.

See Oracle Forum answer

Posting it here for completeness sake and anyone else that might be interested.

Buttso said...

I saw your posting -- that's an inventive and interesting approach. I'll ask a few folks and see if its OK -- if the API is not private then I can't see anything wrong with it offhand, thanks a lot for the posting!

-steve