Wednesday, February 26, 2014

How to Deploy ADF application on Tomcat 7 application server

DEPLOY ADF FACES APPLICATION ON   TOMCAT 7.0


Oracle released a few days ago ADF Essentials, which is a free version of its Oracle ADF Framework.
Before we start, you should download the files:
ADF essentials of the required version.
Now the deployment can be divided into 2 stages:
Stage 1: Creating appropriate .war file of the application
Stage 2: Configure Tomcat server.


Stage 1: Create War file

Right click on the view controller part of the project and go to project properties.
Go to deployment and select new option.
Select the profile type as WAR file.

Now we have to make some changes in these options as follows:
Go to Library Dependencies and unselect all the libraries.

Go to platform and select Tomcat 6.x as the default platform.
Click ok.
This creates the deployment profile.









Now go to web.xml of the project. From applications go to “Web Application Listeners” and delete all the present listeners.      
 


Now go to filers and delete the JpsFilter.

Done then. Save all.
Right click on the view-controller and from deploy select the newly created deployment profile.

Select Deploy to WAR.
Wait for the deployment to finish.
Done. The WAR file would be created in %project%/view-controller/deploy/ folder.
Stage 2: Configure Tomcat Server:
Go to Application Module of the project. Go to configurations and click edit on the application and find the Jdbc URL :
Make sure that the connection type is JDBC DataSource in both the local application module and shared application module.
We require only the last part of the URL i.e here jdbc/dbconnDS.
Open the file %TOMCAT_HOME%\bin\catalina.bat (or .sh if you’re in linux environment) and add in the end of the line ‘set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%’ this -Xms1024m -Xmx1024m

Edit /config/context.xml file from tomcat server.
add resource link.
<ResourceLink global="jdbc/dbconnDS" name="jdbc/dbconnDS"
type="javax.sql.DataSource"/>

<Resource name="jdbc/dbconnDS" auth="Container"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
                                                  url="jdbc:oracle:thin:enonew2/enonew2@192.168.10.172:1521:XE"
              maxActive="20" maxIdle="10"
              maxWait="-1"/>
           

Edit /conf/server.xml
Add data ressource node

 <GlobalNamingResources>
 <Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase" description="User database that can be
updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml"/>
<Resource name="jdbc/dbconnDS" auth="Container"
type="oracle.jdbc.pool.OracleDataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
factory="oracle.jdbc.pool.OracleDataSourceFactory"
url="jdbc:oracle:thin:@192.168.10.172:1521:XE" user="enonew2" password="enonew2" maxActive="20"
maxIdle="10" maxWait="-1"/>
 </GlobalNamingResources>


Add all the following libraries to %CATALINA_HOME%/lib folder:
Extract ADF Essentials zip file inside the %TOMCAT_HOME%\lib
Also add the remaining libraries.
The lib folder should contain the following jar files:
adf-controller-api.jar
adf-controller-rt-common.jar
adf-controller-schema.jar
adf-controller-security.jar
adf-controller.jar
adf-dt-at-rt.jar
adf-dynamic-faces.jar
adf-faces-changemanager-rt.jar
adf-faces-databinding-dt-core.jar
adf-faces-databinding-rt.jar
adf-faces-registration.jar
adf-faces-templating-dt-core.jar
adf-faces-templating-dtrt.jar
adf-pageflow-dtrt.jar
adf-pageflow-fwk.jar
adf-pageflow-impl.jar
adf-pageflow-rc.jar
adf-richclient-api-11.jar
adf-richclient-automation-11.jar
adf-richclient-impl-11.jar
adf-runtime-mbean.jar
adf-sec-idm-dc.jar
adf-share-base.jar
adf-share-ca.jar
adf-share-security.jar
adf-share-support.jar
adf-share-web.jar
adf-view-databinding-dt-core.jar
adf-view-unified-databinding-dt-core.jar
ojdl2.jar
oracle-el.jar
oracle.classloader_11.1.1.jar
oracle.external.jsf-ri-20.jar
oracle.http_client_11.1.1.jar
oracle.logging-utils_11.1.1.jar
 xml-apis-ext.jar
xmlef.jar
xmlparserv2_sans_jaxp_services.jar
xsqlserializers.jar
tomcat7-websocket.jar
trinidad-api.jar
trinidad-impl.jar
velocity-dep-1.4.jar
websocket-api.jar
wls-api.jar
xercesImpl.jar
mdsrt.jar
oc4j-ws-support.jar
oicons.jar
ojdbc6.jar
ojdbc6dms.jar
ojdl.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
tomcat-jdbc.jar
tomcat-util.jar







adf.constants.jar
adfbcsvc-client.jar
adfbcsvc-registration.jar
adfbcsvc-share.jar
adfbcsvc.jar
adfdt_common.jar
adflibfilter.jar
adflibrary.jar
adflogginghandler.jar
adfm-debugger.jar
adfm-sqldc.jar
adfm.jar
adfmportlet.jar
adfmweb.jar
adfsharembean.jar
adftags.jar
adftransactionsdt.jar
annotations-api.jar
batik-anim.jar
batik-awt-util.jar
batik-bridge.jar
batik-codec.jar
batik-css.jar
batik-dom.jar
batik-ext.jar
batik-extension.jar
batik-gui-util.jar
batik-gvt.jar
batik-parser.jargroovy-all-1.6.4.jar
identitystore.jar
inspect4.jar
jasper-el.jar
jasper.jar
javamodel-rt.jar
javatools-nodeps.jar
javax.management.j2ee_1.0.jar
javax.transaction-1.0.0.0_1-1.jar
jdev-cm.jar
jewt4.jar
jms-jmx.jar
jmxdc.jar
jmxframework.jar
jmxspi.jar
jps-api.jar
jps-common.jar
jps-ee.jar
jps-internal.jar
jps-unsupported-api.jar
jrf-api.jar
jr_dav.jar
jsf-api.jar
jsf-impl.jar
jsp-api.jar
jsp-el-api.jar
jstl.jar
jta.jar
log4j-1.2.17.jar
mail.jar
mds-dc.jar


batik-script.jar
batik-svg-dom.jar
batik-svggen.jar
batik-swing.jar
batik-transcoder.jar
batik-util.jar
batik-xml.jar
bc4j-mbeans.jar
bc4jhtml.jar
bc4jimdomains.jar
bc4jsyscat.jar
bundleresolver.jar
cache.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
catalina.jar
commons-el.jar
datatags.jar
db-ca.jar
dms.jar
dvt-basemaps.jar
dvt-databinding-dt-core.jar
dvt-databindings-mds.jar
dvt-databindings.jar
dvt-faces.jar
dvt-facesbindings.jar
dvt-jclient.jar
dvt-trinidad.jar
dvt-utils.jar
ecj-4.2.2.jar
el-api.jar
facesconfigmodel.jar
fmw_audit.jar
glassfish.jstl_1.2.0.1.jar oracle.web-common_11.1.1.jar
oracle.xdb_11.1.0.jar
oraclepki.jar
oraclexsql.jar
orai18n-mapping.jar
ordhttp.jar ordim.jar
org.apache.bcel_5.1.jar
org.apache.commons.beanutils_1.6.jar
org.apache.commons.beanutils_1.8.3.jar
org.apache.commons.logging_1.0.4.jar
org.apache.commons.logging_1.1.1.jar
osdt_cert.jar
osdt_core.jar
prefuse.jar
rcs-adflib-rt.jar
rcsrt.jar
regexp.jar
resourcebundle.jar
servlet-api.jar
share.jar
standard.jar
taglib.jar
tomcat-api.jar
tomcat-coyote.jar



After all these steps copy the WAR file of the project to WEBAPPS folder in Tomcat.
And start the server.



Note:
Some solved exceptions:
1)If on deploying the first time it gives exceptions like :
ADFLifeCycle Exceptions
Or some type cast exception



Then put/remove a unused file into the war file (say a blank document) and let the tomcat environment automatically redeploy the WAR file again.










2)If deployment gives the following Exception:
SEVERE : error FilterStart

Then go to the  %CATALINA_HOME%\webapps\%WAR_FILE_NAME%\WEB-INF
Edit web.xml
And remove the filter tags and filter-mapping tags containing “JpsFilter”


Reference: Praful Kamat

Monday, December 23, 2013

How to add Input Texts(or any element) dynamically within form layout?

1)      Create ADF Form layout and bind the variable to managed Bean
2)      Create method in ManagedBean to perform the action.
3)      Use following code snippet for reference to add inputboxes dynamically within form layout
        inputText = new RichInputText[newValues.length];
        if (childrenLength != 0) {
            getPnlFormLayoutForMassUpdate().getChildren().clear();
        }
        for (int i = 0; i < newValues.length; i++)

        {
            inputText[i] = new RichInputText();

            inputText[i].setLabel(newValues[i]);
            inputText[i].setId("id" + i);
            //  inputText[i].setRequired(true);
            //  inputText[i].setShowRequired(true);
            //inputText[i].setValue(newValues[i]);
          

            getPnlFormLayoutForMassUpdate().getChildren().add(inputText[i]);
            if(newValues[i].indexOf("Date")!=-1)
            {
                    RichActiveOutputText opText = new RichActiveOutputText();
                    opText.setId("otindlg");
                    opText.setValue("Example : 07-Oct-16");
                    getPnlFormLayoutForMassUpdate().getChildren().add(opText);
                }
            //refresh the container to show text field
            AdfFacesContext.getCurrentInstance().addPartialTarget(getPnlFormLayoutForMassUpdate());
            childrenLength++;


        }

How to integrate Google Maps with ADF applicatiIon

How to integrate Google Maps with ADF application…
Today I am going to demonstrate how to integrate google maps API within your application.
Often we come across requirement to show Google maps within our application where user will click on city or location name and accordingly location should be highlighted in google map.
The solution is very simple to integrate…
1)      Create Location table put fields id, locationName,Latitude,Longitude…
2)      Create ADF Fusion application
3)      Create JSF page
4)      In Model Project Create Business Component from table by selecting Location table you created
5)      Drag and Drop Panel Splitter within JSF Page
6)      In one Facet of splitter Drag and Drop Location View Object from Data Control…
7)      Replace Location Name column with following code…
<af:column sortProperty="#{bindings.JgLocationsView2.hints.LocationName.name}"
                                                           filterable="true" sortable="true"
                                                           headerText="#{bindings.JgLocationsView2.hints.LocationName.label}"
                                                           id="c4">
                                                                      <af:outputText value="#{row.LocationName}"
                                                                   shortDesc="#{bindings.JgLocationsView2.hints.LocationName.tooltip}"
                                                                   id="ot4" >
                                                                   <af:clientAttribute name="lat" value="#{row.Latitude}"/>
                                                                    <af:clientAttribute name="long" value="#{row.Longitude}"/>
                                                                    <af:clientListener method="doNavigate" type="click"/>
                                              </af:outputText>
        </af:column>
8)      Replace Second Facet with following line of code…
<f:facet name="metaContainer">
        <af:resource type="javascript" source="http://www.google.com/jsapi?key=AIzaSyBICigoNf4GQVzrdL03_d3Cw1RgucoYvJA"/>
        <af:resource type="javascript"> google.load("maps", "2.x");
                    // Call this function when the page has been loaded
                    function initialize() {
                    var map = new google.maps.Map2(document.getElementById("map"));
                    map.setCenter(new google.maps.LatLng(0,0), 1);
                    map.addControl(new GLargeMapControl());
                    map.addControl(new GMapTypeControl());
                    }
                    google.setOnLoadCallback(initialize);
        </af:resource>
        <af:resource type="javascript">
                          function doNavigate(evt)
                          { long = evt.getSource().getProperty("long");
                            lat = evt.getSource().getProperty("lat");

                            var latlng = new GLatLng(lat,long);
                            var map = new google.maps.Map2(document.getElementById("map"));            

                            map.addControl(new GLargeMapControl());
                            map.addControl(new GMapTypeControl());

                            map.setCenter(new GLatLng(lat,long), 16);
                            map.addOverlay(new GMarker(latlng));
                          }
        </af:resource>
      </f:facet>


Enjoy Google Map !!!

Monday, September 23, 2013

Oracle ADF Essentials

Oracle ADF Essentials - Overview


ADF Essentials provides probably the most powerful (free) framework for developing Java/JEE Web Applications with high productivity and rich functionality in either Oracle JDeveloper or in Eclipse (with the OEPE plugin)- that can be deployed across JEE Containers including Tomcat, JBoss, WebSphere, GlassFish and WebLogic. This offer is bound to attract many more developers and organizations that until now were reluctant to adopt ADF because of the license involved or the supposed tie in with WebLogic and JDeveloper. However: since it is now free of charge and deployable on Tomcat, JBoss and GlassFish – this earlier hesitation is likely to disappear. The productivity and quite advanced functionality are likely to quickly bring in many more developers from the Java/JEE arena.
Advantages of ADF Essentials
Oracle ADF Essentials offers advanced innovative functionality allowing developers to build applications with richer functionality.
Some of the key capabilities of Oracle ADF Essentials include:
·     Ajax and HTML5 enabled UI components
·     Reusable task-oriented controller layer
·     Declarative binding of UI to business services
·     Declarative relational database access layer

With the ability to deploy applications that are based on Oracle ADF Essentials to various servers, without paying a license  fee, more developers can leverage the powerful Oracle Application Development Framework to speed up the creation of cutting edge applications.

What components of ADF faces are included in ADF Essentials
Oracle ADF Essentials includes the following Oracle ADF components: Oracle ADF Faces Rich Client Components, Oracle ADF Controller, Oracle ADF Model and Oracle ADF Business Components.
The following functionality is not included in Oracle ADF Essentials, and requires the full Oracle ADF version – Oracle ADF Mobile, Oracle ADF Desktop Integration, Oracle ADF Security, The Oracle ADF Web service data control, Oracle ADF remote taskflows, Oracle ADF Business Component’s Service Interfaces, Oracle ADF Data Controls for BI, Essbase and BAM, Integration with Oracle Fusion Middleware features such as MDS, OPSS, OWSM, Enterprise Manager and MBeans, High Availability and Clustering.

Note:

ADF Essentials is not open source. The ADF sources are available to customers with an ADF license. There is no community process around further evolving ADF. ADF is and stays Oracle’s strategic development framework for its enterprise applications. It has no intention whatsoever to relinquish control over one of its most important technologies. However, it is interested in sharing that technology with a much wider audience.There is no  separate version of Oracle JDeveloper specifically for Oracle ADF Essentials
The same version of JDeveloper is used to build both Oracle ADF Essentials applications as well as applications that leverage the full Oracle ADF.


References: