Search This Blog

Showing posts with label ADF BC. Show all posts
Showing posts with label ADF BC. Show all posts

Thursday, 6 May 2010

JDeveloper 11g - ADF Deployment using a Data Source defined in WLS itself

Typically when deploying ADF applications I will use a data source config defined at the WLS level and targeted to my managed server or cluster. I then deploy my ADF application from JDeveloper to that managed server or cluster however there are a few things to be aware of prior to deployment to ensure your using the correct Data Source. By default you won't be using the WLS defined Data Source if you not aware of a few things.

Note: For those who prefer to use a separate Data Source per application then out of the box you don't need to follow the steps below as it will do that for you by default. Also for our model ADFBC project we are assuming that it's configurtion is set to use "JDBC DataSource".

When your ready to deploy

1. Select "Applications -> Application Properties"
2. Click on "Deployment"

By default the "Auto generate and synchronize weblogic-jdbc.xml Descriptors during deployemnt" will be checked.

3. Uncheck that option we don't want to do that here as we already have a Data Source created in WLS.

4. Verify indeed that the weblogic-jdbc.xml is not part of the archive by selecting "Application -> Deploy -> .. to ear file"

Note: This show we no longer will bundle a weblogic-jdbc.xml file.

 
D:\jdev\jdevprod\11gr3\jdeveloper\jdev\mywork\ADFDemo\deploy>jar -tvf ADFDemo_application1.ear
4305851 Thu May 06 09:45:32 EST 2010 ADFDemo_ViewController_webapp1.war
221 Thu May 06 09:45:34 EST 2010 META-INF/adfm.xml
495 Thu May 06 09:45:34 EST 2010 META-INF/application.xml
3933 Thu May 06 09:04:04 EST 2010 META-INF/cwallet.sso
949 Thu May 06 09:04:02 EST 2010 META-INF/jps-config.xml
1559 Thu May 06 09:03:20 EST 2010 META-INF/weblogic-application.xml
745 Thu May 06 09:04:02 EST 2010 adf/META-INF/adf-config.xml
1253 Thu May 06 09:04:04 EST 2010 adf/META-INF/connections.xml
831 Thu May 06 09:05:10 EST 2010 adf/model/common/bc4j.xcfg
273 Thu May 06 09:45:34 EST 2010 lib/adf-loc.jar

D:\jdev\jdevprod\11gr3\jdeveloper\jdev\mywork\ADFDemo\deploy>


5. Finally it's worth checking that indeed you not using a bundled data source so that you are actually defining the required properties for your data source in WLS console for the correct one.

Thursday, 24 September 2009

Trace/Diagnostics output from ADF BC Web Services using FMC (EM) in OFM 11g R1

When you deploy your ADF BC Application module as a Web Service interface you can take advantage of Fusion Middleware Contol (EM) to trace the web service execution from FMC (EM) itself as I will show here.

Note: This is only applicable to ADF BC Web Services, the same steps won't work for JAX-WS or PLSQL web services created in JDeveloper 11g R1.

The documentation for Service-Enabled application modules can be found here.

Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework
11g Release 1 (11.1.1)

Part Number B31974-03
11 Integrating Service-Enabled Application Modules
http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcextservices.htm#CJAJGIEB

In order to do this we need to achieve 3 steps here.

1. Setup Fusion Middleware Control (EM) in your domain

In short your domain will need to be setup as per these steps.

http://theblasfrompas.blogspot.com/2009/07/installing-adf-runtime-on-oracle-fusion.html

2. Deploy an ADF BC App Module as a Web Service Interface

Note: It is assumed you have a client method exposed in your ADF BC application module. An example of such a method is as follows. You will need to ensure the method is exposed as a client method.


public String getVersion ()
{
return getSession().getVersion();
}

2.1. Right click on your application module XML file and and select "Open {app module name}"
2.2. Select "Service Interface"
2.3. Select the + symbol
2.4. Enter in the service interface details.
2.5. Click next
2.6. Shuttle across the methods you wish to expose.
2.7. Ignore the "Service View Instances" and click next
2.8 Click Finish.

You end up with something as follows in the application navigator.





















2.9. Now we need to create a deployment profile which we do by double clicking on the proejct to invoke the "Project properties" dialog.
2.10. Select "deployment"
2.11. Click New
2.12. Select the archive type as "Business Components service Interface"

2.13. Give it a name and press Ok

At this point you have created an EJB JAR file , which you can deploy by using the menu item for the workspace "Deploy" and targeting an Application Server Connection for your OFM 11g R1 server. Once deployed you should end up with output as follows.

[10:38:37 AM] ---- Deployment started. ----
[10:38:37 AM] Target platform is (Weblogic 10.3).
[10:38:44 AM] Entering Target Selection Dialog
[10:38:48 AM] Retrieving existing application information
[10:38:48 AM] Running dependency analysis...
[10:38:48 AM] Building...
[10:38:49 AM] Deploying 3 profiles...
[10:38:49 AM] Wrote EJB Module to D:\jdev11gr1\jdeveloper\jdev\mywork\ADFBC-WS\Demo\deploy\ADFBC-WS-Demo-context-root.jar
[10:38:50 AM] Wrote Archive Module to D:\jdev11gr1\jdeveloper\jdev\mywork\ADFBC-WS\Demo\deploy\adfbc-ws_Common.jar
[10:38:50 AM] Wrote Enterprise Application Module to D:\jdev11gr1\jdeveloper\jdev\mywork\ADFBC-WS\deploy\Demo_adfbc-ws.ear
[10:38:52 AM] INFO: Unable to load annotation weblogic.javaee.CallByReferencefor parsing. The annotation is ignored.
[10:38:52 AM] INFO: Unable to load annotation weblogic.javaee.CallByReferencefor parsing. The annotation is ignored.
[10:38:52 AM] INFO: GenericWSWarAnnotationListener.parseAnnotatedClass Adding Servlet Mapping with URL pattern /AppModuleService for annotated WebService class pas.au.adf.ws.server.serviceinterface.AppModuleServiceImpl
[10:38:54 AM] Deploying Application...
[10:38:59 AM] [Deployer:149191]Operation 'deploy' on application 'Demo_adfbc-ws' is initializing on 'debug_ws'
[10:39:16 AM] [Deployer:149192]Operation 'deploy' on application 'Demo_adfbc-ws' is in progress on 'debug_ws'
[10:39:21 AM] [Deployer:149194]Operation 'deploy' on application 'Demo_adfbc-ws' has succeeded on 'debug_ws'
[10:39:21 AM] Application Deployed Successfully.
[10:39:21 AM] Elapsed time for deployment: 43 seconds
[10:39:21 AM] ---- Deployment finished. ----


3. Use FMC (EM) to trace the ADF BC web service execution.


3.1 Log into FMC (EM) as follows

http://{server}:{port}/em

3.2 In the navigator pane, expand WebLogic Domain
3.3. Expand the domain
3.4. Select the desired server from the list.
3.5. From the WebLogic Sever menu, select Logs > Log Configuration
3.6. On the "Log Levels" tab you need to select "Loggers with persistent Log Level State", then expand the "Specify Loggers"
3.7. At the bottom and enter the logger name "oracle.webservices" and optionally setup the "
Diagnostic Logging Level" you wish to use.
3.8. Press Apply.

Now at this point we have to restart the server.

Once re-started log back into EM and verify the Log configuration shows "oracle.webservices" as shown below.














Now we can test our web services as shown in this entry and verify we get web services diagnostics logging placed into the log file "debug_ws-diagnostic.log" which would be in a directory as follows $DOMAIN_HOME/servers/{managed-server-name}/logs

http://theblasfrompas.blogspot.com/2009/09/web-services-security-in-ofm-11g-r1.html

An example of the output is as follows


<anonymous>
] [ecid: 0000IFdFy2wFw000jzwkno1Aidcd00003S,0:3] [WEBSERVICE_PORT.name:
AppModuleServiceSoapHttpPort] [APP: Demo_adfbc-ws] [J2EE_MODULE.name:
ADFBC-WS-Demo-context-root] [WEBSERVICE.name: AppModuleService]
[J2EE_APP.name: Demo_adfbc-ws] Incomplete connection information
[2009-09-24T09:32:46.827+10:00] [debug_ws] [WARNING] []
[oracle.adf.share.jndi.ReferenceStoreHelper] [tid: [ACTIVE].ExecuteThread:
'2' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId:
<anonymous>
] [ecid: 0000IFdFy2wFw000jzwkno1Aidcd00003S,0:3] [WEBSERVICE_PORT.name:
AppModuleServiceSoapHttpPort] [APP: Demo_adfbc-ws] [J2EE_MODULE.name:
ADFBC-WS-Demo-context-root] [WEBSERVICE.name: AppModuleService]
[J2EE_APP.name: Demo_adfbc-ws] Incomplete connection reference object
[2009-09-24T09:32:50.828+10:00] [debug_ws] [TRACE] [OWS-04010]
[oracle.webservices.service] [tid: [ACTIVE].ExecuteThread: '2' for queue:
'weblogic.kernel.Default (self-tuning)'] [userId:
<anonymous>
] [ecid: 0000IFdFy2wFw000jzwkno1Aidcd00003S,0:3] [SRC_CLASS:
oracle.j2ee.ws.server.ServerMessages] [APP: Demo_adfbc-ws] [SRC_METHOD:
fineMsgServletResponse] [arg:
{/pas/au/adf/ws/common/}AppModuleServiceSoapHttpPort] [arg:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns0:getVersionResponse xmlns:ns0="/pas/au/adf/ws/common/types/">
<result xmlns="/pas/au/adf/ws/common/types/">11.1.1.54.7</result>
</ns0:getVersionResponse>
</env:Body>
</env:Envelope>
] The SOAP response for port:
{/pas/au/adf/ws/common/}AppModuleServiceSoapHttpPort is:[[

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns0:getVersionResponse xmlns:ns0="/pas/au/adf/ws/common/types/">
<result xmlns="/pas/au/adf/ws/common/types/">11.1.1.54.7</result>
</ns0:getVersionResponse>
</env:Body>
</env:Envelope>
]]
</anonymous>
</anonymous>
</anonymous>

You can also view the log file from FMC (EM) as follows
:

- From the WebLogic Sever menu, select Logs > View Log Messages
- Click on "Target Log Files" button.
- In the log files table select the row containing "debug_ws-diagnostic.log" and press the button "View Log File".

More Information

Oracle® Fusion Middleware Security and Administrator's Guide for Web Services
11g Release 1 (11.1.1)
Part Number B32511-01
15 Diagnosing Problems
http://download.oracle.com/docs/cd/E12839_01/web.1111/b32511/diagnosing.htm#WSSEC1226

Thursday, 30 April 2009

ADF 11g - Groovy expression for default value of todays date

I have an EO with one Date column which I wanted to default to today's date on record creation. Normally I would create a EO class and add the "create" method to the class to achieve this but I found it's even easier to use a groovy expression which I did as follows.

1. Double click on EO to bring it up in the code editor "Overview" tab.
2. Click on attributes
3. Select the "Date" attribute and press the edit icon
4. Place the following into the "Value" field

String.format('%tF', new Date())

Note: This will ensure we retrieve today's date and format the date into the format which our Date EO attribute is using which in this case is "YYYY-MM-DD".

5. Select the check box "Expression" for the "Value Type"

Note: You can also use the built in Groovy expressions adf.currentDate and adf.currentDateTime that you can use.

6. Press OK.

Now when we create a new record the default value for the date will be todays date using a groovy expression.

You can see from this groovy script that unless we format the output ADF will throw a runtime error with just the use of new Date() without any formatting.

Groovy Script:

def today= new Date() //represents the date and time when it is created
println today

println String.format('%tF', today)

Output:

Thu Apr 30 11:51:54 EST 2009
2009-04-30

More information on groovy and ADF can be found here.

http://www.oracle.com/technology/products/jdev/11/how-tos/groovy/introduction_to_groovy.pdf

Tuesday, 1 April 2008

Changes made in bc4j.xcfg from JDeveloper Application Module Configuration editor

The file bc4j.xcfg has various configuration parameter's which if not displayed will take on their defaults. After a recent customer visit I was asked if a default configuration parameter was added to the file and then reverted back to it's original default value is the parameter removed from the bc4j.xcfg file to ensure it can be supplied at the container level if required?

I would suspect it would but to prove that here is what I did.

1. Created a simple ADF BC project based on 1 entity and 1 view object, in this case EMP
2. Right click on the application module and select -> Configurations
3. Click the "Edit" button on your configuration
4. Click on the tab "Pooling and scalability"
5. Set the initial pool size of the "Application Pool" to 5 and press OK

The following is added to the bc4j.xcfg file.

<jbo.ampool.initpoolsize>5</jbo.ampool.initpoolsize>

Now if we redit the config and set the same value to 0 (which is it's default) does it remove the parameter?

The answer is yes.

Of course you can click on "Reset" button BUT that will remove all configuration parameters you set which may not be what you require.