Tuesday, June 19, 2018

Create New ADF Business Component Issue in Jdeveloper 12c

In JDeveloper 12c I will show you one of the issue you may face when you try to create new Entity Object or create ADF Business Components From Table.

For this example I have an ADF application with model project and I want to create one new Entity Object in the model project:

- Right click on the Model Project --> New --> Entity Object


- You will find there is no Database Schema and You can't Browse schema object.


- In the Model project if you check if there is a database connection is defined in ADF Business Components or not, you will find there is a database connection defined.



So where is the problem?

Let us try to create the entity using Business Components From Table


You will find in the third step, there is no schema and you can't shuttle anything and the wizard will stop in this step as shown:


When you have a look on the JDev log, you can find exception like:

SELECT /*OracleDictionaryQueries.ALL_VISIBLE_USERS_QUERY*/
U.USERNAME, 'SCHEMA', NULL OBJECT_ID, NULL LAST_DDL_TIME
FROM SYS.DBA_USERS U
WHERE EXISTS ( SELECT 1
               FROM   SYS.DBA_TAB_PRIVS_RECD TPR
               WHERE  TPR.OWNER = U.USERNAME )
AND U.USERNAME LIKE ?
UNION
SELECT USER, 'SCHEMA', NULL OBJECT_ID, NULL LAST_DDL_TIME FROM SYS.DUAL
oracle.javatools.db.DBSQLException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

        at oracle.javatools.db.execute.StatementWrapper.createDBSQLException(StatementWrapper.java:711)
        at oracle.javatools.db.execute.ConnectionWrapper.call(ConnectionWrapper.java:199)
        at oracle.javatools.db.execute.ConnectionWrapper.call(ConnectionWrapper.java:117)
        at oracle.javatools.db.execute.ConnectionWrapper.run(ConnectionWrapper.java:102)
        at oracle.javatools.db.execute.QueryWrapper$QueryExecutionRunnable.runImpl(QueryWrapper.java:459)
        at oracle.javatools.db.execute.StatementWrapper$ExecutionRunnable.run(StatementWrapper.java:920)
        at oracle.ideimpl.db.ProgressBarExecutionWrapper.runAndLog(ProgressBarExecutionWrapper.java:137)
        at oracle.ideimpl.db.ProgressBarExecutionWrapper.access$000(ProgressBarExecutionWrapper.java:37)
        at oracle.ideimpl.db.ProgressBarExecutionWrapper$R.run(ProgressBarExecutionWrapper.java:181)
        at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:961)
        at java.lang.Thread.run(Thread.java:748)



The reason of this issue come from the database user privileges. To fix this issue follow the following steps:

1- Connect to sys database and grant dba to the database user which you use in ADF application Model.


2- Restart Jdeveloper.

3- Now try to create new Entity or Create Business Component From Table, it should be ok and works fine.







Monday, April 25, 2016

Setup Standalone Weblogic 12.2.1 (Step-by-Step)

In this post I will show you how to setup weblogic 12c in production environment. We will go throw all these points:

  • Sources required
  • Setup JDK 8
  • Setup weblogic 12.2.1
  • Setup FMW Infrastructure (ADF Runtime)
  • Create Repository Configuration Utility (RCU)
  • Create Weblogic Domain
  • Run and Configure the domain

1. Sources Required


1.       JDK 8
2.       Weblogic 12.2.1.0.0
3.       FMW Infrastructure (ADF Runtime)


2. Setup JDK 8

Double click on the jdk .exe file and setup jdk on the path has no space as


Do the same in JRE as



3. Setup Weblogic 12.2.1

-          Open cmd and write this:
/bin/java.exe –D64 –jar
For example:
C:\Java\jdk1.8.0_74\bin\java.exe –D64 –jar C:\12c_sources\fmw_12.2.1.0.0_wls.jar


-          Follow the following screen shots to setup Weblogic 12c










4. Setup FMW Infrastructure

-          Open cmd and write this:
/bin/java.exe –jar
For example:
C:\Java\jdk1.8.0_74\bin\java.exe –jar C:\12c_sources\fmw_12.2.1.0.0_infrastructure.jar



-          Setup infrastructure on the created Middleware folder as shown on these screenshots





5. Create Repository Configuration Utility (RCU)


-          You should know database connection information with sys user before start setup RCU.
-          Open cmd and run “rcu.bat” located on this path (/oracle_common/bin)
For example:
C:\Oracle\Middleware12.2.1\oracle_common\bin\rcu.bat


-          Follow these screenshots to setup RCU




These schema owner will be used when you create weblogic domain.







·         6. Create Weblogic Domain

-          Open cmd and run \wlserver\common\bin\config.cmd
For example:
C:\Oracle\Middleware12.2.1\wlserver\common\bin\config.cmd


-          Follow these screenshots to create the domain:












  7. Run and Configure the domain


-          Run this command to run AdminServer \ user_projects\domains\\bin\startWebLogic.cmd
For example:
C:\Oracle\Middleware12.2.1\user_projects\domains\ADFDomain\bin\startWebLogic.cmd


-          After successfully running the AdminServer open the browser and open the console from this url http://serverIp:port/console
For example:
 http://weblogic12:7001/console

-          From the console create a ManagedServer and after creating the managed server the JRF libraries automatically will applied to the server so no need to go to em to apply JRFTemplate anymore


-          Create a Machine and add AdminServer and ManagedServer to this machine



-          Install Node Manager services by invoking \user_projects\domains\\bin\installNodeMgrSvc.cmd
For example:
C:\Oracle\Middleware12.2.1\user_projects\domains\ADFDomain\bin\installNodeMgrSvc.cmd
-          You can configure node manager from nodemanager.properties file. You can find this file in this path:
\user_projects\domains\\nodemanager
For example:
C:\Oracle\Middleware12.2.1\user_projects\domains\ADFDomain\nodemanager

Note: if you make any changes in nodemanager.properties file you have to restart node manager services.

-          Shutdown AdminServer and ManagedServer.
-          To increase the ManagedServer memory, you can open setStartupEnv.cmd file from this path:
\user_projects\domains\\bin\
For example:
C:\Oracle\Middleware12.2.1\user_projects\domains\ADFDomain\bin\
In the section if "%STARTUP_GROUP%"=="“ you can configure memory as



-          Run AdminServer and ManagedServer using node manager as:

Ø  Run wlst.cmd from \wlserver\common\bin\wlst.cmd


Ø  Connect to node manager using this command
nmConnect('weblogic','','','','','','ssl')

For example:

nmConnect('weblogic','weblogic1','localhost','5556','ADFDomain',' C:\Oracle\Middleware12.2.1\user_projects\domains\ADFDomain ','ssl')


Ø  Start AdminServer using this command:
nmStart('AdminServer')

Ø  Start ManagedServer using this command:
nmStart('') as
nmStart('ADFServer')


You can download a word document file (.docx) from here




Tuesday, February 2, 2016

Change Web Service WSDL at Runtime When Calling SOAP Web Service (Step-by-Step)

Sometime we need to change the Web Service WSDL URL dynamically at runtime when we call web service. The Web Service may deployed in different environments and you want depending on some conditions you will decide which version you should call.
In this example I will show you how to call SOAP Web Service progrmatically with dynamic wsdl url.

I used JDev 11.1.2.4.0 for developing this complete example.

1- Create a Simple Web Service:

I will create a simple web service has one function call "sayHello" this function will receive String and will return "Hello " + String.

- From JDeveloper create a custom application "e.g SimpleWebService" with one project "e.g SimpleWS" then create a class "e.g MyWebService.java" has one function sayHello as shown




- Right click on the MyWebService.java --> Create Web Service


- Go throw the opened wizard to create the web service. After finish creating the web service the application should be like:



- Right click on the MyWebService.java --> Test Web Service



Now the web service is running in my local machine with wsdl url

http://localhost:7101/SimpleWebService-SimpleWS-context-root/MyWebServicePort?wsdl

I will deploy it in another server and the web service wsdl url will be

http://weblogic2:8000/SimpleWebService-SimpleWS-context-root/MyWebServicePort?wsdl

- Now we finished creating Web Service and deployed it in 2 different environments with 2 different wsdl url.


2- Create a jar File for Calling The Web Service

To call this web service in other applications like ADF application or Java Application you should create jar file and use this jar file on this application.

- Create dummy application --> right click on the project --> New --> Web Service Client and Proxy


- Enter any of the Web Service wsdl url (I will enter the local running web service wsdl url) then press Finish


- The client class will open with code in case you want to test WS



- To create the jar file, right click on the project --> Deploy -->MyWebService-Client


- We will use the generated jar file on other application which will call this WS like ADF Application or any Java application

3- Call the The Web Service Programmatically With Dynamic WSDL URL

- Create new custom application "e.g. CallWebServiceDynamically" with java class "e.g. CallWS.java"



- Import jar file (which we created in the previous point) in the project


- Inside CallWS class write main method with this code



I will describe this code line by line:

     QName qname = new QName("http://simplews/", "MyWebService");

QName will receive 2 parameters you can get these 2 parameters by running the Web Service WSDL in any browser and take the value of targetNamespace and name



URL wsdl1 = new URL("http://localhost:7101/SimpleWebService-SimpleWS-context-root/MyWebServicePort?wsdl");

In this line you write the desired web service WSDL URL

 MyWebService_Service myWebService_Service = new MyWebService_Service(wsdl1, qname);
 MyWebService myWebService = myWebService_Service.getMyWebServicePort();

These 2 lines you can get it from the dummy application client class (which generated when we try to generate jar file in the previous step)

But the first line is bit different because it will accept the wsdl url and gname



System.out.println("Web Service Output= " + myWebService.sayHello("Sameh"));

This is line for testing the Web Service and print the output on the log.

- To run the test application Right click on the CallWS --> run
You will find the web service output on the log


- Try to change the wsdl to point to the second deployed web service and run again



You can download the sample examples from here