Search This Blog

Showing posts with label OAS. Show all posts
Showing posts with label OAS. Show all posts

Monday, 15 March 2010

OC4J 10.1.3.x - Accessing a Data Source remotely without oc4jadmin user

I previously showed how one would remotely access JNDI object's which include EJB's , Data Sources etc as shown in this post below.

http://theblasfrompas.blogspot.com/2008/07/enable-remote-clients-to-access-oas.html

Typically internally I use oc4jadmin who has access to everything and of course it has no issues. However in the real world 2 things are just about certain.

1. A Data Source would most likely be created at the container level for applications to share allthough it's not uncommon for them to be created at the application level.

2. The OAS administrator would almost certainly provide a separate user for JNDI access.

With such a setup the user created won't be able to access container specific JNDI objects such as data sources as most likely the OAS administrator won't make the user given part of the "oc4j-administrators" group. In this case the same principals as the blog entry apply however you won't find a container orion-application.xml.

So assuming you have a Data Source created in the HOME container you would need to alter the file below and then stop/start the instance to allow users to access container specific JNDI objects such as a Data Source. This demo assumes your user is part of the group called "users" as per the blog entry above.

$ORACLE_HOME/j2ee/home/config/application.xml


<namespace-access>
<read-access>
<namespace-resource root="">
<security-role-mapping>
<group name="oc4j-administrators" />
<group name="ascontrol_admin" />
<group name="users" />
</security-role-mapping>
</namespace-resource>
</read-access>
<write-access>
<namespace-resource root="">
<security-role-mapping>
<group name="oc4j-administrators" />
<group name="ascontrol_admin" />
<group name="users" />
</security-role-mapping>
</namespace-resource>
</write-access>
</namespace-access>

Tuesday, 30 December 2008

Creating a READ ONLY user for Application Server Control 10.1.3.x

Today I was asked how to create a user with a read-only user for access to the Application Server Control pages. I always use oc4jadmin and obviously that built in account has full rights, but it turns out the easiest way to create a new user with READ ONLY access is as follows

1. Log into ASC
2. Click on the link "Setup" at the top of the page.
3. Click on "Users"
4. Click on the "Create" button.
5. Enter new username/password and press OK

By default the user you create here will be one with read-only access which by default will be assigned the role "
ascontrol_monitor".

Now you can login with this new user with
read-only user access to the Application Server Control pages.

The administration roles are documented here.

http://otndnld.oracle.co.jp/document/products/as10g/101300/B25221_03/core.1013/b25209/tools.htm
Table 2-2 Administrative Roles That You Can Assign to Application Server Control Administrators

Monday, 11 August 2008

Determining if any active HTTP Sessions exist for deployed applications in OAS 10.1.3.x

Recently I was asked how to determine if any current HTTP sessions exist for an application. The reason for needing this information was so that the application could be redeployed only when no HTTP sessions existed and the application was currently not being used. It turns out there is an MBean which can give you that information.

The Mbean is as follows:

oc4j:j2eeType=ClassLoading,name=singleton,J2EEServer=standalone

His how to access it from the MBean browser in ASC and get the information on HTTP sessions for your deployed applications.

1. Log into ASC
2. Click on the container you wish to use.
3. Click on the link "Administration".
4. Click on the "Go To Task" icon as follows.

JMX -> System MBean Browser

5. Expand the ClassLoading node in the navigation pane, then select the singleton MBean instance.
6. Click the Operations tab in the right-hand pane, then click the executeQuery operation.

Three versions of the executeQuery operation are exposed. Click the version that takes one parameter.

7. For the value parameter enter in the following and press the "Invoke Operation" button

HttpSessions(details)

You will end up with output as follows which will give you the amount of HTTP sessions which currently exist for each deployed application.

** Summary at Aug 11, 2008 9:57:43 AM **

Total Sessions: 0
Total Attributes: 0
Total Session Size: 0 bytes

Largest Session: N/A
Youngest Session: N/A
Idlest Session: N/A
Oldest Session: N/A

** Details **

[ADFBC-HA:adfhaprofile]

No active sessions

[SimpleWS:WebServices]

No active sessions

[WebServiceDemo-SimpleWS-WS:WebServices]

No active sessions

...

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 (10.1.3.1.0)
Part Number B28950-01
http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28950/adminclient.htm#BABCCJEC

$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 (10.1.3.1.0)
Part Number B28974-01
http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28974/wsassemble.htm#CHDDBCCA

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

Eg:

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

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

Wednesday, 25 June 2008

Fast Connection Failover (FCF) Within OAS 10.1.3.x

If you read the 10.2 JDBC developer guide you will find that you will find you can subscribe remotely to ONS within the driver itself without the need for an oracle client.

http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/fstconfo.htm#CHDCHAGH
Remote ONS Subscription

OAS 10.1.3.x ships with the 10.1.0.5 JDBC driver, so is it right to assume it doesn't support FCF out of the box?

After a recent customer visit they swapped out to the 10.2.0.4 JDBC driver as they assumed 10.1.0.5 was not supported and would not work.

That is not true in actual fact 10.1.0.5 does work and the ONS subscription occurs within opmn.xml. However if you try to use the 10.1.0.5 driver outside of OAS in a stand alone client then it won't work as you can't subscribe to ONS with that driver outside of OAS 10.1.3.x.

It is all explained here.

http://www.oracle.com/technology/products/ias/hi_av/OracleApplicationServer10gFCF.pdf

Wednesday, 27 February 2008

ClassCastException casting to OracleConnection from a Data Source Connection in OAS 10.1.3.x

I have previously blogged how to access a data source remotely using OAS 10.1.3.x as shown below.

http://theblasfrompas.blogspot.com/2007/07/access-data-source-from-oc4j-remotely.html


Normally I cast back to a java.sql.Connection but you can also cast to an OracleConnection, as shown below.

OracleConnection oraConnection = null;
InitialContext ic = new InitialContext(env);
DataSource ds = (DataSource) ic.lookup("jdbc/scottDS");
oraConnection = (OracleConnection) ds.getConnection();

When you do this you may get a runtime exception as follows:

Exception in thread "main" java.lang.ClassCastException: oracle_jdbc_driver_LogicalConnection_Proxy

The problem here is you must import the correct OracleConnection. The one you want to import is "oracle.jdbc.OracleConnection". You end up with the error above if you use "oracle.jdbc.driver.OracleConnection".

Friday, 25 January 2008

Command Line Administration in OAS 10.1.3.x is very powerful

Today a customer asked me how they could stop an application on a remote OAS server which was part of cluster, but only using opmnctl command. I know it can be done wit admin_client.jar but they insisted they only wanted to use opmnctl. I wasn't sure if it was possible but found it was in the end.

Setup:

2 OAS 10.1.3.x installs, but only had access to one of them from the command line

eg:


Processes in Instance: 10132linux_pink.papicell-au2.au.oracle.com
---------------------------------+--------------------+---------+---------
ias-component | process-type | pid | status
---------------------------------+--------------------+---------+---------
ASG | ASG | N/A | Down
OC4JGroup:pas_group | OC4J:pas_oc4j | 28416 | Alive
OC4JGroup:default_group | OC4J:OC4J_WebCent~ | N/A | Down
OC4JGroup:default_group | OC4J:home | 16758 | Alive
HTTP_Server | HTTP_Server | 19568 | Alive

Processes in Instance: 10132linux_green.papicell-au2.au.oracle.com
---------------------------------+--------------------+---------+---------
ias-component | process-type | pid | status
---------------------------------+--------------------+---------+---------
ASG | ASG | N/A | Down
OC4JGroup:default_group | OC4J:OC4J_WebCent~ | N/A | Down
OC4JGroup:default_group | OC4J:home | 30049 | Alive


In this case we only have access to the oracle_home "10132linux_green". The requirement was to shutdown ascontrol remotely on the instance "10132linux_pink". With opmnctl this is easily done as long as the instances are clustered together it's a command as simple as this, where we specify exactly which instance to execute the command on.

- opmnctl @instance:10132linux_pink.papicell-au2.au.oracle.com stopproc process-type=home application=ascontrol

To then restart it when it needs to be running again remotely we use a command as follows

- opmnctl @instance:10132linux_pink.papicell-au2.au.oracle.com startproc process-type=home application=ascontrol

The process-type switch ensures we only stop/start the application on a specific OC4J instance which for ascontrol is vital as we only need it running on one node within the cluster.

Wednesday, 26 December 2007

10.1.3.1 OPMN OC4J Log Files No Longer Displayed in ASC Log Files Screen

When using ASC (Application Server Console) in 10.1.3.0 you could view the OPMN OC4J log files in the screen "Log Files". Starting with 10.1.3.1 and above those log files no longer appear in ASC. This is due to a bug which should be fixed soon via a patchset for OAS, but for now you can easily re-enable this by following these steps.

1. Open the following file in a text editor.

$ORACLE_HOME\j2ee\home\applications\ascontrol\ascontrol\WEB-INF\config\registration\OPMN.xml

2. Make the following changes.

- Go to line 105 and make the change as outlined below.

<log path="'opmn/logs/HTTP_Server~1'" componentid="'OHS'">

to

<log path="'opmn/logs/HTTP_Server~1.log' componentId='OHS'>

- Go to to line 116 and make the change as outlined below.

<log
path='opmn/logs/%COMPONENT_TYPE%~%COMPONENT_NAME%~%OPMN_PROCESS_SET%~%OPMN_PROCESS_ID%'
componentId='OPMN'>

to

<log
path='opmn/logs/%COMPONENT_TYPE%~%COMPONENT_NAME%~%OPMN_PROCESS_SET%~%OPMN_PROCESS_ID%.log'
componentId='OPMN'>


3. Save the file and restart the instance where ASC is running which is normally HOME.

Now log in ASC and when you go to the "Log Files" screen the OPMN OC4J log files will be shown under the following tree items.

- OPMN
- Process Manager
- redirected output/errors

Tuesday, 27 November 2007

Connecting to OAS 10.1.3.x from JDeveloper without using oc4jadmin

Every now and then I get a request to be able to connect to OAS 10.1.3.x from JDeveloper 10.1.3.x using a custom user rather then the default oc4jadmin. A work mate of mine got this working and also found that only certain roles will allow such a connection remotely when using a custom user.

Steps

A) CONFIGURE ORACLE APPLICATION SERVER 10.1.3.X

1. Go to OAS 10.1.3.x EM

http://:/em

2. Select an OC4J instance that you had created.
3. Select Administration.
4. In the Task Name section, under Security select the 'Go to Task' icon for Security Providers.
5. Press the button [Instance Level Security].
6. Select the tab link Realms.
7. In the section Security Provider Attributes: File-Based Security Provider there is a realm
named jazn.com. Select the number under the Users column.
8. Press the button [Create].
9. Add User screen:-

Name field : enter a user name
Password || Confirm Password fields : enter a valid password
In the Available Roles area, select the role like ascontrol_admin and move across to Selected Area.

Press [OK].

10. Restart OC4J container via ASC pressing the [Restart] button or use following commands:-

- opmnctl stopproc process-type=Tars
- opmnctl startproc process-type=Tars


B) JDEVELOPER >> OAS CONNECTION CUSTOM CREATED OC4J CONTAINER AND CUSTOM CREATED USER

1. In JDeveloper 10.1.3.X select Connections navigator.
2. Right-click Application Server node and select 'New Application Server Connection'.
3. On Welcome screen press [Next].
4. Step 1 of 4: Type screen :-

Connection Name field >> enter a app server connection name
Connection Type list field >> select "Oracle Application Server 10g 10.1.3".

Press [Next].

5. Step 2 of 4: Authentication screen:-

Username field : enter user name that was created in previous section at the OAS level.
Password field : enter same password was created in previous section at the OAS level.
Deploy Password checkbox : select.

Press [Next].

6. Step 3 of 4: Connection screen:-

Host Name field : enter host of OAS.
OPMN Port field : change to opmn remote port number
OC4J instance name field : enter of instance where user was created.

Press [Next].

7. Step 4 of 4: Test screen:-

Press [Test Connection]:

That should work but what we found is only 2 roles actually will work as shown by the test below which shows that only 2 roles actually work here, of course was never expecting the role "users" to work. We created 6 users each will the role shown next to them and found only ascontrol_admin and oc4j-administrators would allow such a remote connection

User1 (Role = ascontrol_admin) - SUCCESS
User2 (Role = ascontrol_appadmin) - FAILS
User3 (Role = ascontrol_monitor) - FAILS
User4 (Role = oc4j-administrators) - SUCCESS
User5 (Role = oc4j-app-administrators) - FAILS
User6 (Role = users) - FAILS

Tuesday, 13 November 2007

Application Server Connection 10.1.3.x from Jdeveloper 10.1.3.x

Creating an application server connection from JDeveloper 10.1.3.x requires you to know a bit about the application server here is all you need to find out exactly what to put in the fields. If you don't know it's worth running some of these commands to avoid having to determine why the connection is failing to establish when testing it.

OPMN Remote Port

Issue the following command on the OAS server to get the OPMN port number:

> opmnctl status -port

Output:

papicell-au2.au.oracle.com:6007

Hostname

Ensure you can ping the host by name or IP address from your machine where Jdeveloper is running. You could even try connecting using telnet should the host allow it, but normally ping is enough to verify you have a reachable host.

> telnet papicell-au2.au.oracle.com 6007

That command will tell you whether or not you can reach the host through the OPMN port remotely.

OC4J Instance Name

To determine this name you simply use a command as follows on the OAS server, which has a column known as process-type which identifies the OC4J instances you can connect to.

> opmnctl status

Connect to

Here we decide if we are connecting to a group or a single instance. A group is a collection of OC4J instances which allows you to deploy applications to a group which in turns deploys your application to every container within the group. Basically when you select the check box "group" you then need to provide a group name.

The easiest way to determine the group name is to log into ASC (Application server console) which shows you exactly what type of topology setup you have for your OAS.

Also you can use the command we used previously to get the group name as follows

> opmnctl status

This time your looking at the column ias-component which will give you the group name you want to use which identified by OC4JGroup:{name} all you need is {name} portion to use as the group name

Eg: OC4JGroup:pas_group

Hope this helps those remote connection problems you may have from JDeveloper 10.1.3.x to OAS 10.1.3.x.