Wednesday, May 27, 2009
A Note on proxy jar
Wednesday, March 4, 2009
What is 64-bit computing and what are its benefits?
A 64-bit CPU system is the one, which has a 64-bit microprocessor & can directly address physical memory with a 64-bit address.
The key benefits of 64-bit computing are that it can perform high-precision computations faster than 32-bit systems, and it can directly address huge amount of physical memory.
64-bit microprocessors process 64-bit data in one clock cycle. All the registers associated with the microprocessors are 64-bit. This enables High- precision computations and 64-bit arithmetic to be performed in fewer clock-cycles as compared to 32-bit microprocessors. In certain cases like 64-bit multiplication, it is twice as fast.
32-bit microprocessors can directly address a maximum of 232 ~= 4 GB of memory, while 64-bit microprocessors have pushed this limit further and can directly address up to a maximum of 264 bytes = ~16 Exabytes = ~17.2 billion GB of physical memory. Practically speaking, this means that applications running on a 64-bit microprocessors have unlimited memory available to them. However, most of the 64-bit systems and operating systems available today pose a limit on the amount of RAM that they can recognize.
Sun first introduced a 64-bit version of Java for their Solaris operating system on SPARC processors with Java Development Kit (JDK) 1.4. The JDK 1.5 and JDK 1.6 releases introduced support for the x86-64 processors made by Intel, these processors are widely used by Windows, Linux, and Mac OS× operating systems today. The main implication of 64-bit in Java relates to the heap space used by Java applications and the algorithm used for garbage collection of the objects created on the heap.
When a Java application executes and creates objects, the objects are stored in a place called heap. The amount of heap space an application can use depends on the operating system, the amount of RAM available in the system, and the amount of memory that the hardware can address. A 32-bit system, as discussed earlier, can support a maximum of 4GB memory. But not all 4GB RAM space is available for use by a single Java application. For instance, an OS uses some of the RAM space. Assuming that the hardware has 4 GB RAM, the maximum heap space a typical application can use would be 1.2 GB to 2 GB. However, this limit is not true for Java applications on a 64-bit CPU system. The value that you can set for the maximum java heap space on a 64-bit CPU system is only limited by the limitations of hardware and the OS (as discussed in the previous section).
Sunday, November 23, 2008
How to configure Indirect Password using Enterprise Manager Data Source?
Step 1:
Step 3:Friday, September 26, 2008
How does URL sent to Web Listener reach OC4J?
Wednesday, September 24, 2008
How to Integrate OracleAS JAAS Provider with Basic Authentication?
- OracleAS Single Sign-On (for OracleAS Single Sign-On environments)
- OracleAS JAAS Provider RealmLoginModule or other login module (for non-OracleAS Single Sign-On environments)
- getRemoteUser() for the authenticated user name
- getAuthType() for the authentication scheme
- getUserPrincipal() for the authenticated principal object
- Servlet.service() in the servlet
- Subject.doAs() and Subject.doAsPrivileged() in the client
- SecurityManager.checkPermission() in the server
- J2EE Security Roles
- Deployment Roles and Users
- OC4J Group Mapping to J2EE Security Roles
<web-resource-collection>
<web-resource-name>access to the entire application
<url-pattern>/*</url-pattern>
<!-- authorization -->
<role-name>
sr_developer
</role-name>
</security-constraint>
developer
</name>
<members>
<member>
<type>user<type>
<name>john<name>
</member>
</members>
</role>
Tuesday, September 23, 2008
How to use Java Naming & Directory Interface (JNDI) in a J2EE application?
A fundamental facility in any computing system is the naming service-the means by which the names are associated with objects & objects are found based on their names.
For e.g,
- when you use an electronic mail system, you must provide recipient's email address
- Internet Domain Naming System (DNS) maps machine names to IP addresses. For e.g www.oracle.com => 99.99.99.99
- A file system maps a file name to a file reference. For e.g c:\bin\text.txt => File reference
To lookup an object in a naming system,you must supply the name of the object. The syntax is called system's naming convention.
Naming System Component Separator Names
Unix File System "/" /usr/Hello
DNS "." www.oracle.com
LDAP "," & "=" cn=barani,cn=users, dc=company,dc=com
iii.Bindings
The association of a name with an object is called a binding. An LDAP name is bound to an LDAP entry.
iv. Context
A context is a set of "name-to-object" binding. A context always provides a lookup operation that returns the object.
What is a directory service?
Directory Service= Naming Service + Directory objects containing attributes
Java Naming & Directory Interface
It is an API that provides naming & directory functionality to applications written in Java. Some of the key interfaces available are
a) Context
The javax.naming defines a "Context" interface which is the core interface for looking up , binding/unbinding & creating/destroying sub-contexts.
b) InitialContext
In the JNDI, all the naming & directory operations are performed relative to a context. There are no absolute roots. Therefore, JNDI defines an InitialContext which provides a starting point for naming & directory operations.
c) DirContext
It represents a directory context. It behaves as a naming context by extending the getAttributes() to retrieve the attributes associated with the directory entry.
Java Naming and Directory Interface in OC4J
JNDI, in the form of jndi.jar, is available with OC4J. J2EE-compatible applications use JNDI to obtain naming contexts that enable the application to locate and retrieve objects such as data sources, local & remote EJBs, JMS services, and many other J2EE
objects and services.
i. Initial Context
The two most often-used JNDI operations in the J2EE applications are
- Creating a new InitialContext object
- Using the InitialContext, looking up a J2EE or other resource
ii.Constructing a JNDI context
The environment that OC4J uses to construct a JNDI initial context can be found in several places. These include:
- System property values, as set either by the OC4J server or possibly by the application container
- A jndi.properties file contained in the application EAR file
- An environment specified explicitly in a Hashtable passed to the JNDI initial context constructor
- InitialContext()
- InitialContext(Hashtable env)
- INITIAL_CONTEXT_FACTORY
- PROVIDER_URL
- SECURITY_PRINCIPAL
- SECURITY_CREDENTIAL
A value for the java.naming.factory.initial property that specifies which initial context factory to use when creating a new initial context object.
PROVIDER_URL
The URL that application client code uses to look up objects on the server.
SECURITY_PRINCIPAL
The user name. Required in application client code to authenticate the client.
SECURITY_CREDENTIAL
The password. Required in application client code to authenticate the client
There are three JNDI initial context factories that are available for use by application code. They are
- ApplicationClientInitialContextFactory
- ApplicationInitialContextFactory
- RMIInitialContextFactory
I. ApplicationClientInitialContextFactory
When an application client needs to look up a resource that is available in a J2EE server application, the client uses ApplicationClientInitialContextFactory as to construct the initial context.
Consider an application client that consists of Java code running outside the OC4J server, but that is part of a bundled J2EE application. For example, the client code running on a workstation and might connect to a server object, such as an EJB, to perform some application task. In this case, the environment accessible to JNDI must specify the value of the property java.naming.factory.initial as ApplicationClientInitialContextFactory.
Using the ApplicationClientInitialContextFactory to construct JNDI initial contexts means that the client can look up local objects using the java:comp/env mechanism, and can use ORMI to look up remote objects.
Example
...
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.ApplicationClientInitialContextFactory");
env.put(Context.PROVIDER_URL,"ormi://<hostname>/employee");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
Context context = new InitialContext(env);
//do the lookups...
...
II. ApplicationInitialContextFactory
Server-side clients need not specify an InitialContextFactory in order to look up resources defined within the client application. By default, serverside clients have InitialContextFactory set to ApplicationInitialContextFactory.
Example
try {
InitialContext ic = new InitialContext();
ds = (DataSource) ic.lookup("java:comp/env/jdbc/OracleDS1");
...
}
catch (NamingException ne) {
throw new ServletException(ne);
}
...
III. RMIInitialContextFactory
Using either the default server-side ApplicationInitialContextFactory, or specifying ApplicationClientInitialContextFactory, will work for most application purposes.
RMIInitialContextFactory is used when doing a general lookup for external JNDI objects, that may or may not be part of a J2EE application. A generalized JNDI object browser would be an example of this usage.
Monday, September 22, 2008
What is Implicit Connection Caching in OC4J 10.1.3.1?
- Managed data source
- Native data source
- Managed Data sources connections retrieved from a data source can participate in global transactions
- Data source makes use of OC4J's connection pool and statement caches
- validate-connection
- abandoned-connection-timeout
Wednesday, September 17, 2008
How to secure J2EE application in OC4J by Basic Authentication?
A simple way to verify the default-realm from within this list is to login in to the OIDDAS application:
http://<infra_host>:<port>/oiddas as "orcladmin" then create a new user.
After creating the user, locate the user by clicking the "Users" tab and then entering a query for the name of that user. In the list returned, select the radio button to the left of the user entry then click on the Edit button.Scroll down to the botton of the page returned, where you will find the section "EditHistory" and information similar to the following:
Created By cn=orcladmin,cn=users,dc=realmname,dc=com
Created At March 24, 2004 6:23:50 PM EST
Last Modified By cn=orcladmin,cn=users,dc=realmname,dc=com
Last Modified At March 24, 2004 6:23:50 PM EST
Look at the distinguished name for the "Created By" entry. The value for the default realm should also be the value of the first "dc=" entry immediately to the right of the cn=users
Step 3:
$ORACLE_HOME/j2ee/<OC4J_NAME>/applicationdeployments/<APPLICATION_NAME>/<APPLICATION_NAM E>/orion-web.xml
Add the following lines inside
<security-role-mapping impliesAll="false" name="trustedUsers">
<group name="myTrustedUsers"/>
</security-role-mapping>
The <security-role-mapping> maps the *logical* role "trustedUsers" (used by the application) to the physical role "myTrustedUsers" which is available in LDAP repository.
Step 4:
Now provide the role created in Step 3 in the following file,
$ORACLE_HOME/j2ee/<OC4J_NAME>/applications/<APPLICATION_NAME>/<APPLICATION_NAME>/WEB-INF/web.xml
A) Add <security-constraint> under <web-app> as shown below
<security-constraint>
<web-resource-collection>
<web-resource-name>protected
</web-resource-name>
<url-pattern>/ *</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>trustedUsers
</role-name>
</auth-constraint>
</security-constraint>
How to secure J2EE applications in an OC4J by Oracle SSO?
- The hostname of the URL used for the "location" attribute should match the location of the OID Server used by the Infrastructure install
- The port value is provided in the file:$ORACLE_HOME/install/portlist.ini
- The value for "default-realm" also needs to be appropriate to the site. You can find out the default realm by the following way
A simple way to verify the default-realm from within this list is to login in to the OIDDAS application:
http://<infra_host>:<port>/oiddas as "orcladmin" then create a new user.
After creating the user, locate the user by clicking the "Users" tab and then entering a query for the name of that user. In the list returned, select the radio button to the left of the user entry then click on the Edit button.Scroll down to the botton of the page returned, where you will find the section "EditHistory" and information similar to the following:
Created By cn=orcladmin,cn=users,dc=company,dc=com
Created At March 24, 2004 6:23:50 PM EST
Last Modified By cn=orcladmin,cn=users,dc=company,dc=com
Last Modified At March 24, 2004 6:23:50 PM EST
Look at the distinguished name for the "Created By" entry. The value for the default realm should also be the value of the first "dc=" entry immediately to the right of the cn=users
Step 3:
$ORACLE_HOME/j2ee/<OC4J_NAME>/applicationdeployments/<APPLICATION_NAME>/<APPLICATION_NAM E>/orion-web.xml
Add the following lines inside
<security-role-mapping impliesAll="false" name="trustedUsers">
<group name="myTrustedUsers"/>
</security-role-mapping>
<jazn-web-app auth-method="SSO"/>
The <security-role-mapping> maps the *logical* role "trustedUsers" (used by the application) to the physical role "myTrustedUsers" which is available in LDAP repository.
Step 4:
Now provide the role created in Step 3 in the following file,
$ORACLE_HOME/j2ee/<OC4J_NAME>/applications/<APPLICATION_NAME>/<APPLICATION_NAME>/WEB-INF/web.xml
A) Add <security-constraint> under <web-app> as shown below
<security-constraint>
<web-resource-collection>
<web-resource-name>protected
</web-resource-name>
<url-pattern>/ *</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>trustedUsers
</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
Now,all URLs within the application accessed will first be redirected to the SSO server for appropriate authentication.
Tuesday, September 16, 2008
How to configure OC4J 10.1.2 to use JDK/JRE 1.5?

Step 4:
How to improve J2EE Application performance running in an OC4J?
Saturday, September 13, 2008
How does a J2EE application explodes into an OC4J after deployment?
A typical application directory structure during development is as shown in the figure.When you deploy your application, the following occurs:
1. OC4J opens up and parses application.xml that exists in the EAR file. The application.xml lists all the modules that are contained in the EAR file. OC4J notes these modules and initializes the EAR environment.
2. OC4J reads the module deployment descriptors of each modules. The J2EE descriptors & OC4J-specific deployment descriptors are read into memory. Then JAR & WAR environments are initialized.
3. If you do not provide OC4J -specific deployment descriptor, OC4J provides one with certain defaults.
4. Then OC4J writes out the new module deployment descriptors to the application-deployments directory. These are the descriptors that Oc4J uses for starting and restarting the applications.
5. The OC4J then copies the EAR file to the "master" directory. This defaults to "applications" directory.
6. Finally, OC4J updates the server.xml with the notation that this application has been deployed. Each existing application contains a line with an
'<'application name=... path=... auto-start="true" '/>' entry.
7. In default-web-site.xml, a '<'web-app...'>' entry exists for each Web application that is bound to the Web site upon OC4J startup.
For each Web application binding included in a WAR file, the following line has been added:
'<'web-app application="myapp" name="myapp-web" root="/myapp" '/>'
What is hot deployment?
Friday, September 12, 2008
How to handle post deployment modifications of J2EE applications in an OC4J?
Impact of Undeploying/Redeploying an Application
During a redeployment, OC4J removes the existing application before redeploying the new EAR/WAR.
1. The application is removed from the OC4J runtime and is no longer accessible to clients
2. All application files are removed from applications/ & application-deployments/ directory
3. In an Oracle AS environment, Oracle HTTP server will be restarted to remove the mount point defined for the application. This will result in the loss of existing HTTP Sessions.
OC4J Communication
What is the use of an OC4J in an Enterprise Environment?
Oc4J processes are configured & managed by Oracle Enterprise Manager 10g. So this means that you cannot locally manage your OC4J processes using admin.jar or by hand-editing the configuration files.
For those who want to use a standalone OC4J in a development environment, can download oc4j_extended.zip from OTN and manage the OC4J processes using oc4j.jar & admin.jar command-line tool.
In a typical production environment, all OC4J instances are controlled & managed by either Oracle Enterprise Manager 10g or command-line tools typically used for starting, stopping, restarting, configuring & deploying applications in an OC4J. Also, Oracle AS can manage multiple clustered OC4J processes.

