There is a great link that describes the OC4J logging and debugging in short:
OracleAS Containers for J2EE - Logging and Debugginghttp://www.oracle.com/technology/tech/java/oc4j/htdocs/oc4j-logging-debugging-technote.html
Blog related to Oracle technology, mainly interest areas are Java, Integration, Weblogic, OracleVM, XML, etc.
12.4.05
11.4.05
Loading Java properties file inside EJB component (OC4J)
Loading properties file inside Java is common way to parametrize the application. Under single JVM you would use following code to load the properties file:
Under OC4J you might want to keep all the properties files under the same directory e.g. $OC4J_HOME/properties. For this you should edit the container application.xml file under $OC4J_HOME/config -directory. Add following line to the application.xml:
In the J2EE application you can trust the class loader to find the properties file under this directory. For this you should code your application as:
Properties prop = new Properties();
try
{
prop.load(new FileInputStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
Under OC4J you might want to keep all the properties files under the same directory e.g. $OC4J_HOME/properties. For this you should edit the container application.xml file under $OC4J_HOME/config -directory. Add following line to the application.xml:
<library path="../properties"/>
In the J2EE application you can trust the class loader to find the properties file under this directory. For this you should code your application as:
Properties prop = new Properties();
try
{
prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
Subscribe to:
Posts (Atom)