Wednesday, July 24, 2013

UCM Error when searching repository with GET_SEARCH_RESULTS and folderChildren parameter

In my last UCM application I provided custom search module based on service GET_SEARCH_RESULTS:

  public static List<UcmDocument> getAllSearchResults(String query, int startRow, int count, long dFromPath, IdcClient idcClient, IdcContext userContext) throws Exception
  {
    List<UcmDocument> list = new ArrayList<UcmDocument>();
    DataBinder binder = idcClient.createBinder();
    binder.putLocal("IdcService", "GET_SEARCH_RESULTS");
    binder.putLocal("QueryText", query);
    binder.putLocal("SortSpec", "dInDate DESC");
    binder.putLocal("folderChildren",Long.toString(dFromPath));
    binder.putLocal("StartRow", String.valueOf(startRow));
    binder.putLocal("ResultCount", String.valueOf(count));
    ServiceResponse response = idcClient.sendRequest(userContext, binder);
    DataBinder serverBinder = response.getResponseAsBinder();
    DataResultSet resultSet = serverBinder.getResultSet("SearchResults");
    int resultCount = resultSet.getRows().size();

    /* and so on */ 

When everything was working properly in my machine with test instance of WebCenter Content, on production server I got exception:

!csUserEventMessage,weblogic,192.168.1.200:16200!$!csSearchUnableToReturnResults
intradoc.common.ServiceException: !csSearchUnableToReturnResults
*ScriptStack GET_SEARCH_RESULTS
3:getSearchResults,**no captured values**
        at intradoc.server.SearchManager.retrieveSearchInfoAsBinder(SearchManager.java:295)
        at intradoc.server.SearchService.retrieveSearchInfo(SearchService.java:1848)
        at intradoc.server.SearchService.doLocalSearch(SearchService.java:1377)
        at intradoc.server.SearchService.getSearchResults(SearchService.java:670)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at intradoc.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:86)
        at intradoc.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:310)
        at intradoc.common.ClassHelperUtils.executeMethod(ClassHelperUtils.java:295)
        at intradoc.server.Service.doCodeEx(Service.java:620)
        at intradoc.server.Service.doCode(Service.java:575)
        at intradoc.server.ServiceRequestImplementor.doAction(ServiceRequestImplementor.java:1643)
        at intradoc.server.Service.doAction(Service.java:547)
        at intradoc.server.ServiceRequestImplementor.doActions(ServiceRequestImplementor.java:1458)
        at intradoc.server.Service.doActions(Service.java:542)
        at intradoc.server.ServiceRequestImplementor.executeActions(ServiceRequestImplementor.java:1391)
        at intradoc.server.Service.executeActions(Service.java:528)
        at intradoc.server.ServiceRequestImplementor.doRequest(ServiceRequestImplementor.java:737)
        at intradoc.server.Service.doRequest(Service.java:1956)
        at intradoc.server.ServiceManager.processCommand(ServiceManager.java:437)
        at intradoc.server.IdcServerThread.processRequest(IdcServerThread.java:265)
        at intradoc.idcwls.IdcServletRequestUtils.doRequest(IdcServletRequestUtils.java:1354)
        at intradoc.idcwls.IdcServletRequestUtils.processFilterEvent(IdcServletRequestUtils.java:1731)
        at intradoc.idcwls.IdcIntegrateWrapper.processFilterEvent(IdcIntegrateWrapper.java:222)
        at sun.reflect.GeneratedMethodAccessor253.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at idcservlet.common.IdcMethodHolder.invokeMethod(IdcMethodHolder.java:87)
        at idcservlet.common.ClassHelperUtils.executeMethodEx(ClassHelperUtils.java:305)
        at idcservlet.common.ClassHelperUtils.executeMethodWithArgs(ClassHelperUtils.java:278)
        at idcservlet.ServletUtils.executeContentServerIntegrateMethodOnConfig(ServletUtils.java:1704)
        at idcservlet.IdcFilter.doFilter(IdcFilter.java:457)
        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:315)
        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
        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:139)
        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:315)
        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
        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 weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3730)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3696)
        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:2273)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2179)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1490)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Information provided by stack trace was worthless for me, so I decided to tune System Audit Information level of "problematic" UCM instance as shown below:

In tuned audit log I found following rows:

ORA-20000: Oracle Text error:
 search/6 07.24 13:03:01.602 IdcServer-509 DRG-10856: SDATA section xCollectionID does not exist
 search/6 07.24 13:03:01.602 IdcServer-509 
 search/6 07.24 13:03:01.602 IdcServer-509 ORA-06512: przy "CTXSYS.DRUE"\, linia 160
 search/6 07.24 13:03:01.602 IdcServer-509 ORA-06512: przy "CTXSYS.CTX_QUERY"\, linia 791
 search/6 07.24 13:03:01.602 IdcServer-509 ORA-06512: przy "MY_OCS.CONTENT_SEARCH"\, linia 125
 search/6 07.24 13:03:01.602 IdcServer-509 ORA-06512: przy "MY_OCS.CONTENT_SEARCH"\, linia 320
 search/6 07.24 13:03:01.602 IdcServer-509 ORA-06512: przy linia 1

Of course field xCollectionID exists in DOC_META table, so I started to analyze CONTENT_SEARCH package. My attention drew the fact that the search engine bases on indexed fields, so I should check if xCollectionID is marked as indexed.

To my surprise xCollectionID isn't indexed, so I marked is as indexed, next rebuilded a collection and an index, and tried to run my search procedure once again.

Now, as you can suppose, all works perfect.

Glassfish problem: There is a process already using the admin port 4848

Today one of our Glassfish servers refused to cooperate. On start of glassfish service an exception was thrown :

There is a process already using the admin port 4848. Command start-domain failed.

Of course at start I checked if the port isn't used by any other process ( netstat -ap --numeric-ports | grep 4848 in our Debian), but, to my surprise, port 4848 was free.

WTF?

Google search suggested very simple solution.In accordance with this solution I went to /etc/hosts file and checked if host name was used in domain configuration (in our case it isn't localhost) points to valid IP.

And voila, it isn't !!!

After fixing it all works well.

Tuesday, July 23, 2013

Error make_sock: could not bind to address 0.0.0.0:80 when starting Apache 2 on Windows 7

As you can guess the error make_sock: could not bind to address 0.0.0.0:80 can mean that TCP socket 80 is used by another process.

To check this in Windows you can simply run netstat - ano. In my case netstat returns:

 TCP       0.0.0.0:80             0.0.0.0:0              NASŁUCHIWANIE    4
 TCP       0.0.0.0:135            0.0.0.0:0              NASŁUCHIWANIE    888
 TCP       0.0.0.0:445            0.0.0.0:0              NASŁUCHIWANIE    4
 TCP       0.0.0.0:554            0.0.0.0:0              NASŁUCHIWANIE    2620
 TCP       0.0.0.0:623            0.0.0.0:0              NASŁUCHIWANIE    176
 TCP       0.0.0.0:2869           0.0.0.0:0              NASŁUCHIWANIE    4
 TCP       0.0.0.0:7112           0.0.0.0:0              NASŁUCHIWANIE    1136
 TCP       0.0.0.0:10243          0.0.0.0:0              NASŁUCHIWANIE    4
 TCP       0.0.0.0:16992          0.0.0.0:0              NASŁUCHIWANIE    176
 TCP       0.0.0.0:49152          0.0.0.0:0              NASŁUCHIWANIE    548

As you can see port 80 is already used by process with id 4.
Ok. Ok. Let's check the process with PID 4?



Hmm. Surprise. What the hell it can be. Maybe IIS - I haven't installed this but I have Visual Studio and maybe IIS I have "out of the box"? How to check this?

In my case was enough to use the command:

net stop http

to stop all "http related" services. After system restart Apache started successfully.

Monday, July 15, 2013

Error in GET_DYNAMIC_CONVERSION service

If you are familiar with UCM (Webcenter Content) document services and RIDC, I suppose you know that the service can return the Binder or the input stream. Today I encountered the case where service returns the Binder when one might expect a stream.
As described in documentation the GET_DYNAMIC_CONVERSION service "returns a content item as an HTML or XML file converted by Dynamic Converter", and next "Given a dID or a dDocName and a RevisionSelectionMethod parameter, the service determines the filename of a particular rendition of the revision and returns that file to the client. The most likely errors are mismatched parameters or a request for a content item that does not exist."
There isn't any reason to assume that the service returns anything else than the stream. But, if you run in RIDC code visible bellow
  

public static renderDynamicConversion(String id, IdcClient idcClient,
                                               IdcContext userContext) throws Exception{
          DataBinder binder1 = idcClient.createBinder();
          binder1.putLocal("IdcService", "GET_DYNAMIC_CONVERSION");
          binder1.putLocal("DCViewFormat", "WebViewable"); 
          binder1.putLocal("ConversionTemplate", "SLIDE-PREVIEW");
          binder1.putLocal("dDocName", id);
          binder1.putLocal("RevisionSelectionMethod","LatestReleased");

          ServiceResponse responseS =
              idcClient.sendRequest(userContext, binder1); 
and next you call
  
          inputStream = responseS.getResponseStream();
the Exception will be thrown, because the service returns a Binder no t a stream. You can simply check this calling
  
          responseS.getResponseType();

After some googling I haven't any sure clue, is it a bug or maybe documentation is as usual incomplete. Next I went to Oracle support, and voila, there is a bug: " When using the HTTP web connection method, RIDC always appends IsJava=1 to the request. This cannot be changed to IsJava=0 or unset, which results in all GET_DYNAMIC_CONVERSION calls to Content Server returning the data binder rather than the converted HTML. " Only valid workaround is using socket connection to content server and setting IsJava to 0 as shown below:
  

public static renderDynamicConversion(String id, IdcClient idcClient,
                                               IdcContext userContext) throws Exception{
          DataBinder binder1 = idcClient.createBinder();
          binder1.putLocal("IdcService", "GET_DYNAMIC_CONVERSION");
          binder1.putLocal("DCViewFormat", "WebViewable"); 
          binder1.putLocal("ConversionTemplate", "SLIDE-PREVIEW");
          binder1.putLocal("IsJava", "0");
          binder1.putLocal("dDocName", id);
          binder1.putLocal("RevisionSelectionMethod","LatestReleased");

          ServiceResponse responseS =
              idcClient.sendRequest(userContext, binder1); 

Friday, July 5, 2013

How to get folder metadata in oracle UCM

This article is an answer to the following question: http://stackoverflow.com/questions/16414428/how-to-get-folder-metadata-in-oracle-ucm

To get Webcenter Content folder meta data information you can use COLLECTION_INFO or COLLECTION_GET_INFO services, as shown below:

  public static MyUcmFolder getFolderInfoByPath(String path, IdcClient idcClient,
                                               IdcContext userContext) throws Exception{
      DataBinder request = idcClient.createBinder();
      request.putLocal("IdcService", "COLLECTION_GET_INFO");
      request.putLocal("hasCollectionPath", "true");    
      request.putLocal("dCollectionPath", path);
      ServiceResponse response = idcClient.sendRequest(userContext, request);
      DataBinder binder = response.getResponseAsBinder();
      DataObject da = binder.getLocalData();

      ...
      // Here you can get Local Data of UCM Folder, by example:
      String dCollectionPath = da.get("dCollectionPath").toString();


}

As a LocalData you can get by example following folder metadata:
  • dCollectionType 
  • dCollectionOwner 
  • dCollectionName 
  • dCollectionEnabled 
  • dCollectionMark 
  • dCollectionGUID 
  • dCollectionInherit 
  • dCollectionQueries 
  • dParentCollectionID 
  • and so on :)