Step 1:
Add the entry in web.xml of the J2EE project
<env-entry>
<description>
Password for jndi
</description>
<env-entry-name>
jndi-password
</env-entry-name>
<env-entry-value>
welcome123
</env-entry-value>
<env-entry-type>
java.lang.String
</env-entry-type>
</env-entry>
Step 2:
Lookup the password by using JNDI lookup as following
Context initial = new InitialContext();
Context environment = (Context)initial.lookup("java:comp/env");
String password = (String)environment.lookup("jndi-password");
Step 3:
Deploy the application in an OC4J using Enterprise Manager. For eg. I have deployed the application “HomePortlet” in oc4j_test.
Step 4: Navigate to the web module of the application, Click on environment link as shown below

Step 5: Update the “Deployed Value” in the environment entries heading and click “apply”.
No comments:
Post a Comment