Wednesday, August 24, 2011

TNS Listener supports no services

While using Oracle 11g database, we encountered an issue where the database listener was unable to connect to any DB service although the associated database server was started, up and running. No matter how many times we issued lsnrctl start commands, the listener was unable to tie to the running database service. The listener reported the following on startup;

LSNRCTL for Linux: Version 11.2.0.1.0 - Production

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                11-AUG-2011 07:16:06
Uptime                    12 days 19 hr. 24 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/dbhome/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /oracle/dbhome/app/oracle/diag/tnslsnr/soabpm-vm/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully

To overcome this issue, leave the listener started and reboot the 11g database. After 11g DB restart, issue the lsnrctl status command and see that the services are now registered successfully with the listener.

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-AUG-2011 02:40:07

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                11-AUG-2011 07:36:00
Uptime                    0 days 0 hr. 24 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/dbhome/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /oracle/dbhome/app/oracle/diag/tnslsnr/soabpm-vm/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Services Summary...
Service "orcl.local" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB.local" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

Weblogic 11g Domain Creation Failed

While creating domain in Weblogic server for FMW 11g, the following may be encountered if the config.cmd (or) config.sh file is executed from $MiddlewareHome/wlserver_10.3/common/bin folder.

Preparing...
Extracting Domain Contents...
Creating Domain Security Information...
Domain Creation Failed!

Domain Location: /oracle/fmwhome/user_projects/domains/base_domain

Reason: null

Exception:

Traceback (innermost last):
  File "", line 17, in ?
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

To resolve this error, use the config.cmd (or) config.sh executable from $MiddlewareHome/Oracle_ECM1/common/bin folder. This error occurs because, the standard execution wizard is unable to execute the jython scripts that will get executed during domain creation.

Friday, August 19, 2011

Portletize ADF Faces jspx page

In this post, let us see how to portletize an ADF 11g application. This post will demonstrate how to expose a ADF faces page as a JSR 168 standard portlet which can run within Oracle WebCenter portal.

Pre-Requisites:

Download JDev WebCenter Extension from the following link.

Go to Help -> Check for Updates -> Choose 'Install From Local File' option and select the downloaded webcenter framework bundle zip file for install

From your ADF application, expand the ViewController project, right click on the jspx ADF faces page which you want to portletize and choose 'Create Portlet Entry...'. In the resulting popup window, enter portlet name, display name, portlet title, short title, description and click OK. This action will generate a portlet deployment descriptor automatically for the page. You can portletize 1 or more pages of your ADF application under a single portlet deployment descriptor.

While deploying the ADF application, JDeveloper will prompt for confirmation whether the JSR 168 portlet producer has to be deployed. Press OK to confirm. We now have to identify the WSRP WSDL URL which will be used to register the portlet in WebCenter. Pick up the ADF application URL from the deployment log and enter the following in a browser window;

<ADF_Application_URL>/info

Click on the WSRP v2 link and copy the WSDL URL from the resulting screen.

Let us now register the portlet producer with WebCenter spaces. Follow the steps below to achieve this;




























































































































































































1. Login to EM console as weblogic
2. Expand WebCenter -> WebCenter Spaces -> webcenter(11.1.1.4.0) (WC_Spaces)
3. Choose 'Register Producer' from the WebCenter dropdown option
4. Under the 'Add New Portlet Producer' screen, choose producer type as 'WSRP Producer', enter a 'connection name' and provide the WSDL URL which we copied above earlier
5. Test the portlet producer and click OK

This will ensure that the registered portlet is now available as a portlet in WebCenter portal which can be used as required.

Thursday, August 18, 2011

ADF 11g "No Credential Mapper" Error on WebLogic

While migrating the ADF 11g application with model project on to various environments, the following error is encountered;

"java.security.PrivilegedActionException: weblogic.common.ResourceException: java.security.PrivilegedActionException: weblogic.common.ResourceException: No credential mapper entry found for password indirection user......"

This error occurs because, JDeveloper generates an application-level data source with password indirection. JDeveloper creates a weblogic-jdbc.xml file for each database connection stored in the application resources. In order to get rid of the above error, we should ensure that the jdbc settings are not synchronized during ear generation.


Go to 'Application Properties' -> Deployment -> Uncheck the 'Auto Generate and Synchronize weblogic-jdbc.xml Descriptors During Deployment' option.


After the above setting, generate the ear file for the ADF application which can now be deployed on different environments.

ADF 11g model project generic datasource

While creating a ADF model project in an ADF application, we define the connect string (hard coded) to connect to the database. However, while migrating the ADF application on to different environments, the connect string values might change and has to be referred dynamically from the data source created in the application server. To ensure that the ADF application points to the data source, we can define the configuration settings in the model project 'AppModule'.

Step 1: Right Click on the 'AppModule' and go to 'Configurations...'

Step 2: Under the 'Manage Configurations' dialog, edit the AppModuleLocal and AppModuleShared business components

Step 3: Under the 'Connection Type' panel, choose 'JDBC DataSource' and enter the data source name that is created on the application server

Step 4: Save and deploy the ADF application.

Now, we have ensured that the ADF application model refers to the application server data source. This will keep the ADF application generic as we have externalized the database connection details.

Thursday, August 11, 2011

ADF generate primary key using DBSequence and display to user

In this post, I am going to demonstrate a way of generating and displaying a Oracle DB sequence and show that to user in a Oracle ADF page.

Step 1: Create a DB sequence in the database. For example let us consider order_sequence as the DB sequence

Step 2: In the ADF application, under the model project create an entity object for the table which has the primary key (for example, order_id) for which the DB sequence created above will be used for data insertion

Step 3: Open the Entity Object, go to Java tab and click on the 'Edit' button to auto-generate the entity object java class
              a. Select 'Generate Entity Object Class' check box
              b. Under the 'Include' grouping select 'Create Method' in additions to the default selected 'Accessors' option

Step 4: Now, click on the hyperlink which shows the auto-generated entity object java class and add the following java code under the create() method that is generated

super.create(attributeList);
SequenceImpl s = new SequenceImpl("ORDER_SEQUENCE", getDBTransaction());
super.create(attributeList);
Object obj = s.getSequenceNumber();
this.setOrderId((Number)obj);

Now, drag and drop the view object from the ADF data controls as a form with input text. Everytime, the form is invoked, a new sequence number will be generated from database and will be displayed in the UI.

I have illustrated another more sophisticated way of DB sequence generation here which has couple of advantages over the aforesaid method.