Wednesday, 30 July 2008

Enable Remote Clients To Access OAS 10.1.3.x Server-Side JNDI Context From Deployed Applications

In order for remote clients to access a OAS 10.1.3.x JNDI Server-Side context they must authenticate with the server prior to doing a look up. Here is how to enable such access from a remote J2SE client and what setup steps are required to achieve this for deployed applications, thus avoiding using privileged users such as oc4jadmin.

This example is based on JAZN-XML security provider at the instance level.

1. Log into Application Server Console (ASC).
2. Click on your container you wish to use.
3. Click on administration link.
4. Click on the icon for the security task with a description as follows -> "Configure security providers, create/delete/view users and roles".

Here we will just use "Instance" level security which will enable this user we create to be used by all applications within this instance.

5. Click on the button "Instance Level Security".
6. Click on the link "Realms".
7. You will see a column called "Users" which will have an amount of users, simple click on the amount to go to the next screen.
8. Click on the "Create" button.
9. Enter the following.

Name - test
Password - test123
Confirm Password - test123
Shuttle Across "users" to the "Selected Roles" Area

Note: You can create your own role but you must make sure you set the check box "Grant RMI Login Permission". We are using the "users" role as that has been done already for us.

10. Press OK.

So the user we want to use will be "test" with a password as "test123", with this in place we now must grant access to the JNDI context to the correct group so that remote users which are part of this group can access the JNDI resource. This is done as shown below within a deployment descriptor for each deployed application which contains JNDI objects such as a Data Source or an EJB. The file is placed within a META-INF directory of an EAR file.


<?xml version = '1.0' encoding = 'windows-1252'?>
<orion-application xmlns:xsi="" xsi:noNamespaceSchemaLocation="">
<namespace-resource root="">
<group name="users" />
<namespace-resource root="">
<group name="users" />

As you can see the namespace-access has been setup to allow users which are part of the role "users" access to the JNDI Server-Side context for the deployed application.

So with a deployment descriptor added to my application named "pastest" and deployed, I can then perform a JNDI look up of resources within that application as the user "test" as shown below.

private Context getInitialContext() throws NamingException
Hashtable env = new Hashtable();
// Standalone OC4J connection details
"oracle.j2ee.rmi.RMIInitialContextFactory" );
env.put( Context.SECURITY_PRINCIPAL, "test" );
env.put( Context.SECURITY_CREDENTIALS, "test123" );
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/pastest");

return new InitialContext( env );

For more information see the documentation below.

Oracle® Containers for J2EE Security Guide
10g (
Part Number B28957-01

Friday, 18 July 2008

Having JDeveloper 10.1.3.x on your PC

If you have JDeveloper 10.1.3.x on your file system you can take advantage of 2 JAR files even without actually using the IDE. There useful utilities if your using OAS 10.1.3.x. Those are as follows.

$JDEV_HOME\j2ee\home\admin_client.jar - OC4J provides a command-line utility, admin_client.jar, for performing configuration, administration, and deployment tasks on active OC4J instances in an Oracle Application Server clustered environment as well as on a standalone OC4J server. In addition, you can use admin_client.jar to restart or stop an OC4J instance or group of instances. See this document for more details.

Oracle® Containers for J2EE Configuration and Administration Guide
10g (
Part Number B28950-01

$JDEV_HOME\webservices\lib\wsa.jar - The WebServicesAssembler tool assists in assembling Oracle Application Server Web Services. It enables you to generate the artifacts required to develop and deploy Web services, regardless of whether you are creating the service top down or bottom up. The WebServicesAssembler can also be invoked to create Web service client objects based on a WSDL. See this document for more details.

Oracle® Application Server Web Services Developer's Guide
10g (
Part Number B28974-01

For both of these utilties use the -help option for more details of what command line options can be used.


> java -jar D:\jdev\jdevprod\10133\webservices\lib\wsa.jar -help

Note: Stand Alone OC4J has the same JAR files as well.