Sunday, August 7, 2016

Oracle webcenter portal 12c: failure to authenticate the user weblogic

I was working on webcenter portal 12.2.1 and trying to enable the discussion and forum for the portal. After Installing and configuring the discussion server when I try to connect from the portal I was getting below error:

failure to authenticate the user weblogic, due to: Unexpected error occurred, due to : oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : SOAP must understand error. MustUnderstand headers:["{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security"] are not understood.

Cause:

This error comes because internally webcenter portal uses saml token to authenticate the services provided by the discussion server. And webservice security is not configured as part of post installation task.

Solution:

You need to configure the saml message protection policy in webcenter as shown below:

  • Go to EM console => from left navigation, select discussions


  • Now select owc_discussions => click on OWCDiscussionsServiceAuthenticated

  • On this service attach this policy i.e. oracle/wss11_saml_token_with_message_protection_service_policy

  • Now go back to owc_discussions again and select OWCDiscussionsServicePublic and attach the policy oracle/wss11_message_protection_service_policy

  • Now go to the service configuration to edit the values of discussion server connection as below:

  • Edit discussion connection and select message protection policy as shown below

  • Orakey is an alias from the certificate you generated in keystore see next section below

Generate certificate in keystore

  • Go to EM console => select keystore as shown below:

  • Create a stripe name OWSM and create a keystore with a name keystore as shown below:


  • select keystore and click on manage and generate new keypair and give the alias name as orakey.


  • Restart all the servers and its done.

Oracle SOA 12c: Error while deploying soa composite using maven : error: javax/el/ELContext

Today I was working on the Build automation for Oracle SOA 12c and configure the maven and Hudson tool for Continuous Integration. After configuring the maven on my local machine , I tried to compile the soa project but I was getting the following error:

"you may getting el context error while building soa project"
i.e. java.lang.NoClassDefFoundError: javax/el/ELContext

Solution

This problem can be solved by adding EL context dependency in maven plugin

Go to oracle maven home repository folder i.e.

$M2_HOME/repository/com/oracle/soa/plugin/oracle-soa-plugin/12.2.1-0-0 

open the oracle-soa-plugin-12.2.1-0-0.pom in any editor and add the following dependency


<dependency>
    <groupId>javax.el</groupId>
    <artifactId>javax.el-api</artifactId>
    <version>3.0.0</version>
  </dependency>

save the file and try to compile the soa project again.

Wednesday, June 8, 2016

Weblogic 12c: start and stop script for starting weblogic admin and managed server

As in my previous blog post I share the concept of starting and stopping nodemanager. In this blog post I am going to show you how you can start and stop weblogic admin server and managed server using admin server connection.

Start scripts for admin server and managed server

Well the basic logic to start admin and managed server is as:

  • Start the admin server using ./startWeblogic.sh script stored at the domain directory.
  • check for the admin server status is running or not by using same way as did for nodemanager in this post. But here we check for the string "RUNNING"
  • After admin started we invoke to start all the managed server cluster (all the server in a cluster will automatically start).
Here is the script:


rm -rf  *_Server.out AdminServer.out

tfile="AdminServer.out"

cd $DOMAIN_HOME
nohup ./startWebLogic.sh > AdminServer.out &

AdminStatus="STOP"

while [ "$AdminStatus" = "STOP" ]; do
                echo $tfile

                count=$(cat $tfile | grep "RUNNING" | wc -l)

echo "The value of count is ${count}"

                if [[ "$count" -gt 0 ]]; then
                        echo "AdminServer Started..."
AdminStatus="RUNNING"
nohup $WEBLOGIC_HOME/common/bin/wlst.sh startOSB.sh > OSB_Server.out &
                        nohup $WEBLOGIC_HOME/common/bin/wlst.sh startSOA.sh > SOA_Server.out &
                        nohup $WEBLOGIC_HOME/common/bin/wlst.sh startWSM.sh > WSM_Server.out &

                        rm -f $tfile
                        exit 0
                else
                    echo "Waiting For AdminServer To Start..."
                        
                fi
        sleep 5s
        done


echo "Please check ${tfile} log file for more issues"
exit 1 

In the above scripts I am calling three more scripts which are used to start the managed server cluster.

startOSB.sh

Content of the script is as follow:

connect('weblogic', 'welcome1', 't3://adminhostname:port')

start('bpm_osb_cluster','Cluster')

disconnect()

startSOA.sh

Content of the script is as follow:

connect('weblogic', 'Oracle123', 't3://adminhostname:port')

start('bpm_soa_cluster','Cluster')

disconnect()

startWSM.sh

Content of the script is as follow:

connect('weblogic', 'Oracle123', 't3://adminhostname:port')

start('bpm_wsm_cluster','Cluster')

disconnect()

Note: you can start the server instead of start cluster, refer this documentation 

Stop scripts for admin and managed server

For stopping managed server scripts first connect to the nodemanager and use the nmkill() method to kill the managed server

nmConnect('weblogic', 'Oracle123', 'prdbpmn01.ebsafrica.com', '5556', 'BPMDomain', '/u02/oracle/config/domains/BPMDomain','ssl')

nmKill('wls_wsm1')
nmKill('wls_osb1')
nmKill('wls_soa1')

nmDisconnect()

exit()

so you have to kill each server because there is no such method available to stop the cluster.

After that stop the admin server using this script.

nohup sh /u01/oracle/config/domains/BPMDomain/bin/stopWebLogic.sh &

Weblogic 12c: start and stop script for nodemanager

Recently I was working on the automated script to start and stop the nodemanager, AdminServer and all managed server (ESS, SOA, OSB, WSM) in a domain. So in this post I am going to share my work, it may be possible that these scripts may not be suited for your environment but yes It must give you a basic idea of how to start and stop nodemanager automatically.

Start scripts for nodemanager

Well the basic logic that I used to start the nodemanager is

  • check if nodemanager is running or not
  • start the nodemanager and take the output in a temporary file.
  • while the nodemanager is starting keep looking for the string "socket listener started on port" in a temporary file. 
  • if the matching string is found that means node manager is started and exit().
rm -rf nodemanage.*

tfile="nodemanage.$$.out"
status= ps -eaf | grep "weblogic.NodeManager" | grep -v grep| wc -l
date=date
echo $status
echo "Node Manager Directory: " $1

if [[ "$status" -eq 0 ]]; then
echo  $date " :Starting Weblogic NodeManager..."
echo $1
nohup $1 > $tfile 2>&1 &

else
echo  $date " :NodeManager is already RUNNING.."
fi

if [ "$?" != 0 ]; then
echo "Command Failed To Execute Properly"
exit 1;
fi

export a=0;
while [ $a -lt 10 ]; do
echo $tfile

count=$(cat $tfile | grep "socket listener started on port" | wc -l)

echo "The value of count is ${count}"                 

if [[ "$count" -gt 0 ]]; then
echo "NodeManager Started..."
rm -f $tfile
exit 0
else
echo "Waiting For NodeManager To Start..."
echo $a
((a++))
fi
sleep 5s
done
echo "Please check ${tfile} log file for more issues"
exit 1

Save the above script in .sh file e.g. startNode.sh. Now to run this script you have to pass the location of the nodemanager i.e.

nohup ./StartNode.sh $DOMAIN_HOME/bin/startNodeManager.sh > nodemanage.out &


Stop script for nodemanager

To stop the nodemanager find the process id of nodemanager instance and kill that process id, here is the script below:

node1=$(ps -ef | grep weblogic.nodemanager | grep config=/u01 | awk '{printf $2}')

kill -9 $node1

Save the above code in the .sh file e.g. stopNode.sh and execute the script as below:

nohup sh StopNode.sh &


In the next post I am going to share the start and stop script for weblogic AdminServer and Managed server.

Thursday, June 2, 2016

Change default /tmp path to other alternate tmp path for middleware installation

Some times when you install middleware component like oracle soa, weblogic etc. then it requires some temp space to extract content and install on the location but there may be case your /tmp directory is full or not having write permissin etc. (in my case there was no space in the tmp directory) you middleware installation stops in between.

Solution:

you can create a new directory as tmp only in some other location (/home/oracle/tmp) and map to the symbolic link of the directory /tmp (previously created).

Command : ln {source} {link}

i.e. ln -s /home/oracle/tml /tmp


Friday, May 13, 2016

Linux: SSH login without password

I was writing the custom shell scripts for starting and stopping the remote server and these scripts required to executed on the remote server itself using ssh. Now but everytime you run ssh command it ask for the password to avoid that I use the public key authentication without the pass phrase (well you should always use the pass phrase from the security perspective).

Steps to configure public key authentication

  • Create ssh public and private keys, i.e. run the command ssh-keygen -t rsa
  • Do not give the pass phrase if you do not want to enter password every time you do the ssh.
  • Add Keys to the server by using the command ssh-copy-id username@hostname
  • Enter the password for first time.
  • now connect the machine using ssh, you will directly connected to the machine without passing the password.

Wednesday, May 11, 2016

OER 12c: Configure oracle enterprise repository to browse and upload file from local system

I was working on the oracle enterprise repository 12.1.3, and trying to upload an asset in oer from my local machine. But in the submit asset window its only showing the file location url i.e. add a file by reference


Steps to configure file upload option

  • Open oer console i.e. http://<host>:<port>/oer in browser, login with admin user.
  • Go to Admin tab -> System Settings -> search for property cmee.server.paths.upload

  • set the location value to upload the file in submission upload directory i.e. /tmp/upload, as shown below

  • Save the setting and go to asset tab and try to create new asset. This time file upload option is visible.