This Blog is discontinued, its only read-only

Thursday, July 27, 2017

Check Composite State of Oracle SOA Suite by Command Line

I was currently fighting a bit with the monitoring of Oracle SOA Suite 12c Composites.

The goal was to check the state of deployed Composites on an Oracle SOA Suite 12c with following requirements/dependencies:

  • No Oracle Cloud Control
  • Capture only Active Composites and not Retired Composites
After some discussions with colleagues and a lot of Google and serveral tests with Python Scripts in wlst, I came to following solution:

  • one main Pythin Script, called check_composite_state.py which is checking the State of a non retired given Composite Name for a given Partition|Folder and a given Managed Server
  • one property file called domain.properties which will be used by the Python Script in order to build the required connect string to the Admin Server of the SOA Suite
  • one wrapper Shell Script, which takes the required 3 Arguments (Name of Managed Server, Composite Name and Partition|Folder Name)

Property File domain.properties
# Replace the below given values with your settings
admin.url=wlssoa1:7001
admin.userName=weblogic
admin.password=Oracle12c

Python Script check_composite_state.py
# ============================================================
#
# Script: check_composite_state.py
#
# Author: Dirk Nachbar, http://dirknachbar.blogpost.com
#
# Purpose: Checks the state of a given Composite
#          for Oracle SOA Suite 12c
#
# ============================================================

import sys;
from java.util import Date
from java.text import SimpleDateFormat
from java.io import File
from java.io import FileOutputStream
from java.io import FileInputStream

# Load the WLS Connection Credential and establish the connection
propInputStream = FileInputStream("domain.properties")
configProps = Properties()
configProps.load(propInputStream)
adminURL=configProps.get("admin.url")
adminUserName=configProps.get("admin.userName")
adminPassword=configProps.get("admin.password")
managedServer=sys.argv[1]
compositeName=sys.argv[2]
partitionName=sys.argv[3]

# Initialization of Logfile
f = File('logs/' + compositeName + '.log')
fos = FileOutputStream(f)
theInterpreter.setOut(fos)

# Perform the Connect to the AdminServer of the SOA Suite
connect(adminUserName,adminPassword,adminURL)

domainRuntime()

for n in mbs.queryNames(ObjectName('oracle.soa.config:Location=' + managedServer + ',partition=' + partitionName + ',j2eeType=SCAComposite,name="' + compositeName + '",*'), None):
    RetiredFlag = mbs.getAttribute(n,'Mode')
    if RetiredFlag != 'retired':
        print 'Name: ' + mbs.getAttribute(n, 'Name')
        print 'Mode: ' + mbs.getAttribute(n,'Mode')
        print 'State: ' + mbs.getAttribute(n,'State')


Wrapper Shell Script check_composite_state.sh
In line 13 of the Script, align the Variable OracleHome to your Oracle Home Location
In line 66 of the Script, align the directory location were to find the check_composite_state.py Python Script
#!/bin/bash
# ============================================================
#
# Script: check_composite_state.sh
#
# Author: Dirk Nachbar, http://dirknachbar.blogspot.com
#
# Purpose: Wrapper Script to check the state of a given Composite
#          for Oracle SOA Suite 12c
#
# ============================================================

OracleHome=/data/oracle/product/fmw-soa-12.2.1.2.0

#---------------------------------------------------------------------
Usage()
#
# PURPOSE: Displays the Usage of the script
#---------------------------------------------------------------------
{
cat << EOF
Usage: check_composite_state.sh -s <ManagedServer> -c <CompositeName> -p <Partition|Folder>
       Monitoring script for SOA Suite Composite

Parameters:
   -s: Name of the Managed SOA Server
   -c: Name of Composite to be checked
   -p: Name of Parition | Folder

e.g. check_composite_state.sh -s soa_server1 -c PayPal -p default

EOF
exit 1
}

#---------------------------------------------------------------------
CheckParams()
#
# PURPOSE: Checks the input Parmeter
#---------------------------------------------------------------------
{
    if [ "${ManagedServer}" = "" ] ; then
        echo "ERR: Missing parameter(s), the flags -s must be used."
        Usage
    fi

    if [ "${CompositeName}" = "" ] ; then
        echo "ERR: Missing parameter(s), the flags -c must be used."
        Usage
    fi

    if [ "${Partition}" = "" ] ; then
        echo "ERR: Missing parameter(s), the flags -p must be used."
        Usage
    fi

}

#---------------------------------------------------------------------
CallCheckCompositeState()
#
# PURPOSE: Calls the check_composite_state.py Script
#---------------------------------------------------------------------
{

${OracleHome}/oracle_common/common/bin/wlst.sh /home/oracle/check_composite_state.py ${ManagedServer} ${CompositeName} ${Partition}

}

#---------------------------------------------------------------------
# MAIN
#---------------------------------------------------------------------

ManagedServer=''
CompositeName=''
Partition=''

while getopts s:c:p:h: CurOpt; do
    case ${CurOpt} in
        s) ManagedServer="${OPTARG}" ;;
        c) CompositeName="${OPTARG}" ;;
        p) Partition="${OPTARG}"     ;;
        h) Usage           exit 1    ;;
        ?) Usage           exit 1    ;;
    esac
done
shift $((${OPTIND}-1))

if [ $# -ne 0 ]; then
    Usage
fi

# Check Input Parameters
CheckParams

# Start the Check State of Composite
CallCheckCompositeState

Create the 3 above provided files in one location, align the said Variables and/or directory location and create a subdirectory called "logs" in the directory. Than call the Wrapper Shell Script with following options:
#
# ./check_composite_state.sh -s <Name of Managed Server> -c <Composite Name> -p <Partition|Folder>
# for example:
./check_composite_state.sh -s soa_server1 -c PayPal -p default


Under the directory logs you will find an outfile with naming convention CompositeName.log with the Status of your Composite
cd logs
cat PayPal.log

Connecting to t3://wlssoa1:7001 with userid weblogic ...
Successfully connected to Admin Server "DEVAdminServer" that belongs to domain "dev_domain".

Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

Location changed to domainRuntime tree. This is a read-only tree
with DomainMBean as the root MBean.
For more help, use help('domainRuntime')

Name: PayPal [1.0]
Mode: active
State: on



Happy Composite State Checking ... :-)

Thursday, July 20, 2017

Oracle Forms 12c oracle.security.jps.JpsException Error after Database change

My current huge Oracle Forms 12c Migration Project is still going on and every day we have some new problems.

After the DBA's were moving our Repository Database for the new Oracle Forms 12c environments (without any notice to us ...), nothing were working again on our environment :-)

So the first step, were to stop all processes from our Oracle Forms 12c environment:
  • Reports Server
  • all Managed Servers containing Oracle Reports and Oracle Forms Applications
  • Admin Server
Next step, we aligned the 4 JDBC Connections under $DOMAIN_HOME/config/jdbc in order to point to the new Database Server location:
  • LocalSvcTblDataSource-jdbc.xml
  • opss-audit-jdbc.xml
  • opss-auditview-jdbc.xml
  • opss-datasource-jdbc.xml
After that I tried to startup the Admin Server ... after some seconds the Admin Server stopped directly and in the corresponding logfile of the Admin Server I could find following error message:
<BEA-000362> <Server failed. Reason:
There are 1 nested errors:
oracle.security.jps.JpsException: oracle.security.jps.service.policystore.PolicyStoreException: javax.persistence.PersistenceException: java.lang.ClassCastException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
        at oracle.security.jps.internal.config.OpssCommonStartup.start(OpssCommonStartup.java:215)
        at oracle.security.jps.wls.JpsWlsStartup.start(JpsWlsStartup.java:104)
        at oracle.security.jps.JpsStartup.start(JpsStartup.java:210)
        at oracle.security.jps.wls.JpsDefaultService.start(JpsDefaultService.java:74)
        . . .
        . . .
Caused by: oracle.security.jps.service.policystore.PolicyStoreException: javax.persistence.PersistenceException: java.lang.ClassCastException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
        at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.processJPAException(JpsDBDataManager.java:2658)
        at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.existsTable(JpsDBDataManager.java:1682)
        . . .
        . . .

I verfied once again, if all JDBC Connections were defined correctly and I didn't found any typomistake or error ...

Finally, I came across the configuration files for the Oracle Platform Security for Java Configuration Files jps-config.xml and jps-config-jse.xml under $DOMAIN_HOME/config/fmwconfig. Within these 2 Configuration Files you also have to align the changed Database Server location.

In jps-config.xml go to line 22 and align the following line with your new settings:
# Line 22
<property name="jdbc.url" value="jdbc:oracle:thin:@//dbserver:listener_port/DB_ServiceName"/>

In the jps-config-jse.xml you have to align 2 lines with your new settings, line number 20 and line number 168:
# Line 20
<property name="jdbc.url" value="jdbc:oracle:thin:@//dbserver:listener_port/DB_ServiceName"/>

# Line 168
<property name="audit.loader.jdbc.string" value="jdbc:oracle:thin:@//dbserver:listener_port/DB_ServiceName"/>
After that you can startup your Admin Server and your Managed Servers for your Oracle Forms 12c environment without any problems :-)

Wednesday, July 19, 2017

Oracle Container Registry - First Impressions

After my long holiday, I discovered today that the Oracle Container Registry is now world wide accessible :-) before the Oracle Container Registry were only accessible from USA, Australia and UK.

The Oracle Container Registry contains several types of Docker images:
  • Database: Oracle Enterprise Edition, Oracle Standard Edition and Instant Client
  • Java: Oracle Java SE
  • Middleware: Oracle Coherence, Oracle Tuxedo, Oracle WebLogic Server, Oracle WebTier
  • MySQL: MySQL Community Server
  • OS: Oracle Linux, Container Registry
  • OpenStack: contains currently 95 API's and so on ...
At first you need to access the website https://container-registry.oracle.com , click on the top right to sign in, you will need an OTN Account and follow the registration process.


After you have completed your registration to the Oracle Container Registry just Sign In and you will be directed automatically to following website:


From this point you can get down to Docker Image you are interested, for example the Middleware Section:


Within each Main Section you will find different Repositores, e.g. Oracle Coherence, Oracle Tuxedo, Oracle WebLogic Server and Oracle Web Tier.

When you select a specific Repository, e.g. Oracle WebLogic Server, you will be directed to the Repository Info Page:



On this page you will find various informations about the Repository and informations how to pull the Image, how to create e.g. a WebLogic Domain with an Admin Server and so on.

Let's try it.

# At First Login with your Docker
# to the Oracle Container Registry
din@server> docker login container-registry.oracle.com
Username: xx@xx.xxx
Password: 
Email: xx@xx.xxx
WARNING: login credentials saved in /home/din/.docker/config.json
Login Succeeded

# Now let's pull the Oracle WebLogic Server
din@server> docker pull container-registry.oracle.com/middleware/weblogic
Using default tag: latest

Please login prior to pull:
Username: xx@xx.xxx
Password: 
Email: xx@xx.xxx
latest: Pulling from middleware/weblogic
78a05301de27: Pull complete 
1bd2d038d806: Pull complete 
4b7f2458c2b0: Pull complete 
9b1f6785ca2d: Pull complete 
b83e45ee2903: Pull complete 
Digest: sha256:f42f1a6036e240c32e9438dfba3a883da7f99d10b26a1ca6efe6e0e2f5187af9
Status: Downloaded newer image for container-registry.oracle.com/middleware/weblogic:latest

# Now let's start the Oracle WebLogic Domain
din@server> docker run -d -p 7001:7001 container-registry.oracle.com/middleware/weblogic:12.2.1.1
7cdddadc00d8c60d3f310d98bd5f1f0e35d55c305c97195142849ae2bc02772c

# Wait some minutes and check the Container ID in order
# to grep from the logs the newly generated password
# for the WebLogic Admin User
din@server> docker ps
CONTAINER ID        IMAGE                                                        COMMAND                  CREATED              STATUS              PORTS                    NAMES
7cdddadc00d8        container-registry.oracle.com/middleware/weblogic:12.2.1.1   "/u01/oracle/createAn"   About a minute ago   Up About a minute   0.0.0.0:7001->7001/tcp   condescending_swartz

din@server> docker logs 7cdddadc00d8 | grep password
    Oracle WebLogic Server Auto Generated Admin password: d76074ec
*  password assigned to an admin-level user.  For *

Now you can open your Browser and access the following website http://localhost:7001/console and login with the Username weblogic and the password you retrieved from the above shown docker logs command.



There are some small pain points:

  • The current Release of the Oracle WebLogic Server is only 12.2.1.1.0, so its not the actual latest Release
  • The acceptance of the Oracle Standard Terms and Restrictions are only valid for 8 hours, so if you want to pull something new after one day, you have to get back to the Oracle Container Registry Website and re-accept the Oracle Standard Terms and Restrictions

But nevertheless, the Oracle Container Registry is a great option provided by Oracle to get quickly Docker Images for the main product line without any pain to write your own Docker Build Files.

Additional Note 21st July 2017: The above mentioned 8 hours expiration time of the acceptance of the Oracle Standard Terms and Restrictions is no longer valid, Thanks @MikeRaab for the hint


Tuesday, July 18, 2017

Oracle Forms 12c Java Web Start only shows Splash Screen

I am currently working in a project for migrating several Oracle Forms 11g Applications to Oracle Forms 12c.
One requirement within this project is to use Oracle Forms 12c with Java Web Start in order to get rid of any kind of browser dependencies and to be independent from the classical Java Applet.

The configuration of Java Web Start usage within the formsweb.cfg is really straight forward and simple, just follow the Oracle Documentation.

The first test failed as usual :-) I was copying the jnlp file to my local desktop, got a JDK 1.8.0 Update 121 on my local desktop and run following command from the command line:

cd $JAVA_HOME/bin
./javaws /home/oracle/test_webstart.jnlp


What happened was that just the Java Logo Splash Screen showed up for a second and disappeared ...


Cool, I was trying the same on different laptops, every time the same result.

After some investigations, I found the solution, simply open your Java Control Panel (Windows User: System Control and search for Java / Linux User: start from $JAVA_HOME/bin the binary jcontrol / Mac Users: Open System Preferences and click Java) and click the button "Settings..." under the Section "General / Temporary Internet Files"


Check if the Checkbox in front of "Keep temporary files on my computer." is activated.



Mark the Checkbox in front of "Keep temporary files on my computer.", Click OK and in the Main Java Control Panel click the button "Apply".



Now your Oracle Forms should work as Java Web Start Application :-)