Thursday, July 28, 2011

WebCenter Environment Dependencies


If you have ever installed a base WebCenter PS3 environment, you will know that missing from this install is a managed server specifically there as a deployment target for your new and beautiful custom WebCenter Application – Your WebCenter Portal.  

As part of the installation you get a shiny new Spaces managed server but nothing for the portal. I am lead to believe this will change in the future, so PS4 or PS5 – Oracle PM's please confirm if you read this, but until then you need to create your own managed server and MDS to target and deploy your WebCenter portal application to.

The problem with this is unless you magically or intuitively pick which libraries to associate with your new managed server when you create it you will find that your deployment will fail until you add those libraries.

No major biggie, but annoying. I thought I would record a list of the libraries I know that are required by your portal managed server. If I missed some out, well, please add them in comments, and obviously, the more services and things you add to your application then the more libraries you will need.

The following list is the most basic you will need just to install the base WebCenter Portal created from the standard jDeveloper template.

Usually you will receive the following error message

Error while processing library references. Unresolved application library references, defined in weblogic-application.xml”

Luckily this is one of the nicer error messages you will ever receive from jDev, WebLogic or WebCenter. Basically the weblogic-application.xml and/or weblogic.xml files reference dependent libraries, and these need to be present on the managed server your are deploying to.

This appears to be a comprehensive list.
  • oracle.webcenter.framework,
  • oracle.webcenter.skin,
  • oracle.sdp.client,
  • p13n-app-lib-base,
  • oracle.ucm.ridc.app-lib
  • wcps-util-app-lib,
  • content-app-lib,
  • oracle.webcenter.spaces.fwk,
  • oracle.webcenter.framework.core,
  • oracle.webcenter.activitygraph.lib,
  • oracle.webcenter.forum.dependency
  • oracle.webcenter.jive.dependency
  • oracle.webcenter.framework.view,
  • content-web-lib,
  • wcps-services-client-web-lib,
  • jaxrs-framework-web-lib,
  • jersey-web-lib

What to do.
  1. Open your WebLogic Console and navigate to the deployments list.
  2. Select each one of the libraries listed above one by one, navigate to the targets tab.
  3. Select your desired target from the list and hit save.
That's it
All done. Now your deployment will work wonderfully... unless you have not set up your MDS target, but that will be for another post.

Happy WebCenter-ing.

Wednesday, June 15, 2011

OSB with JMS Queues

I don't often get to play with Oracle Service Bus much anymore, but I always enjoy the chance when it comes along. Right now that need has indeed arrived in the form of JMS messaging.
OSB makes message management easy, queues or topics, messages to either can be enqueued or dequeued with simple services. Let me show you how.

Here is the use case
  1. Dequeue a message on a JMS queue
  2. Write message payload to a report
  3. Write out and queue new message on another queue, possibly after transformation for another service/system to collect, and,
  4. Make the write action call-able via a Web Service interface.
The only gotcha with OSB is this simple rule.

Business Services only Enqueue messages
Proxy Services only Dequeue messages

Understanding, remembering and applying this principal make's the whole thing easy.

I have created two WebLogic Server JMS queues which I will use in this example; andrewq1 and andrewq2.

Lets begin.
1. Login to the OSB console and create whatever folder structure you like.
2. Create a Business Service to write (enqueue) the message payload using the JMS transport adapter. Make sure you use the jms format; eg jms://192.168.13.136:8011/jms.andrewconnfactory/jms.andrewq2
I named mine writeQ.


3. Enable the Operational Settings for Monitoring and Tracing. Save and Submit.
4. Create a Proxy Service now to read (dequeue) the JMS messages.
5. Much the same as the Business Service configure the message payload to use the JMS transport adapter. Make sure you use the jms format; eg jms://192.168.13.136:8011/jms.andrewconnfactory/jms.andrewq1
I named mine readQ.




6. Enable the Operational Settings for Monitoring and Tracing. Save and Submit. 
7. Now we need to modify the Message Flow so the readQ Proxy Service knows what to do and writes out a message report so we can view the payload via the OSB operations dashboard.
8. Create a Pipeline pair and add a stage as shown.


9. Modify the stage actions to write out the dequeued payload to a report, and then route the payload to the queue andrewq2 using the writeQ business service. We could also handle some transformation etc here, but thats for another post :-)


10. That's it for OSB, Save and Submit your changes. Lets start testing!
11. We can cheat at the moment and use the WebLogic JMS message queue utility available from the Queue Monitoring Tab. We could also write a Business Service to write a message to this queue too, and we have created one already, but this way adds another option to this example.
12. Select show messages on the outbound queue from the monitoring tab.


13. Select the new button. You can also see the queued messages sitting here as well, not that there will be any as OSB is polling this queue for messages now and will act to dequeue as soon as one is written.


14. Create a new message and make sure you set the message type to be TextMessage.




15. That will create a message on the first queue, OSB will collect it, write out the payload to a report and write the message to the second queue. To view the report select Message Reports from the Operations Dashboard.




16. Selecting this message will show you the payload details and the transaction information.


17. When you select details you will see the xml payload.


18. Now we can go to the second queue (mine was called andrewq2) and you will see some messages queued awaiting collection.




19. And again you can select a message to see the contents. No surprise here, the payload shows what I typed in earlier.




And thats it. Well there is alot more that could and probably should be done, but this is just a taster, and you can extend what you have created now as you please.

Enjoy and don't forget to look in sometimes on WebCenter's very capable integration cousin - OSB.

Thursday, May 19, 2011

Creating Business Mashups using a webservice in Webcenter PS3

One key capability in WebCenter PS3 is the ability to create Data Controls and Taskflows at runtime. You can create a data control using SQL or a webservice, and wire this data control into a custom taskflow that can be created at run time which shall use a Mashup Style to render the data control. We could build different data controls and mash them up via taskflows by leveraging the underlying WebCenter schemas.

Let’s build a data control from a webservice and render that on a WebCenter Spaces page.

In this example we will create a simple currency converter task flow, consuming a web service and make a data control out of it. From there we will display it on the Spaces page.

The service url is: http://www.webservicex.net/CurrencyConvertor.asmx?WSDL

Here are the Steps :


1. Logon to your Space as an admin user.
2. From you Space navigate to Manage > All Settings



3. Go to the spaces resource Management tab and navigate to the Data Controls



4. Then create a Data Control by selecting the webservice option. Select Create > Web Service. Provide the details for the data control Name (Currency Converter), Description and provide the WSDL details. Ensure you provide Proxy details as well if needed and click connect.



5. Select the method to be consumed Click Create to finish



6. Click Edit and select the "show" attribute for the Data control to be visible from the Composer/Business Dictionary
7. Create a Taskflow with a Blank Mashup style



8. Edit the task flow by selecting Edit > Edit
9. Select Add Content and Select the Mash-Ups folder




10. Select Data Controls




11. Select Currency Converter




12. Select Add > ADF Button




13. Select Conversion Rate to drill into the Currency Converter Data Control

14. Select the Add > ADF Output Formatted w/Label




15. Select ToCurrency Add > ADF Input Text w/Label

16. Select FromCurrency Add > ADF Input Text w/Label

17. Then select Close

18. Select View and choose Source




19. Select the element InputText: ConversionRate_ToCurrency element and select Edit
20. Change the Input Text Label to “To Currency” then OK




21. Repeat the process again for the FromCurrency InputText element and change the Label to “From Currency” then OK

22. Now select the panelLabelandReturn text element and change the Label to “Exchange rate” then OK




23. Finally select the commandButton and change the Text to “Get Exchange Rate” then OK

24. Select the Box element then select Edit and order the “To Currency” Input text element to the top then OK




25. Save and Close the Task Flow editor

26. Select Edit > Show to display the Task Flow in the Business Catalogue

27. Now we need to create a new page to display this task flow

28. Select Pages > Create Page, name it MashUp select a blank template
29. Select Add Content > Mash-Ups > Task Flows and choose to Add the CurrencyConverterTF task flow to the page.

30. Select Save and Close

31. Run a test and Enter USD in the To Currency field and AUD in the From Currency field and press the Get Exchange Rate button




Gotta love the value of the Australian dollar right now. Time to go shopping :-)

That was a quick tutorial on how to add webservice capabilities to your WebCenter deployment.

Many thanks to Vijaykumar Yenne for his original viewlet.

Cheers
Andrew Rosson

Perth, Western Australia

JVM settings: Handy hints

The Java Virtual Machine (JVM) is a virtual “execution engine” instance that executes the bytecodes in compiled Java class files. Java programs are compiled into a form called Java bytecodes. To the JVM, a stream of bytecodes is a sequence of instructions.

Tuning the JVM to achieve optimal application performance is one of the most critical aspects of WebLogic Server performance.

Oracle recommends to use:
• Oracle JRockit JVM for production servers
• Sun HotSpot JVM for development servers and for running other WLS utilities

Setting Weblogic Server JVM Arguments:

If we want to use different JVM after domain creation is possible by setting some WLS JVM arguments.

Start JVM with Custom JVM settings.

export JAVA_VENDOR=”Oracle”
export USER_MEM_ARGS=”-Xms512m –Xmx1g”
./startWebLogic.sh

  • “Oracle” indicates that you are using the JRockit SDK. It is valid only on platforms that supportJRockit.
  • “Sun” indicates that you are using the Sun SDK.
  • “HP” and “IBM” indicate that you are using SDKs that Hewlett Packard or IBM have provided. These values are valid only on platforms that support HP or IBM SDKs.

Basic Sun JVM Arguments :

  • -XX:NewSize (default 2 MB): Default size of new generation (in bytes)
  • -XX:MaxNewSize: Maximum size of new generation (in bytes). Since 1.4, MaxNewSize is computed as a function of NewRatio.
  • -XX:NewRatio (default = 2): Ratio of new to old generation sizes
  • -XX:SurvivorRatio (default = 8): Ratio of Eden size to one survivor space size.
  • -XX:TargetSurvivorRatio (default = 50%): Desired percentage of survivor space used after scavenge
  • -XX:MaxPermSize: Size of the permanent generation

Basic JRockit JVM Arguments:

  • -Xms The initial amount of heap allocated to the JVM
  • -Xmx The maximum amount of heap that this JVM can allocate
  • -Xns Size of the nursery generation in the heap
  • -XgcPrio A priority level that helps to determine which GC algorithms the JVM will use at run time:
  • throughput: Maximize application throughput
  • pausetime: Minimize how long GC runs
  • deterministic: Consistent response times
  • -XXcompactRatio The percentage of the heap

Common JVM Issues:

Out of Memory : JVMs trigger java.lang.OutOfMemoryError when there is insufficient memory to perform some task . An out-of-memory condition can occur when there is free memory available in the heap but it is too fragmented and not contiguously located to store the object being allocated or moved (as part of a garbage collection cycle).

Memory Leak : Are a common cause of out-of-memory errors, can occur because of excessive caching.

JVM Crash: We can identify and troubleshoot a JVM crash by the diagnostic files that are generated by the JVM. A snapshot is created
that captures that state of the JVM process at the time of the error.

This binary file contains information about the entire JVM process and needs to be opened using debugging tools.
The gdb debugging tool, popular on Linux, can extract useful information from core files. The Dr.Watson tool on Windows provides similar capabilities.

On the Sun JVM, the log file is named hs_err_pid.log, where is the process ID of the process. JRockit refers to this error log as a “dump” file, and is named jrockit..dump.

Basic JVM Tools:
– Stack Trace
– Thread Dump
– Verbose GC
– Sun Profiler Agent
– Sun Diagnostic Tools
– JVisualVM