Sunday, September 18, 2011

Exceptions While Using Tagging Service @Webcenter

1) Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "T1"."ENTERPRISE_ID": invalid identifier
The reason is clear. The webcenter schema don't have Enterprise_Id column in WC_TAGGING_BOOKMARK table.

Solution: Searched over net but did not find any result. Finally added this column in the tables and the problem resolved.  Not sure whats the role of this column and why its was not present by default.

Tuesday, September 13, 2011

Exceptions While Using RIDC API @ Webcenter


1) Unable to locate authentication handler for Content Server response: HTTP/1.1 502 Bad Gateway
Source breakpoint occurred at line 54 of MyManagedBean.java.
oracle.stellent.ridc.protocol.ProtocolException: java.io.IOException: Input terminated before being able to read line.
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:142)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:107)
at MyManagedBean.RIDC_CreateFolder(MyManagedBean.java:54)

The code i was using to initialize the connection was:

IdcClientManager manager = new IdcClientManager();
IdcClient idcClient = manager.createClient("http://localhost:4444/idc/idcplg");

The problem resolved by changing the code to:


IdcClientManager manager = new IdcClientManager();
IdcClient idcClient = manager.createClient("idc://localhost:4444");

2) oracle.stellent.ridc.protocol.ServiceException: No service defined for null.
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:135)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:107)
at MyManagedBean.RIDC_CreateFolder(MyManagedBean.java:54)

Reason: Ohhh....Very silly mistake. Following is the code with error:

dataBinder.putLocal("idcService", "COLLECTION_ADD");

Correct Code:

dataBinder.putLocal("IdcService", "COLLECTION_ADD");


3) oracle.stellent.ridc.protocol.ServiceException: Unable to display virtual folder information. Unable to open folder.
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:135)
at oracle.stellent.ridc.protocol.ServiceResponse.getResponseAsBinder(ServiceResponse.java:107)
at MyManagedBean.getFolderIDFromPath(MyManagedBean.java:165)

Reason: I was specifying only the folder name instead of complete path :)... Ex: RIDCFolder instead of /Contribution Folder/RIDCFolder.... in binder.putLocal ("dCollectionPath", path);


4) This time i was not getting any exception. But there was something wrong. I was trying to upload document, the code was working fine but the document was not uploading. The point to be noted is that there was error in code but i was not getting any exception. Actually, i was not using following code to get the document id of the document i was uploading:

DataBinder serverBinder = res.getResposeAsBinder();
S.O.P(serverBinder.getLocal("dDID"));

I re ran my code with above lines and i got my exception at res.getResposeAsBinder(); So it is important to use above line to ensure that the operation was successful and to save some time.

5) java.lang.RuntimeException: oracle.security.jps.service.idstore.IdentityStoreException: JPS-01520: Cannot initialize identity store.
This exception is is not related to RIDC but i got it suddenly while working. This cause my navigation model to stop working properly. In the logs of UCM managed server i found below exception:


javax.naming.CommunicationException [Root exception is java.net.ConnectException: t3://[2001:0:4137:9e76:2c71:1810:854e:e6a5]:9001: Destination unreachable; nested exception is: 
java.net.ConnectException: Connection refused: connect; No available router to destination]


Not sure, resolved it self in next run.

6) File size is to large and can't be uploaded: When using RIDC the default size of document that can be uploaded is 2 MB. In order to increase this limit, we need to make an entry in web.xml file. Under the Application option in Overview tab, expand Context Initialization Parameter and add following parameter:

Name : org.apache.myfaces.trinidad.UPLOAD_MAX_DISK_SPACE
Value: The maximum file size in bytes

7) Invalid JCR Name or Path: I am still working on this exception.

Saturday, September 10, 2011

Cannot find FacesContext @ Webcenter

I received java.lang.RuntimeException: Cannot find FacesContext exception when i ran my own login page in webcenter portal application. For configuring refer  Practical Guide for Oracle WebCenter PS3 Security Implementation

The error was because of wrong URL of my login page inside web.xml file. The application is configured with 
form authentication by default. I selected my login page using browse option. The entry in web.xml was 

<form-login-page>/oracle/webcenter/portalapp/pages/MyLoginPage.jspx</form-login-page>

but it worked after changing the URL to 

<form-login-page>/faces/oracle/webcenter/portalapp/pages/MyLoginPage.jspx</form-login-page>

Monday, September 5, 2011

Implementing Login form in ADF

If we need to provide our own JSF login page then we can use following JSF code and corresponding managed bean code :

JSF Code:


<af:panelFormLayout id="pfl1">
                    <af:message for="loginname" partialTriggers="cb1" />
                    <af:inputText label="Login Name" id="loginname" />
                    <af:inputText label="Password" id="password" />
</af:panelFormLayout>

<af:panelGroupLayout id="pgl2">
                    <af:commandButton text="Submit" id="cb1" actionListener="#{MyApp_ManagedBean.Login}"/>
                    <af:commandImageLink text="SignUp" id="cil1"/>
</af:panelGroupLayout>



Managed Bean Code:


  public void Login(ActionEvent actionEvent) {
    FacesContext fctx=FacesContext.getCurrentInstance();
    HttpServletRequest request = (HttpServletRequest)fctx.getExternalContext().getRequest();
    HttpServletResponse response = (HttpServletResponse)fctx.getExternalContext().getResponse();
    UIViewRoot viewRoot=fctx.getViewRoot();
    RichInputText userName = (RichInputText)viewRoot.findComponent("pt1:loginname"); 
    //pt1 indicated the page template naming container.
    String userNameStr = (String)userName.getValue();
    RichInputText password = (RichInputText)viewRoot.findComponent("pt1:password");
    String passwordStr = (String)password.getValue();
    try
    {
      int authSuccess=ServletAuthentication.login(userNameStr,passwordStr,request,response);  
      if(authSuccess==ServletAuthentication.AUTHENTICATED)
      {
        try{
          ExternalContext ectx=fctx.getExternalContext();
         //Using Controller Context  is recommended to implement redirect logic instead of directly calling  //External Context redirect method and passingredirect URL in it "faces/RedirectPage".
          ControllerContext controllerCtx = null;
          controllerCtx = ControllerContext.getInstance();
          String activityURL = controllerCtx.getGlobalViewActivityURL("WelcomePage");
          ectx.redirect(activityURL);


        }catch(IOException ioex){ioex.printStackTrace();}
      }
    }
    catch(LoginException loginex)
    {
      String message="Authentication Failed. Please try again";
      fctx.addMessage("pt1:loginname", new FacesMessage(FacesMessage.SEVERITY_ERROR,message,null));
    }
  }
}


Recommended Reading: Oracle Fusion Developer Guide Building Rich Internet Applications with Oracle ADF Business Components and Oracle ADF Faces

Tuesday, August 23, 2011

Display SWF file in Webcenter Space

There may be a requirement to display SWF inside Oracle Webcenter Space. The SWF file can be added to space as content presenter in following way.

All we need to do is to embed our SWF file inside HTML file. Following is the code that can be used:

<html>
<body>
<object width="500" height="500">
    <param name="movie" value="http://localhost:16200/cs/groups/public/documents/document/newswf.swf">
    <embed src="http://localhost:16200/cs/groups/public/documents/document/newswf.swf" width="400" height="400">
    </embed>
</object>
</body>
</html>

The SWF file in above code is coming from UCM. Once done, the HTML file can be easily added to Webcenter Space as content presenter. The same concept can also be used for some video files.

Sunday, August 21, 2011

Store TaskFlow Input Param in Memory Scope or Managed Bean?

If we need to specify some input parameters for our Bounded task flow then, we can specify value (Note: the value field in Input parameter definition indicates the location where the input parameter will be stored. It does not indicate the value of  the parameter we are defining.) either using managed bean or in memory scope. The recommended way is to use managed bean or a simple pojo class configured as manged bean in a memory scope. The reason of using managed bean is that we can use comments in our class file to indicate the purpose for other developers and also make it clear what exactly the input parameters are and where they are stored as they can now be access using managed bean.

Disable text filed in InputDate Component @ADF

If you need to disable the input text filed for adf:inputDate component then we can do that using any of the java scripts below.

1) This script will disable the key events on the text filed. Thus the user will not be able to edit the selected date using Keyboard.

<af:resource>
function disableEntry(evt){
evt.cancel();
}
</af:resource>

<af:inputDate label="Label 1" id="id1" readOnly="false"
contentStyle="background-color:lightgray;">
<af:clientListener method="disableEntry" type="keyDown"/>
</af:inputDate>


2) This script will completely disable the text filed. The only problem with this script is that, if we have many input date components on a page, then we will need to apply this for all component by their IDs.

<af:document id="d1">
<f:facet name="metaContainer">
<f:verbatim>
<script type="text/javascript">
function disable(evt) {
document.getElementById('id1::content').disabled=true;
}

</script>
</f:verbatim>
</f:facet>
<af:clientListener method="disable()" type="load"/>
.....
<af:inputDate label="Date Picker" value="#{pageFlowScope.genPDF.dateEcheance}" binding="#{pageFlowScope.genPDF.id1}" id="id1"/>