0

I am trying to access a WCM(Web Content Management) library, which is already working fine for a portal application. My requirement is to access the same library from an enterprise application deployed on WAS(Webspher Application Server). It is works fine on my localhost, but when deployed on development server it is giving me below error-

Stack Trace com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.IllegalStateException: A WCM Repository is not registered with WCM_API at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:152) at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:77) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:908) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:934) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502) at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:121) at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:259) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:686) at com.bowstreet.webapp.engine.pageprocessor.JSPPageProcessor.requestJSPPage(JSPPageProcessor.java:321) at com.bowstreet.webapp.engine.pageprocessor.JSPPageProcessor.processPage(JSPPageProcessor.java:207) at com.bowstreet.webapp.engine.actions.PageAction.callAction(PageAction.java:101) at com.bowstreet.webapp.engine.WebAppAccessImpl.processPage(WebAppAccessImpl.java:228)

I am using IBM Websphere Application and Portal Server 6.1. Below is the code snippet-

// retrieve repository
   Repository repository = WCM_API.getRepository();  
   try{      
    // get the workspace for current user
    Workspace workspace = repository.getSystemWorkspace();
    workspace.login();
    // set the library
    workspace.setCurrentDocumentLibrary(workspace.getDocumentLibrary("MyLibrary"));
    // find content by name
     DocumentIdIterator contentIterator = workspace.findByName(DocumentTypes.Content,"MyKey");
      System.out.println("key:: contentIterator="+contentIterator);
     //find all contents
     if (contentIterator.hasNext()){ 
       System.out.println("key:: inside if =");
       Content content=(Content)workspace.getById(contentIterator.nextId(),true);
       System.out.println("getWCMURL:: Content="+content.getName());
       RichTextComponent txtComp= (RichTextComponent)content.getComponentByReference("Text");
       if(txtComp.getRichText()!=null){
        cntmsg = txtComp.getRichText();
       }       
   }   
  }  
  catch(Exception e){
   System.out.println("getWCMURL:: Error:"+e.getMessage());
  }

Please help...

Jane
  • 1
  • 2

2 Answers2

0

At the time of writing this, IBM Web Content Management v6.1 is no longer supported (End of life was Sept 2014), so you should have already upgraded. IBM only keeps 3 versions (Current + 2 previous) supported at a time.

With that said, this error can sometimes occur, if your application starts prior to the Web Content Management servlet starting. You need to set the startup weighting higher than 30. http://www-01.ibm.com/support/docview.wss?uid=swg21656128

Without access to the whole source code and full stack trace it's a little difficult to see when this code is being triggered. Another source of error, could be the server on which the code has been deployed on. It must be deployed to the Portal Server and not the Application Server.

0

Do you have virtual portals on your development server?

If you do have virtual portal in your development server, you'll have to get the virtual portal context and run it in a way as described here -

https://gist.github.com/roanbester/0c1dafece0d0fac699e4

I'll highlight the primary difference:

Repository repository = WCM_API.getRepository();
// **get the virtual portal context**
VirtualPortalContext vpContext = repository.generateVPContextFromContextPath("virtualPortalName");

// Custom class, implements IBM interface, our executable code has to go here
FindCategoriesAction findCategoriesAction = new FindCategoriesAction();

// Now, WCM will execute our code kept in 'findCategoriesAction' 
   by calling the run method
repository.executeInVP(vpContext, findCategoriesAction);

I am not the author of this code. It gets difficult if you want to return the output of the code kept in 'findCategoriesAction'.

The example code here doesn't exhibit or implement thread synchronization.

I personally am not a big fan of the entire IBM WCM and IBM Webpshere Portal suite.

This is an old architecture.

Also, from 8.0 onwards, there is a REST API from WCM, using which you can access content or any element, but again, it is not as neat as it sounds.

Arka
  • 9
  • 3