In this blogpost I will show you first, how to do this in a shell script with I run on a linux server and the second part how to do the same with maven.
all demo code is available at github and contains a demo OSB workspace.
First step is to create an configuration setting xml with will be used by the configjar utility
here is an example of a OSB workspace configuration file with all its project and resources
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/ReliableMessageWS"/> <project dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/XSDvalidation"/> <system dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/OSB Configuration"/> </source> <configjar jar="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/export/sbconfig-resources.jar"> <projectLevel includeSystem="true"/> </configjar> </configjarSettings>
and in this case only one project and an separate export for particular system resource
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/ReliableMessageWS"/> <system dir="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/source/OSB Configuration"/> </source> <configjar jar="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/export/sbconfig-rel.jar"> <projectLevel includeSystem="false"/> </configjar> <configjar jar="/home/oracle/projects/soa_tools/maven_osb_ps6_tool/export/sbconfig-rel-system.jar"> <resourceLevel> <resources> <include name="**/*.jndi"/> </resources> </resourceLevel> </configjar> </configjarSettings>
To see all the possible options see this Oracle document page
Next step is to use this setting xml in our shell script.
That's all, this will generate the sbconfig jars but we can also do the same with maven.
The rest of the blog will describe the maven build and deploy.
First we also need to have a setting xml which will be used by maven. The OSB setting file does not support environment variables so I need to use the com.google.code.maven-replacer-plugin maven plugin to replace the tokens.
This is the workspace setting xml ( located in the OSB workspace folder)
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="$WORKSPACE_HOME$/ReliableMessageWS"/> <project dir="$WORKSPACE_HOME$/XSDvalidation"/> <system dir="$WORKSPACE_HOME$/OSB Configuration"/> </source> <configjar jar="$BUILDDIR$/$ARTIFACTID$-$VERSION$.jar"> <projectLevel includeSystem="$OSBINCLUDESYSTEM$"/> </configjar> </configjarSettings>
This is de project setting xml ( located in the OSB project folder)
<configjarSettings xmlns="http://www.bea.com/alsb/tools/configjar/config"> <source> <project dir="$WORKSPACE_HOME$/ReliableMessageWS"/> <system dir="$WORKSPACE_HOME$/OSB Configuration"/> </source> <configjar jar="$BUILDDIR$/$ARTIFACTID$-$VERSION$.jar"> <projectLevel includeSystem="$OSBINCLUDESYSTEM$"/> </configjar> </configjarSettings>
The workspace pom ( located in the OSB workspace folder) , where the path to parent pom is different and the target folder
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>biemond.core.osb</groupId> <artifactId>tool</artifactId> <version>1.0</version> <relativePath>../parent/pom.xml</relativePath> </parent> <groupId>biemond</groupId> <artifactId>osb.source</artifactId> <version>1.5.1-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <buildDirectory>${project.basedir}/../target</buildDirectory> <buildOsbBase>${project.basedir}/../</buildOsbBase> <osbProjectBase>${project.basedir}</osbProjectBase> <osbIncludeSystem>true</osbIncludeSystem> </properties> <scm> <connection>scm:git:git@github.com:biemond/soa_tools.git</connection> <developerConnection>scm:git:git@github.com:biemond/soa_tools.git</developerConnection> <url>https://github.com/biemond/soa_tools/tree/master/maven_osb_ps6_tool</url> <tag>osb.source-1.3.3</tag> </scm> </project>
The OSB project pom ( located in the OSB project folder) , this one is level deeper then the workspace pom.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>biemond.core.osb</groupId> <artifactId>tool</artifactId> <version>1.0</version> <relativePath>../../parent/pom.xml</relativePath> </parent> <groupId>biemond</groupId> <artifactId>osb.source.reliablemessagews</artifactId> <version>1.4.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <buildDirectory>${project.basedir}/../../target</buildDirectory> <buildOsbBase>${project.basedir}/../../</buildOsbBase> <osbProjectBase>${project.basedir}/../</osbProjectBase> <osbIncludeSystem>true</osbIncludeSystem> </properties> <scm> <connection>scm:git:git@github.com:biemond/soa_tools.git</connection> <developerConnection>scm:git:git@github.com:biemond/soa_tools.git</developerConnection> <url>https://github.com/biemond/soa_tools/tree/master/maven_osb_ps6_tool</url> <tag>HEAD</tag> </scm> </project>
Here is the parent pom with the prepare package phase to replace the tokens in the osb setting file, package for making a sbconfig jar and the deploy phase which use the WLST import.py script to deploy it to the server.
Last step is to add some variables to the maven settings.xml, which contains all the WebLogic and OSB variables
At last we can generate some artifacts.
. osb.sh ( sets maven, java environment variables )
mvn package, builds all or 1 project depends on the location in the source folder ( OEPE Workspace )
mvn deploy -Dtarget-env=dev-osb, deploy to the dev OSB server
mvn release:prepare, prepare a release
mvn release:perform -Dtarget-env=dev-osb -DconnectionUrl=scm:git:git@github.com:biemond/soa_tools.git
Here is the url of the demo workspace on github
So, then, the only installation dependency for this is OSB, not OEPE? Does OSB itself still require a X window environment?
ReplyDeleteHi,
Deleteindeed , no need for a OEPE in the middleware home but I never knew or noticed or configured X windows for the export from a workspace.
thanks
One more question: I'm trying to export via ant rather than Maven. I'm basing my work on the configjar-ant.xml document included in the installation, but every time I execute the configjar task, I'm told "The weblogic.home environment variable must be set in order to create OSB config jars."
ReplyDeleteI've been unable to determine how to set or pass this value to the configjar environment. I've tried to set a property with this value, to run the setEnv.sh script before calling ant, and tried to pass it as a xml attribute to the configjar task. Would you happen to know how to pass this property through?
Hi,
DeleteDid you run the env cmd or sh script before you run the ANT script. Plus in ANT task you options like inheritAll and inheritRefs
Thanks Edwin
I have tried running the setEnv.sh script located in the tools/configjar directory, and I've tried runnning the osb_configtool.sh in your repository.
DeleteThe issue I appear to be having is that I cannot seem to pass to the the configjar task the 'JAVA_OPTS="-Dosb.home=$OSB_HOME -Dweblogic.home=$WL_HOME"' needed to run the jar correctly.
I can probably make a straight java call to the jar work, but that defeats the purpose of having the entire configjar taskdef that Oracle provides.
Ok, finally, sorted it out. I needed to manually export JAVA_OPTS from your script as ANT_OPTS for some reason. This seems to have resolved the issue, although, I'd prefer if I could include that in the ant file so I didn't need as much setup work.
DeleteGreat,
DeleteI think ANT starts a new java process which does not inherit these settings, with maven you have something like the settings.xml with profle which contains all the specific environments var and you have a mechanisme to activate a certain profile.
Thanks
If we use Offline Oracle Service Bus Configuration export in 11.1.1.7 to generate sbconfig.jar for 11.1.1.6, will it get deployed in 11.1.1.6 OSB server
DeleteHi,
Deletedon't know but I know there is a version number in the jar. And I know SB checks for it during import. but maybe configjar won't change 11.1.1.6 to 11.1.1.7
you need it to check it out
Thanks
Hi,
DeleteIs there any way we can change .jca property in OSB? The JCA and associated artifact are imported from SOA. We can do it using Config Plan in SOA to search/replace properties in JCA file. But could find the way in OSB.
Your help will be greatly appreciated!
Hi,
DeleteI think you can use the transport action to change the jca properties, or use the customizations file to change it ( don't know if it detects jca properties ).
Thanks
Hi,
DeleteFirst I would like to thank for providing this blog.
Customization file is not detecting jca properties. We actually have 10 jca's and all the time we need to manually change the schema names for all the 10 jca's in 5 Dev env's. Can you please suggest automation for changing JCA properties.
Thanks,
Rajesh
Hi Edwin Biemond,
ReplyDeletefirst like to thank you for providing this article. I learned a lot about OSB deployment.
I'm trying to build a osb project with maven but i'm getting errors to exclude or include resources in my configjar.
I'm using OSB 11.1.16 and the configjar xml is
The error i'm getting is
Do you know anything about the configjar schema for version 11.1.1.6 ?
How can i resolve this problem ?
Thanks!
Hi Edwin Biemond,
ReplyDeletefirst like to thank you for providing this article. I learned a lot about OSB deployment.
I'm trying to build a osb project with maven but i'm getting errors to exclude or include resources in my configjar.
I'm using OSB 11.1.16 and the configjar xml is
The error i'm getting is
Do you know anything about the configjar schema for version 11.1.1.6 ?
How can i resolve this problem ?
Thanks!
Sorry, my version is 11.1.1.7. I still can not create a build.
ReplyDeleteHi,
DeleteI can't see your error or configuration , can you escape the xml.
plus maybe test my sh scripts on github, that should work.
thanks
Hi,
DeleteWith this offline configjar tool we are able to export the sbconfig.jar and it is faster in windows system.
When we use the same pom.xml in linux machine (we are calling this pom.xml from Jenkins) we are seeing slowness of one of two minutes per project.
Is there any tuning parameter, we changed the Min and Max heap size but it didn't help much, for first few projects it was faster after that it is slower.
-Xms256m -Xmx512m -XX:MaxPermSize=128m
We have 50 plus project and if it is going to take 2 minutes per project it's going to take lot of time for building.
Any help with tuning the build process.
Hi,
DeleteI know the first time it generates some (security) files , the second time on the same projects should be much faster ( maybe put the osb generated files outside the workspace ( clean) .
and maybe you can use this on linux -Djava.security.egd=file:/dev/./urandom or change it in the jre security files. Weblogic uses this a lot.
Thanks
Hello,
ReplyDeleteThanks first of all for a marvelous post, the source code you have posted here and on Github has helped me a lot! I ran into one odd thing though, when doing a release the scm plugin (using svn) is not able to resolve the properties in the "env-dev-osb" profile using the "release:perform -Dtarget-env=dev-osb" argument. I had to use mvn "release:perform -Penv-dev-osb" instead to get it to work, a bit strange I think because the activation of profiles using property name and value seems to work everywhere else.
For the record, here is my enviroment:
Maven 3.0.5
Java 1.7.0_21
OS Windows 7
OSB 11.1.1.7
OEPE 1.8.0
WLS 10.3.6.0
SVN 1.7.9
Once a again, thanks for the post!
Friendly regards
Hans Petter
Hi,
DeleteVery strange when it works with deploy
thanks
Do you know how to ensure "At Least Once" pattern in MQ transport of oracle service bus. Need some update on this urgently please. Thanks in advance.
ReplyDeleteHi,
DeleteI think you mean the QoS option of the routing or transport action component.
Thanks
Hi there,
ReplyDeleteI am able to use your code to deploy OSB components, but because a problem occurred in XSD/WSDL validation i have the following error:
com.bea.wli.config.session.SessionConflictException that has 3 categories of error:
Non-Critical
Critical
Info
I want to be able to verify what kind of errors are returned, to decide if the deploy was performed or not; because if i have INFO messges (Informational messages, the deploy is performed), but if i have at least one CRITICAL exception - Resources with validation error for example, the deploy FAILED
Can anyone help me with this? Thank you in advance.
I am getting error " [INFO] BUILD FAILURE
ReplyDelete[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.268s
[INFO] Finished at: Mon Apr 21 19:52:58 PDT 2014
[INFO] Final Memory: 20M/618M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (deafult-cli) on project OSBProject_v1: An Ant BuildException has occured: The settings file is not valid according to its XML Schema.
[ERROR] around Ant part ...... @ 11:102 in /home/GeneralUser/Desktop/OSB/LobbyMonitor_v1/target/antrun/build-main.xml
getting this error when i m doing mvn deploy.
This is my settingsfile.xml
OSBProject_v1
Hi Edwin,
ReplyDeleteWe have the following OSB project structure in OEPE,
we want import only Service(folder i.eErrorHandlingService) by using ant script, it is deploying to root(/) not under the UTIL in sb console(Server).
Is it possible to Deploy only folders with same Structure as in OEPE by scripts? not underneath the root. If i generate the jar file by selecting the resuorces using OEPE i can do it.
UTIL --> (OSB project)
ErrorHandling -->(OSB main folder1)
ProxyFolder
proxyServicePS1
BusinessFolder
BusinessServiceBS1
EmailService --> (OSB main folder2)
ProxyFolder
proxyServicePS2
BusinessFolder(
BusinessServiceBS2
Thanks,
Rajashekhar .
Hi,
ReplyDeleteI was wondering if there is a similar way to remove resources instead of deploying them, I whant to create a configuration that removes the listed files.
Hello,
ReplyDeleteCan someone let me know how we configure eclipse to use Oracle OSB project for 12c version because we wont have separate installer for OSB.
Thanks.