Tuesday, November 10, 2015

Oracle ADF 12.2.1 Change Maven Local Repository Location

Following post describe the solution for an issue which might come after changing the maven local repository location in JDeveloper.

To change the Maven local repository location, go to Tools -> Preferences -> Maven -> Repositories in JDeveloper and enter the path of your own repository location:


After changing the local repository location, localRepository tag will get added in the settings.xml file (by default present in C:\Users\username\.m2 directory ), if not present already.

Now since the new repository don't have required ADF libraries, following issue might be faced while running the build for ADF project.


[ERROR] Failed to execute goal on project ChildModel: Could not resolve dependencies for project DeploymentTest_ChildApplication:ChildModel:jar:1.0-SNAPSHOT: Failed to collect dependencies at com.oracle.adf.library:BC4J-Runtime:pom:12.2.1-0-0 -> com.oracle.fmwshare:adf-share-support:jar:[12.2.1,12.2.2): No versions available for com.oracle.fmwshare:adf-share-support:jar:[12.2.1,12.2.2) within specified range -> [Help 1]



The solution for above issue is to populate new repository with all the required libraries:

Following are the steps for configuring new repository with weblogic maven plugin:

        1)    Open command prompt and change directory to

        ORACLE_HOME\oracle_common\plugins\maven\com\oracle\maven\oracle-maven-sync\12.2.1

        2)    Execute following command

        mvn install:install-file -DpomFile=oracle-maven-sync-12.2.1.pom -Dfile=oracle-maven-sync-12.2.1.jar

        3)    Now execute following command to push libraries into local repository

        mvn com.oracle.maven:oracle-maven-sync:push -DoracleHome=MIDDLEWARE_HOME

Once the above command is successful, it will populate the repository with all required libraries and build will run successfully.

Saturday, November 7, 2015

Oracle ADF - Maven Build And Deploy Issues

Following are some issues which might be faced while using maven with Oracle ADF:

1) [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MasterModel: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]

Solution: Add distributionManagement tag in POM.xml file for the project mentioned in the error. Like MasterModel project mentioned in above error.

<distributionManagement>
  <repository>
    <id>MasterModel</id>
    <name>localRepo</name>
    <url>file://C:/Users/Username/.m2/repository/</url>
  </repository>
</distributionManagement>

The vale in <url> will differ based on the repository location. Also the above tag will need to be added in all the pom.xml files (i.e pom.xml file for model, viewController and complete application ) otherwise the same error will come at different time in the build.

2) [ERROR] Failed to execute goal on project MasterViewController: Could not resolve dependencies for project deploy.masterapp:MasterViewController:war:1.0-SNAPSHOT: Failure to find com.oracle.adf.library:ADF-Library:pom:12.2.1-0-0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

Solution: The above issue came while running the pom build for the project which is accessing a taskFlow from ADF library jar file. After creating the File System connection for the taskflow to be used, when the taskflow was dropped on the page, this library dependency was automatically added in pom.xml file of consuming application. However this was not resolved during build. So the workaround of this was to remove this from the pom.xml file and add the dependency using "Add From Repository" option. Another post describes, how to add dependency from repository.

3) oracle.adf.controller.ControllerException: ADFC-02001: The ADF Controller cannot find '/WEB-INF/child-task-flow-definition.xml'....
Caused by: oracle.mds.core.MetadataNotFoundException: MDS-00013: no metadata found for metadata object "/WEB-INF/child-task-flow-definition.xml"
MDS-00201: PDocument not found in MetadataStore : [store-type=DefaultMetadataStore app-name=DeploymentTest_MasterApp lookup-order=ServletContext,Classpath]

Solution: This issue came on running the jsf page (i.e. right click and run in JDeveloper) which was having taskflow added from a ADF library jar. Please note, this issue only came with the application which was created by selecting Maven as build tool in the last step of application creation wizard. It was not faced for the application which was created using default build option in the last step.

The solution for the above issue is to first run the install target of master application pom.xml file. This will place all the artifacts (jar, war of the projects in master application as well as child application) in the repository. The above seems to be because of missing artifact from MDS but there is no MDS configuration in application. After successful completion of install target of the master application, this issue was not faced on running the application from JDeveloper.

Monday, November 2, 2015

Oracle ADF 12.2.1 Create Rest Data Control

Following are the steps of creating REST DataControl based on REST service exposed by application module as mentioned in this post:

1) Open Create Web Service Data Control wizard from gallery:


2) Click on green plus icon to create rest service connection: Following is the format of the URL

http://[host:port]127.0.0.1:8001/[Context]ADFRESTWebService/rest/[ReleaseVersion]RestRelease1/[ResourceName]Departments/describe

3) Click Ok.


4) Click Next and select any policy to be applied:


5) Click Next and select the resources to be exposed:


6) Click Test Rest Connection and finish after connection is successful.


7) Data Control will get created in Data Control palette


Another way of creating Data Control is by using Rest Connection:

1) Create Rest Connection and right click on the resource/connection to create data control:



2) Select the project in which data control is to be created:


Finally we can drag and drop the Department resource from the data control on the page as usual: