Wednesday, November 3, 2010

Quick Update

I apologize the blog has no new updates for a while, and that's because I'm now working on the new release of Oracle WebCenter Spaces 11g iPhone Application.
The blog will remain open and will be answering any questions you might have regarding E20 & WebCenter installs.
Thanks

Monday, August 9, 2010

WebCenter REST + Ruby = Awesome!

These days, I've been studying the WebCenter REST APIs and was happy to see the power of these APIs. The team invested a lot of time building these APIs, specially the Link model (HATEOAS) which is the heart of it.

HATEOAS is a heavy concept that needs to be understood, so you can fully take advantage of REST APIs. It is out of scope of this article, but I found a good reference from Ryan Kinderman with lots of links to other resources. BTW, I thought I knew REST until I read Ryan's post :)

Another cool thing I've been reading/studying these days is Ruby! I have to say it is awesome! The amount of things you can do with such little coding is impressive. Coming from Java & Objective C, the first time you look at Ruby code you don't quite get the syntax. But, after reading just a little about it, you see how you can do things pretty easy and with less coding than other languages.

Ok - time to mix things together now :)

So, WebCenter REST API is great! And, Ruby is perfect for running quick tests and get the ball rolling. Assuming you're a bit familiar with REST and Ruby, let's write a simple client to get the Person's activity stream from WebCenter Server. I also assume you have access to a WebCenter instance -- don't have one??? It is really easy to install :-)

On this sample, I'm using the following:
  • Ruby 1.9.2 -- actually used RVM to setup my Ubuntu machine
  • Mechanize 1.0.0 -- install with gem install mechanize - this helps with the HTTP requests, maintain session, cookies, etc.
  • JSON 1.4.6 -- install with gem install json

Connection

The first thing is to setup a wrapper for the connection. This class will handle the communication with the WebCenter REST server, perform authentication, and send the GET requests. In future, it should also wrap the other types of requests - POST, PUT and DELETE.
require 'rubygems'
require 'pp'
require 'mechanize'

USER_AGENT_ALIAS = 'Linux Mozilla' #provided by mechanize

class WcConn
  attr_accessor :wc_user, :wc_pass

  # Create the object
  def initialize(wc_user, wc_pass)
    @wc_user = wc_user
    @wc_pass = wc_pass

    #init mechanize fmk
    @mechanize_agent = Mechanize.new do |agent|
      agent.user_agent_alias = USER_AGENT_ALIAS
      agent.request_headers = {'accept' => 'application/json'}
    end
  end

  ##Login -- and retrieve resourceIndex
  def wc_login(uri)
    t1 = Time.now
    puts "--wc_login [#{uri}]"

    @mechanize_agent.auth(@wc_user,@wc_pass)
    logged_in_page = @mechanize_agent.get(uri)

    puts "--wc_login took [#{Time.now-t1}]s"
    #return the page, so processing can continue
    logged_in_page
  end

  ## access a page
  def goto_page(uri)
    t1 = Time.now
    puts "--goto_page [#{uri}]"
  
    page = @mechanize_agent.get(uri)

    puts "--goto_page took [#{Time.now-t1}]s"
    #return the page
    page
  end #goto_page

end #class

Wrappers for Objects

I also created wrappers for Link, ResourceIndex, Person, and Activities. These will read the JSON object to retrieve the value of few attributes. These objects are far from being complete, but they work fine for this simple example.
=begin
  object representation for Link & ResourceIndex
=end
  
#resource types -- not complete list 
RT_MSG_BOARD = 'urn:oracle:webcenter:messageBoard'.to_sym
RT_CMIS = 'urn:oracle:webcenter:cmis'.to_sym
RT_FORUMS = 'urn:oracle:webcenter:discussions:forums'.to_sym
RT_RC_IDX = 'urn:oracle:webcenter:resourceindex'.to_sym
RT_ACTIVITIES = 'urn:oracle:webcenter:activities:stream'.to_sym
RT_PERSON_ACTIVITIES =  'urn:oracle:webcenter:activities:stream:person'.to_sym
RT_FEEDBACK = 'urn:oracle:webcenter:feedback'.to_sym
RT_SPACES = 'urn:oracle:webcenter:spaces'.to_sym
RT_PEOPLE = 'urn:oracle:webcenter:people'.to_sym


class Link
  attr_accessor :resourceType, :href, :template, :capabilities, :rel, :type
  
  def initialize(options)
    @resourceType = options['resourceType'] ? options['resourceType'].to_sym : :EMPTY
    @href = options['href']
    @template = options['template']
    @capabilities = options['capabilities'] ? options['capabilities'].to_sym : :EMPTY
    @rel = options['rel'] ? options['rel'].to_sym : :EMPTY
    @type = options['type'] ? options['type'].to_sym : :EMPTY
  end
  
  # to String ---
  def inspect
    "LINK rt[#{@resourceType}] hr[#{@href}] tm[#{@template}] cp[#{@capabilities}] rel[#{@rel}] tp[#{@type}]"
  end
  
  def to_s
    inspect
  end
end #class_Link


class ResourceIndex
  #construct
  def initialize
    @links = []
  end
  
  def add_link(options)
    @links << Link.new(options)
  end
  
  def get_link_by_rel(rel)
    @links.find { |l| l.rel == rel }
  end

  def get_link_by_resource_type(resource_type)
    @links.find { |l| l.resourceType == resource_type }
  end

  # to String ---
  def inspect
    "RESOURCE_INDEX #{@links}"
  end
  
  def to_s
    inspect
  end
end #class_resourceIndex
=begin
  object representation for Person
=end

class Person
  attr_accessor :guid, :id, :display_name, :links   
  
  def initialize(options)
    @guid = options['guid']
    @id = options['id']
    @display_name = options['displayName']
    @links = []
    options["links"].each { |l| @links << Link.new(l) }
  end

  # to String ---
  def inspect
    "PERSON guid[#{@guid}] id[#{@id}] name[#{@display_name}]" # links[#{@links}]"
  end
  
  def to_s
    inspect
  end
end
=begin
  object representation for Activities 
=end

class Activities
  attr_accessor :messages   
  
  def initialize(array_items)
    @messages = []
    array_items.each do |i|
      msg_template = i['message']

      tp_items = i['templateParams']['items'] #arrays of items

      msg_items = {}
      tp_items.each do |tpi|
        tp_item_k = tpi['key']
        tp_item_v = tpi['displayName']
        msg_items[tp_item_k] = tp_item_v
      end
      d = DateTime.parse(i['createdDate'])
      #run the substitutions
      msg_items.each { |k,v| msg_template.sub!(/#{Regexp.escape(k)}/,"'#{v}'") }
      m = "#{d}, #{msg_template}"
      #puts m
      @messages << m
    end
  end
  
  # to String ---
  def inspect
    "Activities messages[#{@messages}]"
  end
  
  def to_s
    inspect
  end
end

Main class

The main class -- WcRest -- is responsible for the actual retrieval of the activities. It will login to WebCenter REST server using Basic authentication, retrieve the Resource Index. After parsing it, it will retrieve the Person object, and we need the guid. It will then follow the template for urn:oracle:webcenter:activities:stream to retrieve the 10 latest activities for that user, and display it as output.

Notes:
  • as this is main file, you should make sure if can be executed, or run it as ruby wc_rest.rb
  • the response from WcConn#wc_login and WcConn#goto_page is the Mechanize#Page, and thus we need to JSON parse the body of the page
  • #follow_template method will first substitute variables on the link using the options Map
  • #run method actually contains the sequence of the REST commands
#!/usr/bin/env ruby

require 'rubygems'
require 'json/ext'
load 'conn.rb'
load 'resource_index.rb'
load 'person.rb'
load 'activities.rb'

class WcRest
  # Create the object
  def initialize(wc_user, wc_pass, wc_uri)
    @resIdx = ResourceIndex.new 
    #initialize connection
    @wc_conn = WcConn.new(wc_user, wc_pass)
    @wc_uri = wc_uri
  end #initialize 
  
  ## gets /rest/api/resourceIndex
  def get_resourceIndex
    wc_resourceIdx =  @wc_conn.wc_login @wc_uri
    doc = JSON.parse(wc_resourceIdx.body)
    #  
    doc["links"].each do |element|
      @resIdx.add_link(element)  #new Link object from JSON
    end
    
    #pp @resIdx #uncomment to see ResourceIndex object
  end #get_resourceIndex
  
  ## 
  def follow_link(link)
    puts "FOLLOWING LINK... [#{link}]"
    return unless link.href 

    wc_rest_page =  @wc_conn.goto_page link.href
    # to JSON
    JSON.parse(wc_rest_page.body)
  end #follow_link
  
  ## templates have values that must be substituted prior to GET
  def follow_template(link, options)
    puts "FOLLOWING TEMPLATE... [#{link}]"
    return unless link.template 

    #prepare template
    template = link.template
    options.each { |k,v| template.sub!(/#{k}/,"#{v}") }

    wc_rest_page =  @wc_conn.goto_page template
    # to JSON
    JSON.parse(wc_rest_page.body)
  end #follow_template
 
  ## 
  def run
    #resourceindex
    puts "\n================================================================"
    puts "== #{RT_RC_IDX} =="
    puts "================================================================\n"
    get_resourceIndex
    
    #get person
    puts "\n================================================================"
    puts "== #{RT_PEOPLE} =="
    puts "================================================================\n"
    person = follow_link @resIdx.get_link_by_resource_type RT_PEOPLE
    p = Person.new person
    pp p
    
    #get ACTIVITIES
    puts "\n================================================================"
    puts "== #{RT_ACTIVITIES} =="
    puts "================================================================\n"
    template_values = {'{startIndex}'=>'0','{serviceIds}'=>'','{personal}'=>'true',
                       '{connections}'=>'true','{personGuid}'=>p.guid,
                       '{itemsPerPage}'=>'10','{groupSpaces}'=>'true',}
    activities = follow_template(@resIdx.get_link_by_rel(RT_ACTIVITIES), template_values)
    a = Activities.new activities['items']
    #pp a

    puts "\n================================================================"
    puts "== Activities Stream == "
    puts "================================================================\n"
    puts a.messages.join("\n")

    puts "\n--END--\n\n"
  end #run
end

# ===================================
# MAIN Execution
# ===================================
if __FILE__ == $0
  # 
  wcrest = nil

  if (ARGV.length == 3) #connect to given URL
    puts "WCR> connecting to #{ARGV[2]} with BASIC-AUTH..."
    wcrest = WcRest.new(ARGV[0],ARGV[1],ARGV[2])
  else 
      puts <<END_HELP
= Synopsis 
  Simple WebCenter Spaces REST client that displays user's activity stream

= Usage 
   Connect to given server, and uses BASIC-AUTH
   wcr.rb USER PASS SPACES_SERVER_URI
   
END_HELP
  end

  #run
  wcrest.run if wcrest
end

Sample Run

Below is an example of running the above against my test server, to display the activities of user weblogic
oracle@rolima-home:~/Documents/work/ruby/wcr-post$ ./wc_rest.rb weblogic welcome1 http://localhost:8888/rest/api/resourceIndex
WCR> connecting to http://localhost:8888/rest/api/resourceIndex with BASIC-AUTH...

================================================================
== urn:oracle:webcenter:resourceindex ==
================================================================
--wc_login [http://localhost:8888/rest/api/resourceIndex]
--wc_login took [0.212828757]s

================================================================
== urn:oracle:webcenter:people ==
================================================================
FOLLOWING LINK... [LINK rt[urn:oracle:webcenter:people] hr[http://localhost:8888/rest/api/people/@me/@self?stoken=FHMh49RIbgzsSGAO5IMed5xWr9ah4Oo*] tm[http://localhost:8888/rest/api/people/@me/@self?startIndex={startIndex}&projection={projection}&itemsPerPage={itemsPerPage}&stoken=FHMh49RIbgzsSGAO5IMed5xWr9ah4Oo*] cp[urn:oracle:webcenter:read] rel[EMPTY] tp[EMPTY]]
--goto_page [http://localhost:8888/rest/api/people/@me/@self?stoken=FHMh49RIbgzsSGAO5IMed5xWr9ah4Oo*]
--goto_page took [0.016172011]s
PERSON guid[599A52A05D3511DF8F701DCDD2E623D6] id[weblogic] name[weblogic]

================================================================
== urn:oracle:webcenter:activities:stream ==
================================================================
FOLLOWING TEMPLATE... [LINK rt[urn:oracle:webcenter:activities:stream] hr[] tm[http://localhost:8888/rest/api/activities?startIndex={startIndex}&serviceIds={serviceIds}&personal={personal}&connections={connections}&personGuid={personGuid}&itemsPerPage={itemsPerPage}&groupSpaces={groupSpaces}&stoken=FHMh49RIbgzsSGAO5IMed5xWr9ah4Oo*] cp[urn:oracle:webcenter:read] rel[urn:oracle:webcenter:activities:stream] tp[EMPTY]]
--goto_page [http://localhost:8888/rest/api/activities?astartIndex=0&serviceIds=&personal=true&connections=true&personGuid=599A52A05D3511DF8F701DCDD2E623D6&itemsPerPage=10&groupSpaces=true&stoken=FHMh49RIbgzsSGAO5IMed5xWr9ah4Oo*]
--goto_page took [0.05946188]s

================================================================
== Activities Stream == 
================================================================
2010-07-28T15:24:52-04:00, 'weblogic' created the page 'public docs'
2010-07-28T15:21:59-04:00, 'weblogic' created the document 'test.htm'
2010-07-22T17:52:18-04:00, 'weblogic' 'wasssuuuuuuuuuup!'

--END--

oracle@rolima-home:~/Documents/work/ruby/wcr-post$ 

Let me know if you have any questions, and have fun with REST & Ruby!

Thursday, July 22, 2010

WebCenter Spaces for iPhone

Just to let you know the WebCenter Spaces application for iPhone is now available at Apple's App Store.
Here is the link for you -- http://itunes.apple.com/us/app/oracle-webcenter-spaces-11g/id382334215?mt=8

Wednesday, June 23, 2010

WebCenter WIKI Macro - Table of Contents

WebCenter WIKI Macro - Table of Contents I was asked to help extending Oracle WebCenter's Wiki server, to add a macro to auto-generate a Table of Contents for a wiki page. It follows the same layout as Wikipedia's table of contents, and also has the ability to hide/show itself.

Description:
The <macro:Toc> will generate a simple Table of Contents, in the forms of Wikipedia's Table of Contents. It will search the wiki page content for all Header tags (!, !!, !!!, !!!!) up to 4h level.
Anchors to the title are automatically generated based text for this title
Example: !Description generates anchor <a name="Description"></a><h1>Description</h1>

Syntax:
#1) simple -- will create TOC with title = "Contents" and no auto numbering:
<macro:Toc>
</macro>

#2) with numbering -- numbers are automatically added to the TOC
<macro:Toc numbering="true">
</macro>

#3) with title & numbering -- the title will be set to the text within the macro tags
<macro:Toc numbering="true">
My Table of Contents
</macro>

If you want to give it a try, get the following files and place them on the location below:
Note: It was tested with WebCenter 11g 11.1.1.3.0
-- $WLS_HOME/user_projects/applications//owc_wiki/tags/toc.vm
-- $WLS_HOME/user_projects/applications//owc_wiki/WEB-INF/classes/org/jzwiki/macros/TocMacro.class
-- $WLS_HOME/user_projects/applications//owc_wiki/WEB-INF/lib/yawiki-engine-2.1.jar - file changed is org.jzonic.yawiki.converter.HeaderConverter.class

Here is a screenshot of the macro in action :


Monday, June 7, 2010

WLP Portlet Subscribe/Unsubscribe

Last week, I had to simulate a "subscribe/unsubscribe" mechanism for WebLogic Portal (WLP) 10.3. The basic idea is that the user has an option to subscribe to a portlet, from a list of available portlets, and that is displayed in his main page.

After some research, I found some good reference from Balz Schreier on the WLP Portlet Preferences APIs. In his example, Balz shows how to get access to PortalCustomizationManager which allows us to perform various operations, including removing - .removePlaceable - and adding - .addPlaceable - portlets to a Page.

Using similar code, we could also get access to PortletDefinitionManager , which will give us access to all portlets for the Web Application - .getPublicPortletDefinitions.

In my example, the idea is to "replace" the existing portlet subscription with a new one. To simplify things in my example, I have 2 portlets - weather & stocks - and user can either view one or the other. So, when it is time to change the subscription, I just look for the one that is currently showing - _oldPlaceableView -, so I can get its PlaceholderDefinitionId & PlaceHolderPosition. This is needed, as the new portlet - _newPortletDef - will show up in the same location.

Now, we have all the APIs to:
  • getPortalCustomizationManager -- return instance of PortalCustomizationManager.
  • getPortletDefinitionManager -- return instance of PortletDefinitionManager.
  • getAllPortlets -- returns a list of all available portlets for the Web Application.
  • findPortlet -- finds the PortletDefinition for the new portlet to be subscribed to.
  • findPlaceableView -- finds the PlaceableView instance of the current portlet.
  • deleteCustomizations -- helper to clean up all the customizations for this user, and reset the original state of the page. Useful for the testing, where things start getting messy after some time, and you want to clean it all up. I received this code from an Oracle peer.
  • subscribePortlet -- wraps all the calls into a single method, to make it easier for the test JSP page.
It is also important to say that the user must be authenticated for this to work the way we wanted. In my test.jsp, I have a reference to an authenticate  method, that simply calls  com.bea.p13n.security.Authentication.login.

Putting it all together, here is WlpHelper.java and test.jsp. The idea is to start with a simple JSP just to validate the flow, but that later could turn into a "Preferences Page" of some sort, where user views all the available portlets and can choose which one to subscribe to.

Here is the original page, showing the Stocks portlet:


and this is after executing the test.jsp with the following parameters:
http://localhost:7001/tutorial_portalWeb/test.jsp?username=rolima&password=welcome1&action=subWeather


The example is really simple, but the starting APIs are there for you build from it.
Have fun!

Wednesday, May 12, 2010

Gwibber on Ubuntu 10.04 LTS

While playing with the new Ubuntu 10.04 LTS, I saw the Gwibber client for Twitter, Facebook, Digg, Flickr and others. I know this has not much to do with WebCenter, Enterprise 2.0, Fusion, or even Oracle, but just would like to share in case you read my earlier post and decided to use Ubuntu 10.04.

I tried to make it work, so I could just see the tweets popping up on the desktop via notification-applet, but the first tries were frustrating...
I did manage to add my twitter account, but no updates would come. Facebook was even worst, as I could not even add the account.

After spending some time searching around, I found this bug #530195, where the comment #22 suggested that you increased the timeout in network.py.

I opened up  /usr/lib/python2.6/dist-packages/gwibber/microblog/network.py and noticed the original connection timeout was set to 8secs.

Not sure what internet provider people are using, and I actually thought I had a good speed (around 20Mbps), but that was still not enough. I'm also not sure about the DNS tricks (openDNS + google DNS = magic DNS :), so I just went the lazy way -- multiply by 10 :)

#/usr/lib/python2.6/dist-packages/gwibber/microblog/network.py

    self.curl.setopt(pycurl.TIMEOUT, 150)
    self.curl.setopt(pycurl.CONNECTTIMEOUT, 80)

That solved the Twitter problem, but I was still not able to add my account to Facebook.
After some more research, I found another bug #552227, with many suggestions on how to overcome that. I tried all the suggestions on that page but still no luck.

Ok, let's try the "twitter-hack" then :)... Found that there connection timeout was actually being set on another file -- /usr/lib/python2.6/dist-packages/gwibber/microblog/util/facelib.py

I again applied the "lazy 10x higher" fix:
#/usr/lib/python2.6/dist-packages/gwibber/microblog/util/facelib.py

    c.setopt(pycurl.TIMEOUT, 150)
    c.setopt(pycurl.CONNECTTIMEOUT, 80)

Yay! Finally able to see both Twitter and Facebook accounts on Gwibber! And the cool desktop icon notifications keep popping up now,  a quick not-that-intrusive way to keep updated on things. I really like it better than having either  an extra browser window, or another application running.

WebCenter on Ubuntu 10.04 LTS

Just finished installing WebCenter 11.1.1.2 on Ubuntu 10.04 LTS.
Note: -- this is *not* a supported configuration, I just did as a quick test environment!!!!

The steps are not much different from what I posted before, but you will get a lot of complaints during the initial system/environment checks. I decided just to ignore all the complaints from the Installer, and continue with the install.

This time, I used the newly released WebLogic Server 10.3.3, Repository Content Utility (rcu) 11.1.1.3, Oracle XE 10.2.0.1.1, and WebCenter 11.1.1.2 (you must install this before you can apply the 11.1.1.3 patch).

After installing WebCenter 11.1.1.2, and before applying the patch, I decided to start all servers to check the status of the install.
Both WLS_Admin, and WLS_Services started fine, but WLS_Spaces failed with the following error:
(........ initialization messages .........)
<May 12, 2010 10:36:50 AM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<May 12, 2010 10:36:50 AM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
[[Cjava.lang.NoClassDefFoundError: javax/wsdl/Definition
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.privateGetPublicMethods(Class.java:2547)
at java.lang.Class.privateGetPublicMethods(Class.java:2557)
at java.lang.Class.getMethods(Class.java:1410)
at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.getImplementedInterfaces(EjbAnnotationProcessor.java:1687)
at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processSessionAnnotations(EjbAnnotationProcessor.java:447)
at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:310)
at weblogic.ejb.container.dd.xml.EjbAnnotationProcessor.processAnnotations(EjbAnnotationProcessor.java:180)
at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.processStandardAnnotations(EjbDescriptorReaderImpl.java:344)
at weblogic.ejb.container.dd.xml.EjbDescriptorReaderImpl.createReadOnlyDescriptorFromJarFile(EjbDescriptorReaderImpl.java:204)
at weblogic.ejb.spi.EjbDescriptorFactory.createReadOnlyDescriptorFromJarFile(EjbDescriptorFactory.java:93)
at weblogic.ejb.container.deployer.EJBModule.loadEJBDescriptor(EJBModule.java:1242)
at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:395)
at weblogic.application.internal.flow.ModuleListenerInvoker.prepare(ModuleListenerInvoker.java:199)
at weblogic.application.internal.flow.DeploymentCallbackFlow$1.next(DeploymentCallbackFlow.java:507)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:149)
at weblogic.application.internal.flow.DeploymentCallbackFlow.prepare(DeploymentCallbackFlow.java:45)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:1221)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:367)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:58)
(........ bunch of errors .........)

Did a quick search, and found out a copy of wsdl4j.jar under
$DOMAIN_HOME/servers/WLS_Spaces/tmp/_WL_user/oracle.webcenter.jive.dependency/38f82s/APP-INF/lib/wsdl4j.jar
I copied under $DOMAIN_HOME/lib and tried starting WLS_Spaces again, but it failed with exact same error message.

Looking at the output from server start, notice the line that reads:
<May 12, 2010 10:35:55 AM EDT> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
/opt/wls/user_projects/domains/base_domain/lib/mbeantypes/csp-id-asserter.jar:/opt/wls/user_projects/domains/base_domain/lib/wsdl4j.jar>

shows after the line that sets the classpath, and the line with the java ..... weblogic.Server ... not sure if this could be the problem -- classpath being set too late?

In any case, I just edited setDomainEnv.sh to make sure it would include wsdl.jar
# add the following line ....
POST_CLASSPATH=${DOMAIN_HOME}/lib/wsdl4j.jar${CLASSPATHSEP}${POST_CLASSPATH}

# BEFORE this line
if [ "${POST_CLASSPATH}" != "" ] ; then
    if [ "${CLASSPATH}" != "" ] ; then
        CLASSPATH="${POST_CLASSPATH}${CLASSPATHSEP}${CLASSPATH}"
        export CLASSPATH
    else
        CLASSPATH="${POST_CLASSPATH}"
        export CLASSPATH
    fi
fi

Now WLS_Spaces started correctly, and I was able to login to WebCenter Spaces pages.

Again -- this is not supported, so I'm not sure what errors could still be ahead when I try more things.
In any case, I'll now try to setup the SAML-based Single Sign-on and will post the results here.

Tuesday, April 6, 2010

Lazy Developer


I was reading some tutorials for Oracle WebLogic Portal (WLP), and they mention it is good practice to separate your WLP project in a folder structure  to make it easier to manage and add it to source control.

One structure I found to be good, is to use the following:

HOME/workspaces/projectX/           # workspace directory for Project X

HOME/projects/projectX/             # directory for the Project X projects
                 prjX_portalEAR/    # your EAR project
                 prjX_portalWeb/    # your WAR project
                 prjX_datasync/     # a Datasync project
                 prjX_ejb/          # an EJB project
                 prjX_utility/      # a J2EE utility project
                 prjX_webServices/  # a J2EE utility project

HOME/domains/prjX_domain/           # domain directory for Project X

Note: You may have a structure that looks a bit different, and that is ok. The main point of this post is not the structure itself, but being lazy about it :-)

I started running through tutorials, and first time, you go ahead and manually create the folder structure. Then you try, and nothing works, so you erase it all, and start again. Once again, you go ahead with File Explorer, and make all these folders.

You notice this is a painful process. After all, the whole idea is to have the computer do the work, and not you. Also, I'm a bit lazy developer, and I really like automating things, so I don't have to do the work over and over. BTW, there is also a great post about this -- "When Windows are not enough".

So, I sit down and write the following BAT script that receives 2 parameters:
  • Project_Name -- projectX from example above
  • Project_Prefix -- prjX from example above

Here is the BAT file:
@echo off

IF not "%1"=="" GOTO GOOD
:EXIT
echo "Error in %0 - Invalid Argument Count"
echo "Syntax: %0 Project_Name Project_Prefix"
goto END

:GOOD
echo "SETTING UP PROJECT: %1 [%2]";

echo "CLEAN UP..."
rmdir /s /q domains\%2_domain\
rmdir /s /q projects\%1\
rmdir /s /q workspaces\%1\

echo "CREATE DOMAIN..." 
mkdir domains\%2_domain\

echo "CREATE WORKSPACE..."
mkdir workspaces\%1

echo "CREATE PROJECTS..."
mkdir projects\%1\%2_datasync
mkdir projects\%1\%2_ejb
mkdir projects\%1\%2_portalEAR
mkdir projects\%1\%2_portalWeb
mkdir projects\%1\%2_utility
mkdir projects\%1\%2_webServices

echo "DONE!"

:END

I also created similar script in shell script, as I have dual boot and I keep switching from Ubuntu to Win7.
#!/bin/sh

if [ $# -ne 2 ]
then
    echo "Error in $0 - Invalid Argument Count"
    echo "Syntax: $0 Project_Name Project_Prefix"
    exit
fi

echo "SETTING UP PROJECT: $1 [$2]";


echo "CLEAN UP..."
rm -rf domains/$2_domain/
rm -rf projects/$1/
rm -rf workspaces/$1/

echo "CREATE DOMAIN..."
mkdir -pv domains/$2_domain

echo "CREATE WORKSPACE..."
mkdir -pv workspaces/$1

echo "CREATE PROJECTS..."
mkdir -pv projects/$1/$2_datasync
mkdir -pv projects/$1/$2_ejb
mkdir -pv projects/$1/$2_portalEAR
mkdir -pv projects/$1/$2_portalWeb
mkdir -pv projects/$1/$2_utility
mkdir -pv projects/$1/$2_webServices

echo "DONE!"

Again, the script itself and the folder structure can be different, does not matter. What you really should always strive for is automation! Let the computer do the hard/tedious work, not you. You should be focusing on your solution (or your tutorial :)


Friday, April 2, 2010

N-1 WebCenter-UCM Install


Sometimes, you may want to have a single instance of Oracle UCM shared to multiple instances of Oracle WebCenter. One good example we had for this, is a fellow Oracle employee running a bootcamp in China. Instead of installing 1-1 instances, he would like to have a N-1 topology, where you have N instances of WebCenter pointing to 1 instance of UCM.

The following is a link to Gary's post about how to do this installation -- 
http://blogs.oracle.com/garyniu/2010/04/content_management_for_webcenter_installation_guide.html

It is also a good read if you are having some other issues with your UCM install, specially the last section about "Configuring the Identity Store".

Thanks Gary!

Wednesday, March 3, 2010

Configuring Single Sign On with OAM and OID

We were having an internal Bootcamp for Webcenter, and one of the things we had to do, was to configure Single-Sign On (SSO) in front of our installation of WebCenter.
We did follow the instructions I posted on my previous blog entry, and had the WebCenter installed and Services configured locally on our boxes.
We also had access to 2 servers -- Oracle Internet Directory (OID) server, and Oracle Access Manager (OAM) server. Both products are part of the Oracle Identity Management solution.

Our main guide is the Security Chapter in the WebCenter Admin Guide. This is an extensive chapter, and has all the information you need. 
To make things simpler, I extracted the steps from the guide, and made it into the "Quick Steps" guide below.

So, assuming you have access to an OID server -- oid-server.example.com -- and an OAM server -- oam-server.example.com -- you could follow the steps below to implement SSO in front of your WebCenter installation.

The diagram below, shows what we want to achieve. All HTTP request should come through Apache/WebGate, that will then contact OAM to check the policies. If needed, an SSO Login page is presented, and the user is authenticated against the Identity Store. Once it is all good, the cookies are set, and the request is finally forwarded to the WebCenter server.

Figure 1 - OAM SSO topology

Requirements
  • OID Server - oid-server.example.com
    • assume the user domain is example.com - dc=example, dc=com
    • assume you have user orcladmin as the Admin user
    • port = 3060
  • OAM Server - oam-server.example.com
    • assume access server id = aaa1 -- change it accordingly
    • port = 6021
  • WebCenter installation -- following instructions from previous post
    • home folder = /u01/app/wls
Documentation
Quick Steps

1. Configure HTTP as default listener

  • once we finished the configuration from previous entry, the HTTP requests coming to your server were not being served by Apache. In order to have it, you need to perform the steps below.
  • go to Terminal window and do the following

    [oracle@mymachine wls]$ cd /u01/app/wls/Oracle_WT1/instances/instance1/config/OHS/ohs1/
    [oracle@mymachine ohs1]$ cp mod_wl_ohs.conf mod_wl_ohs.conf.BOOT
    [oracle@mymachine ohs1]$ vi mod_wl_ohs.conf
    ---- add the following lines to the end of this file
    <IfModule mod_weblogic.c>
    MatchExpression /webcenter WebLogicHost=mymachine.example.com|WebLogicPort=8888
    MatchExpression /owc_wiki WebLogicHost=mymachine.example.com|WebLogicPort=8890
    MatchExpression /owc_discussions WebLogicHost=mymachine.example.com|WebLogicPort=8890
    MatchExpression /rest WebLogicHost=mymachine.example.com|WebLogicPort=8890
    </IfModule>
    [oracle@mymachine ohs1]$ cd ../../../bin
    [oracle@mymachine bin]$ ./opmnctl stopall
    opmnctl stopall: stopping opmn and all managed processes...
    [oracle@mymachine bin]$ ./opmnctl startall
    opmnctl startall: starting opmn and all managed processes...
    [oracle@mymachine bin]$

  • do a quick test by navigating to the following URLs to make sure it is all accessible through Oracle HTTP
    • WebCenter Spaces = http://mymachine.example.com:7777/webcenter
    • WebCenter Discussion = http://mymachine.example.com:7777/owc_discussions
    • WebCenter Wiki = http://mymachine.example.com:7777/owc_wiki
  • Now, we have all the requests coming through Apache. Let's now create the policies on the OAM server.


2. Configuring OAM Using Scripts

  • let's create the Application Domain in OAM using the OAM Config Tool included in WLS installation.
  • go to a Terminal window and do the following

    [oracle@mymachine wls]$ cd /u01/app/wls/
    [oracle@mymachine wls]$ vi uris-file.txt
    #PROTECTED
    protected_uris
    /webcenter/adfAuthentication
    /webcenter/content
    /owc_wiki/user/login.jz
    /owc_wiki/adfAuthentication
    /owc_discussions/rss
    /owc_discussions/login!withRedirect.jspa
    /owc_discussions/login!default.jspa
    /owc_discussions/login.jspa
    /owc_discussions/admin
    /rest

    #PUBLIC
    public_uris
    /webcenter
    /owc_wiki
    /owc_discussions
    /rss
    /workflow

    ---- save and exit VI
    ---- the command below MUST be in one line!!!

    [oracle@mymachine wls]$ /u01/app/wls/jdk160_14_R27.6.5-32/bin/java -jar
    /u01/app/wls/oracle_common/modules/oracle.oamprovider_11.1.1/oamcfgtool.jar mode=CREATE
    app_domain="mymachine.example.com" uris_file=/u01/app/wls/uris-file.txt
    app_agent_password=welcome1 ldap_host=oid-server.example.com ldap_port=3060 ldap_userdn="cn=orcladmin"
    ldap_userpassword=welcome1 oam_aaa_host=oam-server.example.com oam_aaa_port=6021

    Processed input parameters
    Initialized Global Configuration
    Successfully completed the Create operation.
    Operation Summary:
    Policy Domain : mymachine.example.com
    Host Identifier: mymachine.example.com
    Access Gate ID : mymachine.example.com_AG

    [oracle@mymachine wls]$

  • we can validate by issuing the following command in 1 line!

    [oracle@mymachine wls]$ /u01/app/wls/jdk160_14_R27.6.5-32/bin/java -jar
    /u01/app/wls/oracle_common/modules/oracle.oamprovider_11.1.1/oamcfgtool.jar mode=VALIDATE
    app_domain="mymachine.example.com" app_agent_password=welcome1 ldap_host=oid-server.example.com
    ldap_port=3060 ldap_userdn="cn=orcladmin" ldap_userpassword=welcome1 oam_aaa_host=oam-server.example.com
    oam_aaa_port=6021 test_username=weblogic

    Enter test_userpassword: >>welcome1<<
    Processed input parameters
    Initialized Global Configuration
    Validating app_domain: mymachine.example.com : OK.
    Validating web_domain: mymachine.example.com : OK.
    Validating access_gate: mymachine.example.com_AG : OK.
    Found url:http://mymachine.example.com/webcenter/adfAuthentication
    Found url:http://mymachine.example.com/workflow
    Found url:http://mymachine.example.com/rss
    Found url:http://mymachine.example.com/owc_discussions/login!withRedirect.jspa
    Found url:http://mymachine.example.com/owc_discussions/login!default.jspa
    Found url:http://mymachine.example.com/owc_wiki/user/login.jz
    Found url:http://mymachine.example.com/rss/rssservlet
    Found url:http://mymachine.example.com/owc_wiki/adfAuthentication
    Found url:http://mymachine.example.com/owc_discussions/login.jspa
    Found url:http://mymachine.example.com/owc_wiki
    Found url:http://mymachine.example.com/owc_discussions/rss/
    Found url:http://mymachine.example.com/webcenter/content
    Found url:http://mymachine.example.com/webcenter
    Found url:http://mymachine.example.com/rest
    Found url:http://mymachine.example.com/owc_discussions
    Found url:http://mymachine.example.com/owc_discussions/admin
    Successfully completed the Validate operation.

  • you may also want to login to your OAM server and verify the Policies and Access Gate configurations


3. Configuring the WebTier

  • Now that the policies are created on OAM server, we must install the WebGate on your WebCenter machine. This will work together with Apache to filter the requests and check their policies.
  • Before you install WebGate, you should copy the following libraries to a common place, in order to make the install process easier.
  • Note: if you are using a 64bit machine, you should copy the libraries from the lib64 folder -- /lib64/libgcc_s.so.1 and /usr/lib64/libstdc++.so.5

    >>>> need to have these 2 libs in same folder
    [oracle@mymachine ]$ cd /tmp/
    [oracle@mymachine tmp]$ mkdir lib
    [oracle@mymachine tmp]$ cd lib
    [oracle@mymachine lib]$ cp /lib/libgcc_s.so.1 .
    [oracle@mymachine lib]$ cp /usr/lib/libstdc++.so.5 .

    [oracle@mymachine lib]$ cd /u01/oracle/software/E20BootcampInstallers/webgate

    >>>> if "oracle" is NOT is sudoers:
    su -c "./Oracle_Access_Manager10_1_4_3_0_linux_OHS11g_WebGate -gui"

    >>>> if "oracle" MUST is in sudoers
    [oracle@mymachine webgate]$ sudo -u root ./Oracle_Access_Manager10_1_4_3_0_linux_OHS11g_WebGate -gui

  • You could refer to the doc now, and follow all the steps listed in section  23.7.1.3.3 Install WebGate on the WebTier. Below is just an example of the values you will be using during the install process.
    • Enter the username the web server is running as = oracle
    • Enter the Group for the above username = oinstall
    • Please specify a directory name or press Enter = /u01/app/wls/webgate
    • Location of GCC runtime libraries = /tmp/lib
    • Specify the transport security mode = 1 - Open Mode
    • WebGate ID = mymachine.example.com_AG
    • Password for WebGate = welcome1
    • Access Server ID = aaa1
    • Host name where an Access Server is installed = oam-server.example.com
    • Port number the Access Server listens to = 6021
    • Proceed with automatic httpd.conf configuration
    • Absolute path of httpd.conf = /u01/app/wls/Oracle_WT1/instances/instance1/config/OHS/ohs1/httpd.conf
  • restart Oracle HTTP server.

    [oracle@mymachine lib]$ cd /u01/app/wls/Oracle_WT1/instances/instance1/bin/
    [oracle@mymachine bin]$ ./opmnctl stopall
    opmnctl stopall: stopping opmn and all managed processes...
    [oracle@mymachine bin]$ ./opmnctl startall
    opmnctl startall: starting opmn and all managed processes...

4. Create local orcladmin

  • In our OID example server, we have user orcladmin, as the administrator. We want to create this user locally (on your local WLS). Another option, would be to have the user weblogic on the LDAP server.
  • Log in to WLS Console - http://mymachine.example.com:7001/console
  • Go to "boot_domain" -> "Security realms" -> "myrealm" -> "Users and Groups"
  • Click "New" and use the following info:
    • Name = orcladmin
    • Provider = DefaultAuthenticator
    • Password = welcome1 - Confirm = welcome1
  • Click on the newly created orcladmin – make sure you choose the one with DefaultAuthenticator
  • Click "Groups" and add the Administrators group to this user


5. Configuring Discussions Server

  • Log in to Discussions Server Admin Console - http://mymachine.example.com:8890/owc_discussions/admin
    • Login on Discussions Jive Admin – weblogic / welcome1
  • Click "System Properties"
    • add/edit the property and "Save" it.
      • owc_discussions.sso.mode = true
  • Click "Settings -> Admins/Moderators"
  • Click "Grant New Permissions"
    • Choose the permission = System Admin
    • Specific user = orcladmin
    • Click "Grant new permission"


6. Configuring WebLogic to use OID/OAM

  • Now, we need to create the Authenticators that will process the user authentication. We need to have authenticators for OAM and OID.
  • You must now perform all the steps listed in section 23.7.1.6 Configuring the Policy Manager , and refer to the values below as reference.
    • Note #1: you should double check the values with your System Administrator, specially the LDAP configuration below. 
    • Note #2: below, I'm listing only the values that need to be changed. Leave all others with the default values, or make changes if you are 100% sure.
    • Note #3: if you have any problems logging in, you can always come back to WLS console, and remove these extra Authenticators.
  • for the OID Authenticator use the following:
    • Control Flag = SUFFICIENT
    • Host = oid-server.example.com
    • Port = 3060
    • Principal = cn=orcladmin
    • Credential = welcome1 – Confirm = welcome1
    • User Base DN = dc=example,dc=com
    • All Users Filter = (&(uid=*)(objectclass=person))
    • User Name Attribute = uid
    • Group Base DN = dc=example,dc=com
    • All the other values don't need to be changed
  • for the OAM ID Asserter use the following:
    • Control Flag = REQUIRED
    • Active Types = ObSSOCookie, OAM_REMOTE_USER
    • Application Domain = mymachine.example.com
    • Access Gate Password = welcome1
    • Keystore Pass Phrase = welcome1
    • Access Gate Name = mymachine.example.com_AG
    • Primary Access Server = oam-server.example.com:6021
    • All the other values don't need to be changed
  • for the DefaultAuthenticator change:
    • Control Flag = SUFFICIENT
  • reorder the providers as described in the doc:
    • OAMIdentityAsserter (REQUIRED)
    • OracleInternetDirectoryAuthenticator (SUFFICIENT)
    • DefaultAuthenticator (SUFFICIENT)
    • DefaultIdentityAsserte
  • don't forget to add the EXTRA_JAVA_PROPERTIES to setDomainEnv.sh

    [oracle@mymachine bin]$ cd /u01/app/wls/user_projects/domains/boot_domain/bin/
    [oracle@mymachine bin]$ vi setDomainEnv.sh
    ---- put it around line 100 after the SUN_JAVA_HOME

    EXTRA_JAVA_PROPERTIES="-Dweblogic.security.SSL.ignoreHostnameVerification=true
    -Doracle.mds.bypassCustRestrict=true -Djps.update.subject.dynamic=true
    -Doracle.webcenter.spaces.osso=true -noverify ${EXTRA_JAVA_PROPERTIES}"

7. Restart & Test

  • bounce all servers - WLS Admin, WLS_Services, WLS_Spaces
  • test that you can login with any of users you have on your LDAP server.
  • test that once you login to WIKI (/owc_wiki), you can just go to Discussions (/owc_discussions) without being asked for password. Same if you go to WebCenter (/webcenter)

8. What's next? 

During our Bootcamp, we managed to configure SSO successfully in 7 out of 7 machines. It was not very straightforward, so we had to go back and double-check the steps and values. Once we did that, all was working fine.

If it does not work for the 1st time, just go back and double check everything. If you still have problems, just post a comment.

Tuesday, February 16, 2010

WebCenter Quick Install Guide


I know Oracle provides a good guide on how to perform quick install for WebCenter, but still, this is just a collection of steps I've been performing on my development machines, and it includes some things like configuring the connections to Wikis & Discussion server.
This is not meant for a enterprise deployment, but good enough for a developer, quick demo, or whenever you have a 4Gb Unix machine laying around... :-)
For this basic setup, we will be using 
WS-Security.


Resources

  1. You can get all the software from the following link - http://www.oracle.com/technology/software/products/middleware/htdocs/fmw_11_download.html

    1. Oracle Database 10g Express
    2. Repository Creation Utility (RCU 11.1.1.2.0) - used to create the necessary repositories
    3. WebLogic Server (10.3.2) - wls1032_linux32.bin
    4. Web Tier Utilities (11.1.1.2.0) - Oracle Apache installer
    5. WebCenter Suite (11.1.1.2.0) - WebCenter installer
    6. Content Management for WebCenter (10.1.3.5.1) - directory with Content Server install - to be used during WebCenter installation
  2. The best would be to install on Oracle Enterprise Linux machine, with 4Gb memory and around 10Gb~15Gb disk space. You may also try on Ubuntu, just ignore some of the failed checks.

Before you Continue...

Check out George Maggessy's great post about installation, with lots of screenshots that help visualize the steps below.



1. Install Oracle DB

Documentation
Quick Steps
1. Install Oracle XE


[oracle@mymachine E20Installers]$ su -c "rpm -i ./oracle-xe-univ-10.2.0.1-1.0.i386.rpm"
[oracle@mymachine E20Installers]$ su -c "/etc/init.d/oracle-xe configure"
  • You may also want to change the PROCESSES param to 300
[oracle@mymachine E20Installers]$ export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
[oracle@mymachine E20Installers]$ $ORACLE_HOME/bin/sqlplus sys/welcome1@xe as sysdba

SQL> alter system set processes=300 scope=spfile; 
SQL> exit;

[oracle@mymachine E20Installers]$ su -c "/sbin/service oracle-xe reload"



2. Configuring Spaces

Documentation
Quick Steps
1. Install WLS

[oracle@mymachine E20Installers]$  ./wls1032_linux32.bin
  • choose to create a new Middleware home under /u01/app/wls
  • continue with defaults
  • do not run the Quick Start at the end
2. Install WebTier

[oracle@mymachine E20Installers]$ ./webtier/Disk1/runInstaller
  • choose "Install & Configure"
  • Oracle Middleware Home is the one you just created /u01/app/wls
  • Step 5, select "Oracle HTTP Server" only and unselect the other boxes (webcache, associate with domain)
  • continue with defaults
  • once install is complete, you should be able to navigate to http://mymachine.us.oracle.com:7777
3. Create the Repository

[oracle@mymachine E20Installers]$ ./rcu/bin/rcu
  • choose "create"
  • your machine comes with Oracle XE, so for Step 2 use the following:

    • hostname = localhost
    • port = 1521
    • service name = xe
    • username = sys
    • password = welcome1
    • role = sysdba
  • during the "Checking Prerequisites" you should see a message complaining about the DB not being supported. Just click on "Ignore"
  • Step 3, keep the prefix as "DEV" and select "WebCenter Suite", along with "AS Common Schemas -> Metadata Services".
  • Step 4, use "welcome1" as password -- easy to remember
  • continue with defaults and RCU will create the tablespaces and users
4. Install WebCenter

[oracle@mymachine E20Installers]$ ./wc/Disk1/runInstaller
  • point JDK home to /u01/app/wls/jdk160_14_R27.6.5-32
  • Oracle Middleware Home is the one you just created /u01/app/wls
  • Step 4, let's install UCM as well:

  • Step 5, use the following:

    • Connect String = localhost:1521:xe - pay attention to this one!
    • Schema User Name = DEV_OCSERVER
    • Schema Password = welcome1
  • click "Install"
  • click "Next" to start the UCM install
  • point UCM Media Directory to /u01/oracle/software/E20Installers/ContentServer (or wherever we have the software)
  • click "Next" and wait for install to finish
5. Configure WebCenter domain

  • We need to create a new WLS domain to host our WebCenter stuff.
  • that is done by using the WLS Config tool

    [oracle@mymachine E20Installers]$ cd /u01/app/wls/Oracle_WC1/common/bin/
    [oracle@mymachine bin]$ ./config.sh
    
  • choose "Create a new Weblogic Domain"
  • check all the checkboxes, so all products are supported
  • for testing purposes, Domain name = boot_domain
  • use "welcome1" as password for user "weblogic"
  • go with "Development" and "Sun JDK"
  • Configure JDBC Component Schema

    • to make it simpler to edit, check all the checkboxes and make the 3 (and only 3) changes below:
    • DBMS/Service = xe
    • hostname = localhost
    • Schema Password = welcome1
    • click "Next" and make sure all the connection tests are ok
  • Select Optional Configuration -- there is no need to do any, but you might want to choose to have all services running on a Unix Machine.

    • refer to George's blog regarding this step
6. Start the services

  • To verify the install so far, let's start the servers
  • Weblogic Admin Server

    [oracle@mymachine bin]$ cd /u01/app/wls/user_projects/domains/boot_domain/
    [oracle@mymachine boot_domain]$ ./startWebLogic.sh
    
  • WebCenter Services

    • before you do that, let's create a boot.properties to avoid having to type username/pwd everytime

      [oracle@mymachine boot_domain]$ cd servers
      [oracle@mymachine servers]$ mkdir -p WLS_Services/security
      [oracle@mymachine servers]$ cd WLS_Services/security/
      [oracle@mymachine security]$ vi boot.properties
      ---- add these 2 lines
      username=weblogic
      password=welcome1
      ---- save and exit
      [oracle@mymachine security]$ cd ../../../bin
      [oracle@mymachine bin]$ ./startManagedWebLogic.sh WLS_Services
      
  • WebCenter Spaces

    • before you do that, let's create a boot.properties to avoid having to type username/pwd everytime

      [oracle@mymachine boot_domain]$ cd servers
      [oracle@mymachine servers]$ mkdir -p WLS_Spaces/security
      [oracle@mymachine servers]$ cd WLS_Spaces/security/
      [oracle@mymachine security]$ vi boot.properties
      ---- add these 2 lines
      username=weblogic
      password=welcome1
      ---- save and exit
      [oracle@mymachine security]$ cd ../../../bin
      [oracle@mymachine bin]$ ./startManagedWebLogic.sh WLS_Spaces
      
  • You should now be able to access:


3. Configuring UCM

Documentation
Quick Steps
1. Configure UCM to use HTTP

  • this is a quick step, to make sure UCM shows up on the URL we specified before - http://mymachine.us.oracle.com:7777/ucm
  • for this, we need to edit the http.conf file for the WebTier's Apache, and append 2 lines

    [oracle@mymachine E20Installers]$ cd /u01/app/wls/Oracle_WT1/instances/instance1/config/OHS/ohs1
    [oracle@mymachine ohs1]$ vi httpd.conf
    ---- append
    #needed for UCM
    include "/u01/app/wls/Oracle_WC1/ucm/data/users/apache22/apache.conf"
    
  • save and exit vi
  • bounce the HTTP server

    [oracle@mymachine ohs1]$ cd ../../../bin/
    [oracle@mymachine bin]$ ./opmnctl stopall
    opmnctl stopall: stopping opmn and all managed processes...
    [oracle@mymachine bin]$ ./opmnctl startall
    opmnctl startall: starting opmn and all managed processes...
    [oracle@mymachine bin]$
    
  • test by navigating to http://mymachine.us.oracle.com:7777/ucm
2. Register the UCM Server connection

  • Login to Fusion EM http://mymachine.us.oracle.com:7001/em
  • Navigate to "Farm" -> "WebCenter" -> "WebCenter Spaces" -> "webcenter"
  • right-click to open the context menu, and select "Settings" -> "Service Configuration"
  • click on "Content Repository" -> "Add"

    • Connection name = boot_ucm
    • Repository type = Oracle Content Server
    • Active Connection = check
    • Administrator User Name = sysadmin
    • Root Folder = /bootcamp
    • Application Name = bootcamp
    • RIDC Socket Type = Socket
    • Server Host = localhost -- MUST be localhost
    • Server Port = 4444
    • continue with defaults
  • save and bounce WLS_Spaces
  • you should now be able to login to Spaces and see your Documents

    • go to "Page Actions" -> "Manage Pages" and select "Documents" to show up

4. Configuring Discussion Forums

Documentation
Quick Steps
1. Configure WS-Security

  • we need to generate the certificates
  • open a new Terminal window and do the following:

    [oracle@mymachine wls]$ cd /u01/app/wls/
    [oracle@mymachine wls]$ mkdir keystore
    [oracle@mymachine wls]$ cd keystore/
    [oracle@mymachine keystore]$ ../jdk160_14_R27.6.5-32/bin/keytool -genkeypair -keyalg RSA \
        -dname "cn=mymachine,dc=us,dc=oracle,dc=com" -alias orakey -keypass welcome1 -keystore \
        webcenter.jks -storepass welcome1 -validity 1064
    
    [oracle@mymachine keystore]$ ../jdk160_14_R27.6.5-32/bin/keytool -exportcert -v \
        -alias orakey -keystore webcenter.jks -storepass welcome1 -rfc -file orakey.cer
    Certificate stored in file 
    
    [oracle@mymachine keystore]$ ../jdk160_14_R27.6.5-32/bin/keytool -importcert \
        -alias webcenter_spaces_ws -file orakey.cer -keystore webcenter.jks \
        -storepass welcome1
    Certificate already exists in keystore under alias 
    Do you still want to add it? [no]:  yes
    Certificate was added to keystore
    
    [oracle@mymachine keystore]$ cp webcenter.jks /u01/app/wls/user_projects/domains/boot_domain/config/fmwconfig/
    
  • login to Fusion EM - http://mymachine.us.oracle.com:7001/em
  • navigate to "Farm_boot_domain" -> "Weblogic Domain" -> "boot_domain"
  • right-click to open the context menu, and select "Security" -> "Security Provider Configuration"
  • scroll down to "Keystore", expand it, and click "Configure"
  • un-check the box "Configure Keystore Management" and click "Ok" -- this is to reset the configuration
  • go back to "Keystore", and click "Configure"
  • check the box "Configure Keystore Management" and enter the following info

    • Keystore Path = ./webcenter.jks
    • Password = welcome1 -- Confirm Pwd = welcome1
    • Signature Key Alias = orakey
    • Signature Password = welcome1 -- Confirm Pwd = welcome1
    • Encryption Key Crypt Alias = orakey
    • Crypt Password = welcome1 -- Confirm Pwd = welcome1
  • restart the WLS Admin Server
2. Configure Discussion Server

  • back on the Terminal, make sure you are still in the keystore folder -- /u01/app/wls/keystore

    [oracle@mymachine keystore]$ ../jdk160_14_R27.6.5-32/bin/keytool -importcert -alias df_orakey_public \
        -file orakey.cer -keystore owc_discussions.jks -storepass welcome1
    Owner: CN=mymachine, DC=us, DC=oracle, DC=com
    Issuer: CN=mymachine, DC=us, DC=oracle, DC=com
    Serial number: 4b69f328
    Valid from: Wed Feb 03 17:05:28 EST 2010 until: Wed Jan 02 17:05:28 EST 2013
    Certificate fingerprints:
             MD5:  3C:7A:D7:33:1A:21:9F:BA:24:A2:D1:9E:09:F6:FC:93
             SHA1: 59:B6:3F:78:8D:5B:28:E4:E8:8C:7E:B1:9A:22:A9:20:F6:39:F1:20
             Signature algorithm name: SHA1withRSA
             Version: 3
    Trust this certificate? [no]:  yes
    Certificate was added to keystore
    
    MAKE SURE keystore.properties HAS NO EXTRA SPACES!!! DOUBLE CHECK EACH LINE TO MAKE SURE OF THAT!!!
    
    [oracle@mymachine keystore]$ vi keystore.properties
    org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
    org.apache.ws.security.crypto.merlin.keystore.type=jks
    org.apache.ws.security.crypto.merlin.keystore.password=welcome1
    org.apache.ws.security.crypto.merlin.keystore.alias=df_orakey_public
    org.apache.ws.security.crypto.merlin.file=/u01/app/wls/keystore/owc_discussions.jks
    
  • edit the following file, to make sure the CLASSPATH can reach this properties file

    [oracle@mymachine keystore]$ vi ../user_projects/domains/boot_domain/bin/setDomainEnv.sh
    ---- add the following lines to the end of this file
    if [ "${CLASSPATH}" != "" ] ; then
      CLASSPATH="${CLASSPATH}${CLASSPATHSEP}/u01/app/wls/keystore/"
      export CLASSPATH
    else
      CLASSPATH="/u01/app/wls/keystore/"
      export CLASSPATH
    fi
    
  • Login to the Jive Admin tool - http://mymachine.us.oracle.com:8890/owc_discussions/admin - weblogic/welcome1
  • Go to "System Properties"
  • Modify the value of webservices.soap.custom.crypto.fileName so that it points to the properties file you just created

    • webservices.soap.custom.crypto.fileName = keystore.properties
    • ! note that you don't need to specify full path, as you made the change to the CLASSPATH
    • click "Save Property"
  • Let's also add/edit the jiveURL so that RSS feeds are correctly setup

    • jiveURL = mymachine.us.oracle.com:8890/owc_discussions
    • click "Save Property"
3. Register Discussion Server connection

  • login to Fusion EM - http://mymachine.us.oracle.com:7001/em
  • Navigate to "Farm" -> "WebCenter" -> "WebCenter Spaces" -> "webcenter"
  • right-click to open the context menu, and select "Settings" -> "Service Configuration"
  • click on "Discussions and Announcements" -> "Add"

    • Connection name = boot_discussions
    • Repository type = Oracle Content Server
    • Active Connection = check
    • Server URL = http://mymachine.us.oracle.com:8890/owc_discussions
    • Administrator User Name = weblogic
    • Connection Secured = check
    • Expand "Additional Properties" and click "Add" for the following properties

      keystore.location/u01/app/wls/user_projects/domains/boot_domain/config/fmwconfig/webcenter.jks
      keystore.typejks
      keystore.passwordwelcome1 -- To encrypt the password, check "Is Property Secured"
      encryption.key.aliasorakey
      encryption.key.passwordwelcome1 -- To encrypt the password, check "Is Property Secured"
      group.mappingforum -- that is the default value
  • save and bounce everything - WLS_Admin, WLS_Services, WLS_Spaces
  • you should now be able to login to Spaces and see your Discussions

    • go to "Page Actions" -> "Manage Pages" and select "Documents" to show up

5. Configuring Wiki

Documentation
Quick Steps
1. Generate the Passcode

  • login to Fusion EM - http://mymachine.us.oracle.com:7001/em
  • navigate to "Farm_boot_domain" -> "Weblogic Domain" -> "boot_domain"
  • right-click to open the context menu, and select "Security" -> "Credentials"
  • click "Create Map" to create a new credential map

    • Map Name = owc_wiki
  • select the owc_wiki map, and click "Create Key"

    • Select Map = owc_wiki
    • Key = wsPasscode
    • Type = Password
    • User Name = weblogic -- does not really matter
    • Password = welcome1
  • click OK.
2. Register the WIKI Server connection

  • Login to Fusion EM http://mymachine.us.oracle.com:7001/em
  • Navigate to "Farm" -> "WebCenter" -> "WebCenter Spaces" -> "webcenter"
  • right-click to open the context menu, and select "Settings" -> "Service Configuration"
  • click on "Wiki and Blog Server" -> "Add"

  • save and bounce WLS_Spaces & WLS_Services
  • you should now be able to login to Spaces and add WIKIs/Blogs to a page