Sunday, November 19, 2017

Git clones git


Good morning folks,
And I hope that your morning as beautiful as mine, down there in Naples, Florida. I have found a plausible excuse to skip landscaping: share mine small findings with you.

I'm playing with the Bamboo server for another good story or rather few stories (main characters: SOA 12c, Bamboo, Maven, and Ant) and the very first built has failed with the error:

simple 18-Nov-2017 16:38:24 error: unknown switch 'c'
simple 18-Nov-2017 16:38:24 usage: git clone [options] [--] <repo> [<dir>]
simple 18-Nov-2017 16:38:24 
simple 18-Nov-2017 16:38:24     -v, --verbose         be more verbose
simple 18-Nov-2017 16:38:24     -q, --quiet           be more quiet
simple 18-Nov-2017 16:38:24     --progress            force progress reporting
simple 18-Nov-2017 16:38:24     -n, --no-checkout     don't create a checkout
simple 18-Nov-2017 16:38:24     --bare                create a bare repository
simple 18-Nov-2017 16:38:24     --mirror              create a mirror repository (implies bare)
simple 18-Nov-2017 16:38:24     -l, --local           to clone from a local repository
simple 18-Nov-2017 16:38:24     --no-hardlinks        don't use local hardlinks, always copy
simple 18-Nov-2017 16:38:24     -s, --shared          setup as shared repository
simple 18-Nov-2017 16:38:24     --recursive           initialize submodules in the clone
simple 18-Nov-2017 16:38:24     --template <path>     path the template repository
simple 18-Nov-2017 16:38:24     --reference <repo>    reference repository
simple 18-Nov-2017 16:38:24     -o, --origin <branch>
simple 18-Nov-2017 16:38:24                           use <branch> instead of 'origin' to track upstream
simple 18-Nov-2017 16:38:24     -b, --branch <branch>
simple 18-Nov-2017 16:38:24                           checkout <branch> instead of the remote's HEAD
simple 18-Nov-2017 16:38:24     -u, --upload-pack <path>
simple 18-Nov-2017 16:38:24                           path to git-upload-pack on the remote
simple 18-Nov-2017 16:38:24     --depth <depth>       create a shallow clone of that depth
simple 18-Nov-2017 16:38:24 
error 18-Nov-2017 16:38:24 Checkout to revision 1d00aad94cb91435c7099197965c3ef52828e80d has failed.

Obviously, Bamboo is not happy with the installed git command. So my the first thought was:

Tuesday, October 31, 2017

Michigan Oracle Users Summit 2017

Next week I'm going participate in the Michigan Oracle Users Summit 2017 with the presentation "Scale Oracle WebLogic Server. A Detailed Walkthrough". I hope I'd squeeze a pretty large presentation into the provided time slot. In the rough strokes, I describe scaling options available for the Oracle WebLogic application server, the foundation of the all enterprise-grade Oracle products.
If you are in the vicinity of the conference location, please join us.
All the event details could be found on site: http://mous.us/index.html

Tuesday, September 26, 2017

SOA is so Groovy

Recently, I have tested and debugged Web Service and to automate test & compare cases I've used good ol' Groovy script activity in the SoapUI TestCase. Coincidentally, I've worked on the PoC where SOA Suite standard features don't fit well project terms. Can't say I've dreamed it, rather napped after a lunch break: "What if I can melt SOA and Groovy? There is a lang:groovy element available in the SpringBean activity descriptor". Follow me and I show you how to deliver the modern functional language to your SOA composites.

Saturday, September 02, 2017

SOA 12c JavaScript: Shaken, not stirred

Have you ever faced XML/XPath limitations? I bet you have. Mostly it's related to the string manipulations. Parsing, complex replacements, regular expressions, array transformations, I don't even start about math or anything else, that every modern language has out of the box. In the Oracle SOA world, you are moaning and pull Java Embedded Activity to the process, every time when you need something like that.

Sure you could use Java string operations in XSLT but it means you should create XSLT document for that matter. SOA 12c is a game changer. With the native JSON support, it brings you JavaScript.
The question "Can I use JavaScript with my XML data?" has the answer: " Yes, You can!".

Sunday, August 27, 2017

XPath. One with the clingy attributes


Hi there. Winter is coming, just not today. Because today it's raining cats, dogs and gators; High Florida season is on his way and I have time for the another little trinket. It's based on the same data types we have played around with apples and oranges. It's not exactly related. but I've reused XML Schema to show you a little side effect of the XPath selector. You have run into that if you use strict type validation for each and every activity in your process, but I bet you don't. It's pretty normal to validate data on the edges, in the BPEL case - check the service input and make sure that you produce the response, that composite's clients expect to have.

 This minimalistic composite has only a few steps, but can simulate behavior we need:

  • Check Incoming XML document (using partner link property)
  • Perform XPath query by attribute value
  • Validate output  variable
  • Return response
The one truly interesting activity here is the assign SetResponse. Let's take a look into source code:
<assign name="SetResponse">
<copy>
 <from>
  <literal>
   <GroceryList xmlns="http://mmikhail.com/sample/xml/Orchard">
    <Item Name="Apples" Type="bushel">1</Item>
    <Item NMame="Pears" Type="pound">4</Item>
   </GroceryList>
  </literal>
 </from>
 <to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">$VariableWitthAttributes</to>
</copy>
<copy>
 <from>$VariableWitthAttributes/ns2:Item[@Name="Apples"]</from>
 <to expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">$outputVariable.payload/client:response</to>
</copy>
</assign>

Activity populates variable with the array of the element Item. You can select Item from the list either by index or by attribute name. That's exactly what the second copy does.  It selects Item value with the attribute Name equal to "Apples". Nothing fancy so far, good old XPath expressions and assignments. The CheckOutput activity validates output message against XML Schema.  It's a string and we do not expect any traps here. Le'ts compile, deploy and test the process.

Ouch, validation failed with the error message:

<bpelFault>
 <faultType>0</faultType>
 <invalidVariables xmlns="http://docs.oasis-open.org/wsbpel/2.0/process/executable">
  <part name="summary">
   <summary>Failed to validate bpel variable.
Validation of variable outputVariable failed.
The reason was: Attribute 'Name' not expected.
Please handle the exception in bpel.</summary>
  </part>
 </invalidVariables>
</bpelFault>

And if you check the assign activity you'll see that all element attributes have traversed to the target variable. I bet it's not exactly what you have expected to see, but you do and it's the same for 12c and 11g. The solution is quite simple, just slightly modify selector for instance:

 <from>string($VariableWitthAttributes/ns2:Item[@Name="Apples"])</from>

Now composite works exactly as expected.

It looks like nothing, but think about it:
You have selected something by one attribute, but in fact, you have exposed not only this one but all of them and they may contain some sensitive information, like dates, user names, entity IDs and so on.
Hope it will help you to build more reliable and secure applications. Good luck with that.



Tuesday, August 22, 2017

Ant: instant property file


Good time of the day my patient readers. Yesterday among the millions I saw the second big solar eclipse in my life. The first one I've watched through the soot-covered glass, this one I observed one through the DVR-R disk. The benefits of the progress as they are, aren't they?

Today I'm going show you a little workaround for the situation when you need a property file, but you can't afford it or don't want to keep sensitive information in the plain-text file on the file system. I have run into such issue with the SOA test automation. Oracle offers a set of the Ant tasks for the build, deploy, and test composites. Although, test task requires JNDI properties in form of the property file.

You could create such files one for every target environment, but I foresee without a crystal ball your administrators and security team will be quite unhappy with that. I have tried to substitute the properties from the file, but it doesn't work at all. Test task still wants to read property file.
The next my thought was: if I can't store the file, but I need one, what if I create one at run-time and drop it when the task is completed. So there are such Ant commands and it works with the SOA automation just fine.

<!-- create temporary file for the JNDI propeties -->
<tempfile property="jndi.properties" prefix="jndi" 
                  suffix=".properties" deleteonexit="true"/>
      
<!-- Add properties to the temporary file -->      
<propertyfile file="${jndi.properties}">
 <entry key="java.naming.factory.initial"
                   value="weblogic.jndi.WLInitialContextFactory"/>
 <entry key="java.naming.provider.url"
                   value='${test.target.url}/soa-infra'/>
 <entry key="java.naming.security.principal" value="${user}"/>
 <entry key="java.naming.security.credentials" value="${password}"/>
 <entry key="dedicated.connection" value="true"/>
 <entry key="dedicated.rmicontext" value="true"/>
</propertyfile>  

The task tempfile creates a new empty file. You can specify prefix and suffix and some other attributes, Task updates or creates the specified property (jndi.property in the example) with the file name and path as a value. The attribute deleteonexit helps you with the temporary file elimination.Temporary file disappears when the task is done.

The propertyfile task populates our temporary file with the properties. Task writes all its' children entries to the file. Don't forget to check task documentation, it can do country mile more than just store properties in the files.

Now you can use your temporary property file as a parameter for the SOA test tasks or for any other purposes where you need one.

Wednesday, August 16, 2017

Github: unexpected news


It's a great day for me. It's turned out that someone uses my Github repositories.
While ago I've created an Oracle-free version of FOP servlet for Apex application reports. The reason why I've created the code was simple. Naturally, I've blogged all the details and it's one of the most visited publications of mine. At the same time, servlet repository has not been used at all or I used to think so. Now I know that at least one more person, who has found this project useful. Please meet Roger Pilkey, who is so kind that he has adopted my doodles and developed new servlet for the latest Apache FOP version.
After such unexpectable and invaluable input, I have to upgrade project itself.  The major changes are:
  • Project structure has been reconfigured to use with the Apache Maven 
  • JSP page uses the latest FOP code to generate PDF response
  • Lifted index.html (with a brief description and sample form to test application)
  • Updated README.md with some project information. 
I guess it's hard to find the Apex installation with no Oracle REST Database Services installed, but if you are the happy owner of such system - you may find it useful. 

Saturday, July 22, 2017

JSON in DB 12c: One more reason to upgrade

If you have not upgraded your Oracle database to the 12c version or you are considering database for your new project, than check this neat feature of the Oracle Database 12c. It may outweigh the competitors.

Wednesday, July 19, 2017

XSLT: Namespace awareness.

This is the short one, I mean it.
If your mapping does not pass the test and you have no  result that you expect to have - check namespaces folks! I'm deadly serious: first check namespaces than start with names, character registers, and syntax. You may save yourself hell lot of the time. 

Friday, July 07, 2017

XSLT. Apples and Oranges.


Believe me or not, I'm not going to compare XSL processors or whining about poor support for XSLT 2.0. Recently I have faced the situation,  where I should merge two property lists and produce combined result. Let's do some shopping and play with the grocery lists. The reasons why I'm writing this post are:

  • SOA 11g/12c supports XSLT 2.0 transformations and you can use all the power of it. 
  • XSLT Mapper is far behind the processor and may eve lie to you with the error messages. 
The example below is a little trinket, but it may save you hours on developing external services for the data transformation. 

Tuesday, July 04, 2017

Apache Maven and SOA 11g. Enable the composite.


Okay everyone, holidays are over and it's time to complete this super long read. If you haven't seen 3 previous posts you may go and check the first one here. Today we will discuss how to enable Maven for the SOA projects. Bad thing - it has a proprietary compiler and there is no Maven plugin at all, good thing the compiler uses Ant tasks to build and deploy Oracle SOA 11g composites. Now we have a plan and our project model should be able to:
  • Compile Java code and package it along with the SOA artifacts. The reason is your composite may use custom Java classes to perform some activities that hard or impossible to implement with the XPath/XQuery/XSLT tools you have. 
  • Test Java code, before build or install, especially if you use JUnit to cover your code. 
  • Build SCA archive with the proper Ant task 
  • Deploy composite archive to the SOA servers.
Rephrasing those steps in the project configuration terms we will talk about:
  • Additional properties for the SOA-specific tasks. 
  • Configure Java compiler and package plugin
  • Configure Ant plugin for Maven 

Thursday, June 29, 2017

Apache Maven and SOA 11g. Configure J2EE Applications

Hello there,
I have selected the shortest night in the year to continue the story of the Apache Maven and Oracle SOA 11g marriage. If you haven't read my previous posts, please check them here. Last time I stopped on the Maven-enabled project. Now I'm going to finish Java/J2EE part and build Enterprise Java Archive (EAR).

Sunday, June 11, 2017

Regular expressions? Check that tool.


I'm playing with the small pet. I'm sure it will not grow big, just a trinket to shake off rust fro the joints. Anyway, I need to develop some sophisticated regular expression, where I'm a total nub.
My good old Notepad++ has regexp plugin, NetBeans has a plugin, and you always could hit  Ctrl+Shift+I and run browser debugger for the same purpose. The thing is, none of it will explain to you what this spell does and why:

,(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)

Hey! we have the internet, and someone has solved the same problem already; just google it.
Behold the ultimate RegEx tool: Regex101.com.


The site is awesome, look at this screen: It's a pro-scale RegeEx IDE.
Explanations, tips, parsing results, code generators for the most common languages, and debugger, Carl! Regex Debugger!

I love this site. 

Sunday, June 04, 2017

Apache Maven and SOA 11g. Configure Web Applications


Hello everyone, have a great any time of the day or night. It's time to continue what I've started here. So far, I haven't described anything useful, but extra efforts to maintain all that Maven configuration. Now it's time to get some perks from the situation. I've decided to start from the J2EE for two reasons: highlight the Maven and JDeveloper compatibility issues and how to address them, and create diversified project model (next post will be all about SOA composites).

Project dependencies

Service does a little bit weirdo function - receive Apache FOP XML as the input string and reply with the generated PDF document as a Base64 string. The project itself isn't relevant and you may use any of yours; Although, you may find a real-life scenario: Your SOA composites receive and prepare some data and you want to deliver it as a PDF report, attached to the email (I'm not going to ask you why you don't consider any report management frameworks).  However, I use this example on purpose to stress unlikeness between Maven and JDeveloper in the library management.
Anyone who uses Oracle JDeveloper knows, to compile code project should be aware where to find dependencies. In the Oracle world answer is simple: Libraries. The library allows you to define a group of files and reuse it on your local workstation. If you want to share your project - the library should come along otherwise, your peers wouldn't be able to build your project. To work with our project you will need 2 libraries as on screenshot below: JAX-WS Web Services is the standard one. the second is the custom library and describes Apache FOP framework on my hard drive.


But if we switch to the Maven world, we also should instruct Maven which libraries are required. In the project model terms, we are talking about dependencies. Project file describes what we need to compile and build the project. Normally I think about dependencies as of horizontal links between projects, and of course, links have directions.   The good news, Maven knows where to get your dependencies and dependencies of the dependencies. You don't need to instruct Maven use the JAX-WS libraries, it will find and include appropriate classes automatically. But let's start from the start and create the project POM first.

Maven mode for the project.

You may find more suitable to create application level model first and instruct wizard to create all the project level files as well. But I prefer go in the opposite direction, moving from the project level to the application. I do it as follow:
  1. Open new item wizard by any convenient way (Ctrl+N for example). 
  2. Select General section from the tree on the left 
  3. Start typing maven in the search field.  
  4. There are several options, Select "Maven POM fro Project" one.
  5. Fill the fields with the values as below, or use your own, but write them down for the future reference.
    1. File name:  pom.xml
    2. Directory: your project directory
    3. Group ID: pdf-print-app
    4. Artifact ID: pdf-print-servlet
    5. Version: 0.0.1-SNAPSHOT
    6. Description: Print PDF Web Service
    7. Packaging:  war
  6. Click Ok button and save the new configuration.
  7. Open the pom.xml file for edit. 
Result file should look like the example below.

<?xml version="1.0" encoding="UTF-8" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>pdf-print-app</groupId>
  <artifactId>pdf-print-servlet</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src/</sourceDirectory>
    <outputDirectory>classes/</outputDirectory>
    <resources/>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>
            1.6
          </source>
          <target>
            1.6
          </target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

Configure Web application 

You may or may not noticed, but there are not enough information to properly build our project. For the first of all, there are no dependencies, the wizard has forgotten to add packaging information to the project. Also, it would be nice to keep our WEB-INF/** files, it's the place where JDeveloper keeps  web.xml and weblogic.xml. Let's take a look at the final pom.xml file and I'll explain all the changes.

<?xml version="1.0" encoding="windows-1252" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>pdf-print-app</groupId>
  <artifactId>pdf-print-servlet</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/fop -->
  <dependencies>
    <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>fop</artifactId>
        <version>2.2</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <resources>
      <resource>
        <directory>${basedir}/public_html/</directory>
        <excludes>
            <exclude>WEB-INF/**</exclude>
        </excludes>
      </resource>
    </resources>
    <sourceDirectory>${basedir}/src/</sourceDirectory>
    <outputDirectory>classes/</outputDirectory>
    <testSourceDirectory>${basedir}/test</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.0.2</version>
        <configuration>
          <source>
            1.6
          </source>
          <target>
            1.6
          </target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
          <warSourceDirectory>${basedir}/public_html</warSourceDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

The first change is <dependencies/> section. I don't use any non-J2EE classes but Apache FOP libraries, so I instruct Maven what should be available to successfully compile classes. The new element here is <scope>. With the scope "provided" I tell "don't bother to include dependencies to the package, it will be provided by the environment".
In the build section, I have specified where to find resources. All the static Web content JDeveloper keeps under public_html folder. But I don't want to include anything under WEB-INF folder, it's a place to keep web application metadata.
The next group of the parameters is:

  • sourceDirectory - Place where to find a source code. If you have more than one source location, you may add them under resources section.
  • outputDirectory - Directory to store your compiled Java code. 
  • testDirectory  -  By default, Maven looking for JUnit test source under src/test/** folder. I prefer to keep it next to the src/ folder and maintain the same package structure. 
The source and output folders are quite similar to the default values, and points to the same location, but the ${basedir}/ suffix changes default behavior. if we keep default value src/  Maven looks for the source code in src/java/**  folders, with the base dir we point to the exact location, so it will find our src/** classes.
And the last but not least,  Maven war plugin configuration. Option warSourceDirectory points to the place where plugin should find and reuse WEB-INF folder (yep, web.xml and weblogic.xml).

Build a Package 

Well, it's time to check if we have configured web application properly. Let's build our web application archive. We are not ready to run our fancy external tools, so we just run it from the context menu:
  1. Select project pom.xml in the Application Navigator.
  2. Right click on the pom.xml and select Run Goal(s)->package


After a while, you should see build result in the Apache Maven log window.














Lucky me, there are no errors.  Time to check if the result meets our expectations.  By default, Maven uses target/ folder to package artifacts. The result on the screenshot looks fine for me. 

It has:
  • Proper directory structure 
  • It doesn't contain any libraries. 
  • Web application descriptors are included. 
You can't deploy this application to the WebLogic, unless you deploy Apache FOP libraries first. Other optios:
  1. Comment Apache FOP dependency scope and rebuild package. All the dependencies will be added.
  2. Follow me and build EAR application with the all libraries placed there.
Enjoy, and have a great weekend. 


Sunday, May 28, 2017

Apache Maven and SOA 11g. Preparing Environment.

Good time of the day, It's time to resume the story of the happy marriage between SOA Studio 11g and Apache Maven.  This post will guide you trough environment configuration. During the process we will go through:

  • JDeveloper 11g extension configuration 
  • WebLogic Maven plugin configuration
  • Plugin and libraries installation. 
  • Configure External tools.
The actual configuration will take much less time than you would read this document because I have prepared scripts for you.  And good news it's lifetime configuration (for your workstation of course). Although, I presume that you have:
  • Oracle SOA Studio 11g (11.1.1.7.0)  installed and configured;
  • Your workstation has Internet access, or at least you have access to extensions and maven repository replicas. 
  • You know you Oracle Fusion Middleware directory name. If you don't it's location where you see folders similar to the screenshot below: 

Configure JDeveloper Extensions

You may have Apache Maven installed on your workstation, especially if you work under Linux and of course, it's the latest greatest one. However we should always keep in mind compatibility, so Let's use Maven, which will work for sure with our JDK and JDeveloper. If you'd make such thing and it will work with the latest maven releases, please let me know. 
Okay, Maven plugin installation is dull:
  1.  Start Oracle JDeveloper
  2. From the main menu select Help -> “Check For Updates …”
  3. In the Source list check  "Open Source and Partners Extensions" 
  4.  Locate and select 2 extensions with the name like  “Developer Preview: Maven*”
  5. Complete installation and restart IDE. 
To validate the installation 
  1.   Open command line window or shell terminal on the Linux box.
  2.  Go to your JDeveloper installation home  (in my case it’s C:\Oracle\Middleware\JDeveloper)
    C> cd \Oracle\Middleware\JDeveloper
  3. Check if you have your maven 2.1 installed and configured:
C:\Oracle\Middleware\jdeveloper>apache-maven-2.1.0\bin\mvn –version
Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
Java version: 1.7.0_55
Java home: C:\Oracle\sqldeveloper.40\jdk\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"

Before you continue with the further configuration, let's check what JRE/JDK is available in your system by default. For me, it's Java 7 and it will not work for SOA projects because default JDK for 11.1.1.7 is JDK 1.6.  You can fix it with the environment variable JAVA_HOME which will point to the JDK from the Oracle Middleware. I prefer change JDK only for the maven script.  Steps are easy:

  1. Go to Maven extension bin folder 
  2.  Copy mvn or mvn.bat file to mvn6 or mvn6.bat (OS-depended)
  3.  Open mvn6 for edit and  add the new line in position 35 or 34:
    JAVA_HOME=C:\Oracle\Middleware\jdk160_24
  4. Save file and retest
    C:>cd \Oracle\Middleware\jdeveloper\apache-maven-2.1.0\bin\
    C>mvn6 --version
    Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
    Java version: 1.6.0_24
    Java home: C:\Oracle\Middleware\jdk160_24\jre
    Default locale: en_US, platform encoding: Cp1252
    OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"
    C:\Oracle\Middleware\jdeveloper>
Worth to notice, that you may create $HOME/.mavenrc for Mac/Linux or %USERPROFILE%\mavenrc_pre.bat for Window and keep all Maven related environment configuration settings there.

Configure WebLogic plugin

For the start, we prepare plugin archive and classes required for the plugin installation. 
Let's start from the session environment configuration:
  1. Set environment variables:

    C:>SET FMW_HOME=C:\Oracle\Middleware
    C:>SET ORACLE_HOME=%FMW_HOME%\JDeveloper
    C:>SET MVN_HOME=%ORACLE_HOME%\apache-maven-2.1.0
    C:>SET WLS_HOME=%FMW_HOME%\wlserver_10.3
    C:>SET JAVA_HOME=%FMW_HOME%\jdk160_24
  2. Generate full client library:
    C:>cd %WLS_HOME%\server\lib\
    C:>%JAVA_HOME%\bin\java -jar %WLS_HOME%\server\lib\wljarbuilder.jar -profile wlfullclient
  3. Generate Maven plugin library:
                C:>%JAVA_HOME%\bin\java -jar %WLS_HOME%\server\lib\wljarbuilder.jar –profile weblogic-maven-plugin
  4. Extract plugin model user jar tool or archiver program like 7-zip. Additional details could be found in Oracle Documentation.  Or just use wls-pom.xml from the script repository. 
  5. Install libraries required by the plugin at runtime:

    C:>%MVN_HOME%\bin\mvn install:install-file -DgroupId=com.oracle.cryptoj -DartifactId=cryptoj -Dversion=1.0 -Dpackaging=jar -Dfile=%FMW_HOME%\modules\cryptoj.jar -DgeneratePom=true
    C:>%MVN_HOME%\bin\mvn install:install-file -DgroupId=weblogic -DartifactId=weblogic -Dversion=10.3.6 -Dpackaging=jar -Dfile=%WLS_HOME%\server\lib\weblogic.jar
    C:>%MVN_HOME%\bin\mvn install:install-file -DgroupId=weblogic -DartifactId=weblogic -Dversion=10.3.6  -Dpackaging=jar -Dfile=%WLS_HOME%\server\lib\wlfullclient.jar 
    C:>%MVN_HOME%\bin\mvn install:install-file -DgroupId=weblogic -DartifactId=webservices -Dversion=10.3.6  -Dpackaging=jar -Dfile=%WLS_HOME%\server\lib\webservices.jar

  6. Install WebLogic Maven plugin:

    C:>%MVN_HOME%\bin\mvn install:install-file -Dfile=weblogic-maven-plugin.jar -DpomFile=pom.xml
  7. Test plugin configuration:
    C:>%MVN_HOME%\bin\mvn  weblogic:help
Successful output should looks like this one:

Configure External Tools. 

JDeveloper Maven extension adds project and application support however, it's bound rather to the project that application. So, I normally create 3 additional external tools, all of them call maven with 3 major goals: clean, build and install. I'll guide you through the first one, Create the rest on your own. 

  1. From the JDeveloper main menu select Tools/External Tools… 
  2. Click on the “New …” button
  3. Select External Program as a tool type
  4. Specify program parameters as below. Don't forget to use substitutions, it will make your tools project unaware.
  5. Click Next button.
  6. Give the caption for the command, ToolTip text and select icon for the command to show.  Maven icons could be found in  ${ide.oracle.dir}\jdev\extensions\oracle.jdeveloper.maven.jar, as on the screenshot below.
  7. Click Next. 
  8. I prefer to have all Maven tools in one click distance and add buttons to the Main Toolbar. Also, don't forget to mark "Save All" as before starts action. 
  9. Save External tool and repeat steps 1-9 for the other Maven goals. 
At this point, you have configured and integrated:

  • SOA Studio 11g with the Maven extension;
  • Apache Maven 2.1 installed with JDeveloper. 
  • Configured local repository with the Weblogic plugin
  • Universal external tools to clean, package and install applications.
Next time I'll show you how to build Web applications with Apache Maven. 

So long and thanks for all the fish! 

Wednesday, May 24, 2017

Mysterious ORAMED-01007 and the lack of the creativity.

I'm still working on the mega posts regarding Maven and SOA Studio 11g, it will be there in few days. Meanwhile, I have run into stupid rather than a mysterious situation. But let's start from the beginning. I have a composite, which gets master-detail records and transforms them to the normalized message using a mediator component. I've created a service with 2 parts request, resulting message, transformation, and yadda-yadda-yadda. Compile, deploy, test  and bada-boom:
<part name="detail">
<detail>ORAMED-01007:[Header variable declaration not valid]Header variable "" not recognized.
Possible Fix:Header variable should be of the format $in.header.<prefix>_<root-elem>.
Fix the header variable.
</detail>
</part>
SOA Studio doesn't give you any clues, the project is compiled and deployed with no single warning. Finally, I have realized where I've been wrong. Look at this picture, and never do like this. If can't find what is wrong with the WSDL definition, check the answer below:

The solution is simple: Do not use "header" as a message part name. Regarding the Oracle documentation, this name is reserved for the SOAP headers access. And you will not figure it out until your component throws a runtime exception.

The moral is simple: name your variables with some creativity, and don't use reserved words in the SOA Composites. 

Wednesday, May 17, 2017

Apache Maven and SOA 11g.

I know it's time to go into the Clouds with the SOA Suite Service or at least upgrade your system to the SOA suite 12c and get all the CI perks out f the box.
Yeah, it sounds great as a sales pitch but in reality, you have good old 11g production system and upgrade project (not upgrade) in the "barely foreseeable future". It doesn't matter you can't use some of the automated techniques today (men, it would be a great improvement for your resume), it does mean you will spend some extra time for the initial application configuration.
Of course, you may google right away "soa 11g maven" and get some results with a bunch of copy-pastes "how to install Maven plugin and compile ADF application".  but I'm going to tell you the whole story in several parts:

Part I:   Preparing environment.
Part II:  Configure web applications
Part III: Configure J2EE applications
Part IV: Configure SOA Composites  

I will update this page with the URLs as soon as parts will be ready. I probably will not describe how to build and deploy ADF applications with Maven. There are documentation and some really great posts around.

Some MAVEN terms

I'm not going to complete with the Community and rephrase what it is and how it works. If you have no exposure with Maven or at least ANT. I would recommend you to stop right there and check Apache Maven Introductions 30 minutes long or the brief one because my descriptions and interpretations will be not exactly canonical. So let's go through some Maven terms:
Remote Repository - Some Service (local replica or global repository) which has descriptions for all available plugins and artifacts. From the SOA world - some service which helps you to find and download missed libraries or MAVEN plugins. In the reality, it's a way more complex set of services and processes, but we will use it as a yet another package manager.
  •  Local repository  - This one is more important, because all environment changes, downloaded libraries, and MAVEN plugins will be stashed here. Th local repository allows us to install our private artifacts and libraries without commits to the global services. Normally local repository resides under $HOME/.m2/repository folder (%USERPROFILE%\,m2\repository for the Windows platforms)
  •  Plugin - The building blocks of the Maven. Any Maven activity is a chin of the plugin(-s) executions. There are 2 types build and reporting plugins, and I will use and describe only building ones. 
  • POM (pom.xml) - Project Object Model is the most important item in the list. It describes the project, project dependencies, plugins and their execution steps.It allows you to tweak default Maven behavior (and we will do it a lot). In few words - POM describes plugins and their actions, which are required to build and install projects (archetypes in the Maven terms). 
  • Lifecycle - Formal name for the goals, targets or actions (pick your one you like). Instruction for Maven to perform some set of actions. For example, when you request clean - maven cleans all the target folders and prepares the project for the further actions. Next activity - compile will clean and compile your project. Next one build cleans, compiles and assembles your project into the package. Like I  said before, in reality, it's the heck of the simplification, but it's all we need to know to use maven with JDeveloper 11g. 

Wednesday, February 01, 2017

GridControl 12c switch repository database to RAC

This post may be useful if you consider scale out Oracle Enterprise Manager Cloud Control 12c with RAC database. Migration to the cluster is quite simple with rconfig utility. You can start with Oracle Database documentation or google for numerous posts about that process. I omit database migration by itself and describe the final steps only. In an ideal world, you always have a source instance and new shiny RAC, but in reality, you may not have enough resources and you have converted database in-place, as I've done?
Well, it means that you can't have both databases up and running at the same time. For my case original single instance repository has become a cluster node, which means OMS is down and emctl utility throws errors and doesn't change the configuration.Here you may find a few steps how to address this issue:
1. Open a new terminal connection and start AdminServer from the command line:
[oracle@host]$$MW_HOME/gc_inst/user_projects/domains/GCDomain/bin/startWebLogic.sh
It will throw a l-o-o-o-t of error messages about JPS database availability. Just keep it going until you 'd have your RUNNING state. Now you should be able to run $OMS_HOME/bin/emctl  normally nd update database connection descriptor using documentation steps. Just use another terminal window to keep AdminServer up and running.
2. OMS configuration doesn't understand format host:port:service, which means you have the only choice for cluster databases: SQL*Net service descriptors. Example for SCAN listeners would look like the sample command below:

[oracle@host]$ $OMS_HOME/bin/emctl config oms -store_rpos_details -repos_conndesc \
"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-listener.your.domain.com)(PORT=1521)))(CONNECT_DATA=(SERVICE=omsservice.yourdomain.com)))"  -repos_user sysman

3. Service Descriptor is the standard SQL*Net format with some limitations (at least on Linux platforms):
  • The descriptor is enclosed in double quotes. 
  • Descriptor shouldn't contain any spaces. 
Return to the first session and stop AdminServer with Ctrl-Break. Now you can start Grid Control as usual, repository connection points to the clustered repository.