Wednesday, May 28, 2014

Change the context root of your Portal Application



Often when we create a project a default context root is created for the portal application.For any custom project we need the context root to be logical hence there is a need to change the context root for your portal application.

In order to change the context root of your portal application.

Go to your Jdeveloper portal project

Select your project and right click on it.

Select project properties

Now go to the JAVA EE Application tab and change the

JAVA EE_Web Context root as shown below



go ahead and redeploy the project and this time you will get the context root to be new root what you have defined just now.

Error 404 --Not Found in Oracle Web Center



I create a simple portal with some pages. This was working fine till i was using the default navigation. However as per best practice i removed the default navigation of Page hierarhy and added my page manually to the list.

But after this change i am getting following error while navigating from one page to other, i.e. once i pass used/pwd and login it redirects to the following page.



The error message is as following

Error 404--Not Found

From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:

10.4.5 404 Not Found

The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.

If the server does not wish to make this information available to the client, the status code 403 (Forbidden) can be used instead. The 410 (Gone) status code SHOULD be used if the server knows, through some internally configurable mechanism, that an old resource is permanently unavailable and has no forwarding address.


NOt sure if i am missing any thing but this issue comes alternate time. That is first time it fails and next time when i try to login it works fine so as of now i have a workaround but i am not sure of the exact solution for this issue.

This issue also comes when your page hierarhy is not correct in the default navigation model, i.e. let suppose you have create a page A which has a subpage B.
The page A has a security. Now if in the navigation you will mention another page in between the PageA and Page B you will end up with the same error. So it is very important that you create a correct navigation rule for the project.

Tuesday, May 27, 2014

Connect to UCM from Jdeveloper


Integration with Content manager is done so that we can store our document in UCM and further we can use the document manager taskflows to manage the documents in our portal.
There is also a Content presenter which can be used to create and present the document that are stored in UCM.

In order to integrate UCM with Jdeveloper one need to have a UCM server up and running a compatible version of Jdeveloper. I am using Jdeveloper 11.1.1.7 and web center 11.1.1.8 in my case.

The connection to content manager is done using a socket connection so we first need to validate if the server has these information already preconfigured.

Login to em console

http://host:port/em

Go to Web Center-->Content-->Content Server -->Oracle WebCenter Content

Right click on Oracle WebCenterContent and select Configuration and then select INternet Configurations




So your server already has a default configuration and we will use the same to connect from our Jdeveloper.

Open up you Jdeveloper

Go to resource pallete

Say new Connection and select the Content Repository as shown below.

This will come up with a new gui page



Now provide the required information in the GUI

RIDC Socket Type ==socket
Server Host Name ==Name of your server. In my case it is local host
Content Server Listening POrt ==Port configured in em

There are other parameters also but for making a socket connection we can just use these 3 parameters

Once you have provided the required information. Say test and this should give you a sucess message as shown.



Now check in the resource pallete you will find two new folder structure getting created for you. We will use these later in our further learning exercises.

Understanding the difference between navigation model and the hierarchy model


There is much confusion about the navigation model and hierarchy model in the web center.

There is significant difference between the navigation model and hierarchy model.

Hierarchy model is just used to define you hierarchy for the security.

However navigation model is the one which actually defines how the pages will be navigated this will be clear will a simple example.

I have following entry for my hierarchy



Here as you can see that HelloWorld application also has a security so only after passing the security credentials HelloWorld page will be visible.

What about HelloArpit page? will it be displayed?

No because as we have discussed the hierarchy model defines the security for the pages.

Hence only after passing the security details the HelloWorld and HelloArpit page will be visible but will they appear in the same hierarchy as they appear in the Page hierarchy?

The answer is again no, It depends on the navigation model.


Now lets check out the navigation model. In the navigation model we have not defined any hierarchy and we have simply placed our page in the same level.



Now lets deploy this page and observer the result to understand the difference between hierarchy and navigation model

Before login



AFter login



So it is the navigation model which defines the actual hierarcy of the pages in the portal and the page hierarchy only defines the security prospect of it

Monday, May 26, 2014

oracle.jbo.NoDefException: JBO-29114 ADFContext is not setup to process messages for this exception.

Among the most frustrating errors you will not find any clues
I was working with customization of my portal and i got his particular error



Error 500--Internal Server Error

oracle.jbo.NoDefException: JBO-29114 ADFContext is not setup to process messages for this exception. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-25002. Error message parameters are {0=Form Binding Definition, 1=oracle.webcenter.portalapp.pages.homePageDef}
at oracle.adf.model.binding.DCBindingContainerReference.getDef(DCBindingContainerReference.java:115)
at oracle.adf.model.BindingContext.findBindingContainerDefByPath(BindingContext.java:1750)
at oracle.adf.model.BindingRequestHandler.isPageViewable(BindingRequestHandler.java:374)
at oracle.adf.model.BindingRequestHandler.beginRequest(BindingRequestHandler.java:263)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:203)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:128)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:74)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.webcenter.lifecycle.filter.LifecycleLockFilter.doFilter(LifecycleLockFilter.java:151)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)


The Jdeveloper was showing another list of errors such as

MDS-00013: no metadata found for metadata object "/oracle/webcenter/webcenterapp/bindings/DataBindings.cpx"


Caused by: oracle.mds.exception.ReadOnlyStoreException: MDS-01273: The operation on the resource /oracle/adf/share/prefs/data/preferences.xml failed because source metadata store mapped to the namespace / DEFAULT is read only.
at oracle.mds.core.MDSSession.checkAndSetWriteStoreInUse(MDSSession.java:3019)
at oracle.mds.core.MDSSession.checkAndSetWriteStoreInUse(MDSSession.java:3080)
at oracle.mds.core.BeanMetadataObject.createInstanceInternal(BeanMetadataObject.java:363)
at oracle.mds.core.BeanMetadataObject.access$000(BeanMetadataObject.java:74)
at oracle.mds.core.BeanMetadataObject$1.run(BeanMetadataObject.java:319)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.mds.core.BeanMetadataObject.createInstance(BeanMetadataObject.java:313)
at oracle.adf.share.prefs.resources.PreferenceNodeMO.createInstance(PreferenceNodeMO.java:40)
at oracle.adf.share.prefs.MDSHelper.createBaseDocument(MDSHelper.java:339)
at oracle.adf.share.prefs.MDSHelper.setNode(MDSHelper.java:284)
at oracle.adf.share.prefs.ADFPreferences.(ADFPreferences.java:186)
at oracle.adf.share.prefs.ADFPreferencesManager.getPreference(ADFPreferencesManager.java:195)
... 42 more


Did researched all the blogs and forum links but couldn't get any fix for this issue.

Again i dont have a solution for this and i am waiting for viewers input on this error.

For the time begin i just recreated a new portal application so there must be some mistake in my portal application itself.

Just a word of caution take care while you are deleting files which you are not using after creating it. This creates a lot of problems

Changing the Navigation pattern in web center

The Portal takes a default navigation model to navigate from one page to another , however as a best practice one should never use the default navigation model as it is based on the page hierarchy.



This is because we will not always need the naviagation as per the hierarcy.

Think of a condition where in you will need to load the data from content server.

Even though it will less in hierarcy you will need to be navigated to that page first.

To avoid these kind of situations it is always better to go with the best practices that is to create your own navigation model.

In order to create your navigation model

Go to default-navigation-model.xml and remove the Page Hierarchy.

Now drag and drop the pages that you wanted to navigate in order you want

When you drop select the Page link option and say ok .

So once you complete the dropping the navigation model will look like this.




Go ahead and deploy this page to the integrate weblogic server

You will get a screen like this.

Now you can see that only home is coming in the navigation panel.

This is because we are still using the security model which we have defined in page hierarcy.

So lets login to the page using the default user/pwd of weblogic/welcome1 and see the result




Now after logging in to the page you will find that the two pages have come also but as a separate link , this is not what we have expected so let modify this and try to get the HelloArpit page within HelloWorld






Go back to your navigation model and drag and drop the HelloArpit page to HelloWorld as shown below.





Now validate and redeploy the project and now after logging you should be able to see the correct page details as shown below

Apply security for the page you have developed

In the previous exercise we saw that the page we added was visible to us as soon as we deployed the code to the server but this is not exactly what we wanted, we dont want that any user can access our page , OUr requirement is that only authenticated user should be able to see that page.In order to make the changes we just need to modify the security configuration for the page.

Go to your pages.xml

Select the HelloWorld page where you wanted to apply the security

Select Delegate Security and un select the view as shown below

Save the changes.

Once you will save it you will find a lock icon in the HelloWorld Page



Go ahead and deploy your page to the integrated server.

You will find that the page that you have added is not visible in the portal





The reason is we have changed the security access for the page so only autheticated user can access tha page.

So let login using the default user and password (weblogic/welcome1)

and once logged in you will find your page in the portal


Adding page to your Portal at desing time from JDeveloper in Web Center



In the previous two exercises we saw how we can create a default portal page and add custom pages to it from the run time portal page. In this exercise we will see how we can add pages at design time from jdeveloper and add navigation rule to them.

Go to Jdeveloper project

Go to pages folder and create a new page

Name is as Hello World as shown below



Drag and drop an output text component and write some logical lines to it.



Add one more page to it as shown below and put some output text in here.





Again put and output text and write some comment to it, SAve all the changes.



Now go to the pagehierarcy -->pages and then select the homepages.xml

This is the place where you can defined the hierarchy of your page.

By default it is a root where you have the Home page.

Now drag and drop your HelloWorld page into the Root folder



Then drag and drop the HelloArpit page to the HelloWorld so that your application will appear with the following hierarchy.



Deploy your code to integrated server and observer the page, you will find an entry for the HelloWorld and when you will put your moust over it you will get the other page HelloArpit as a sub page to it.



You can click on the respective page you wanted to navigate to the page



Preserving Customization across multiple application run



In the previous exercise we created a page in our portal.

Lets close the page and then redeploy the page again to the integrated weblogic server.

This time now you will find that the HelloWorld page that you have created is not appearing in the page.

The reason for the same is that we have made the changes at run time and those changes were not preserved in the design time environment of Jdeveloper.

The run time portal by default uses MDS to store the changes and this needs to be made sync with the design time environment so that the changes made in the portal can be preserved.

As a best practice it is always recommended to do the changes in the Design time rather than at run time.

But for this exercise we will see how we can preserve the changes made at run time so that it can persist across multiple application run.

In order to persist the changes.

Go to Application and select Application properties



Expand the run and select MDS in the left hand side.

NOw in the right hand side select the option "Preserver customizations across multiple runs"

YOu can also observer the default location for MDS where all the run time changes are getting stored.




Save all the changes and now all the new application that will be run will have the changes.

However for the development purpose it is always better to do the changes in design time hence from next exercise onwards we will make the changes in Jdeveloper and we will also not use the "Preserver customizations across application runs" for next exercises.

Friday, May 23, 2014

Web Center

I am trying to learn Web center and this exercise will focus on how to create a simple project in web center.

All you need to do is have Jdeveloper and install the Jdeveloper extension for web center frame work.

Open your Jdeveloper and got to Help-->Check for updates









Once the download is complete say complete and finish the wizard, this will ask for a restart of the Jdeveloper. Restart the Jdeveloper and create a new Applicaiton for web center portal application as shown below













Once you will say complete the wizard will automatically create a lot of artifacts for you



The portal application by default creates pages for you which can be changed accordingly to our requirement.Go ahead and deploy the home.jspx page.



The default user id and password to login to the portal is weblogic/welcome1

Login to the portal and go to the administration tab.

In the administration page go to Pages in the left hand side and click on create page in the right hand side as shown below.



By default a Home page is there we will add another page to it called Hello World



Selec the showpage option and then click on back to Portal



Now in the Portal page you can see a link for your HelloWorld page.

Click on the link and you will be navigated to your page that you have just build as shown below



Go back to the same page where you have added the HelloWorld page , got to action and and edit the page.




customize the page with some default cotent. As we have specified a text comment and a image. Just save all these changes and go back to you portal and select the HelloWorld process




You just have create a web page

Thursday, May 22, 2014

Not able to see record in AQ$_WF_BPEL_QTAB_S

you have create a event in Oracle EBS and a soa is subscribing to that event using Oracle apps adpater.

Everything was going fine but all of a sudden after migrating your code to next environment the code is not working.

There are few important steps that one take care of while migrating the code for apps adapter.

The first thing is when you create an apps adapter two sql files are created for you.

XX_BPEL_WFEVENT_.sql
and
XX_BPEL_WFEVENT__drop.sql

BEfore migrating the soa code to the higher environment you must first execute the XX_BPEL_WFEVENT_.sql in the target environment

then only the soa code should be deployed to the higher envrionment.

Now after executing the sql and deploying the sql still your process is not wokring.

The reason is that the subscription is not created for the advanced queue.

You need to validate few things

select * from wf_bpel_qtab

This will contain the event data which was raised by ORacle EBS which further gets inserted in to the wf_bpel_q which is an advanced queue.

Now once you validated that the data is present in the wf_bpel_qtab you need to validate if the subscription is present or not.

for that you can execute the following query

select * From AQ$_WF_BPEL_QTAB_S

there you should be able to see an entry



the name in the table should match with the consumer name in your jca file



property name="Consumer" value="ORA_asdasdmalsjdiklajsd"

If you are not able to see it in the table then this is an issue with your datasource.

Make sure your datasource is up and running and redeploy your process again to the server.

weblogic.common.ResourceException: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

You are trying to restart your soa server and you are getting below error in the soa error logs

Failed to initialize the application 'SOADataSource' due to error weblogic.application.ModuleException: .
weblogic.application.ModuleException:
at weblogic.jdbc.module.JDBCModule.prepare(JDBCModule.java:327)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:517)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:159)
Truncated. see log file for complete stacktrace
Caused By: weblogic.common.ResourceException: weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor


This is not allowing you to start your soa server.

As you can notice that it is failing while connecting to your data source.

The reason is that the database to which the data source was connecting is down.

Ideally we expect that even if the custom data source is not able to connect to the backend data base it should not restrict the soa to get started.

Normally when a soa server starts up or shrink the initial capacity is used.
By default when a data source is configured the initial capacity is set to 1.

This creates the issue, when server is started if finds the initial capacity is set to 1 hence it will keep on trying to connect to the backend database , but since the backend database is down it will not complete this and will cause issue in soa server start.

Hence in order to resolve this issue one can set the initial capacity to zero.
This will allow soa not try to connect to the database using the datasource.

One can go to the soa admin console.

Go to Services--->Data sources

Select your data source and go to connection pool tab

and update the Initial capacity to 0


Tuesday, May 20, 2014

Animation using ADF

ADF can be used to create animation though not that much but we can see a small example and then one can explore the possibilities in this area.

The secret of animation in ADF lies in the fact of using images which are similar to each other and then refreshing images so that different images ap
pear one after another within a fraction of second and viewer observe it as a moving. We will use af:switcher fucntionality to achieve the same in our ADF page.


The switcher component dynamicallyu decides which facet components should be rendered. The switch will render the facet matching the facetName, in case no facetName exists defaultFacet is rendered. The diagram below shows the same.


Now we will use the concept of af:switcher in our code to create an animation. Though this is not the best way but i just wanted to do some R&D on this and may be ADF guru's can put more light on the same.

The idea behind this exercise is the oracle post

http://www.oracle.com/technetwork/developer-tools/adf/learnmore/60-table-drag-n-drop-sample-176981.pdf

We will be using the functionality provided for af:switcher to achieve a small animation.

The animation will start on click of a button

Firstly we will create take two images so that we can flip between them to create an animation.

We will create two facet and will embed two image in them

We will create an AF:switcher which will default to an image1.

We will have a poll on second facet which will display the second image2.

Now the flow will be like this

Image1 will be display--->On click of button image2 will be displayed--->Poller will work and will again set the image to image1

This we are doing for two images and the time interval will be 100ms so that it all appears in a fraction of second.

As you can see in the structure

We have two facet having two different images. The facet2 has a polling mechanism which polls after a certain interval of time and set the image.

Facet1 has following image



And facet2 has following image



the command button has an action defined in the managed bean



Similarly the poller is also associated with a method in the same managed bean



The AF:switcher is pointed to FacetName and a deafult facet. In case the FacetName is not coming it will display the default facet otherwise it will pick the FacetName from the view scope



Rest is setting the view scope from the back end,

Following java code can be used


import java.util.Map;
import javax.faces.component.ContextCallback;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import oracle.adf.view.rich.context.AdfFacesContext;
import org.apache.myfaces.trinidad.event.PollEvent;
public class AnimationBean {
private void refreshPage(String componentId) {
String comp = componentId;
FacesContext fctx = FacesContext.getCurrentInstance();
UIViewRoot root = fctx.getViewRoot();
root.invokeOnComponent(fctx, comp, new ContextCallback() {
public void invokeContextCallback(FacesContext facesContext,
UIComponent uiComponent) {
AdfFacesContext.getCurrentInstance().addPartialTarget(uiComponent);
}
});
}

public void onPoll(PollEvent pollEvent) {
Map viewScope = AdfFacesContext.getCurrentInstance().getViewScope();
viewScope.put("binState", "Animation1");
refreshPage("db1");

}

public String Animate() {

Map viewScope = AdfFacesContext.getCurrentInstance().getViewScope();
viewScope.put("binState", "FinalPicture");
refreshPage("db1");
return null;
}
}


Here db1 is Id for the top level page which in our case is a decorative box




Go Ahead and deploy the process to integrate weblogic server.

Once you get the page click on the RunAnimation button and you will get following screen in succession