Wednesday, May 29, 2013

maven/ant/java export osb config jar from the source files

Maven and ant call eclipse plugin "org.eclipse.equinox.launcher" to export the osb config jar file.

Our project default uses OEPE 11.1.1.4. But I have OEPE 11.1.1.6. I had to adjust a few lines to make it work for me. Here is my final result:

<execution>
<id>compileOSB</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target name="makeosbjar">
<path id="library.osb">
<fileset dir="${OSB_HOME}/modules">
<include name="com.bea.common.configfwk_1.6.0.0.jar" />
<include name="com.bea.core.xml.xmlbeans_2.2.0.0_2-5-1.jar" />
</fileset>
<fileset dir="${MW_HOME}/wlserver_10.3/server/lib">
<include name="weblogic.jar" />
</fileset>
<fileset dir="${OSB_HOME}/lib">
<include name="alsb.jar" />
</fileset>
</path>
<java dir="${OEPE_PLUGINS_HOME}/.." jar="${OEPE_PLUGINS_HOME}/org.eclipse.equinox.launcher_1.2.0.v20110502.jar" classpathref="library.osb" fork="true" failonerror="true" maxmemory="768m">
<!--jvmarg line="-d64" /-->
<jvmarg line="-XX:MaxPermSize=256m" />
<arg line="-application com.bea.alsb.core.ConfigExport" />
<arg line="-data ${project.build.directory}/classes" />
<arg line="-configProject MyOSBConfiguration" />
<arg line="-configSubProjects ${osb.config.project}" />
<arg line="-configJar ${project.build.directory}/${project.artifactId}-${project.version}.jar" />
<sysproperty key="weblogic.home" value="${MW_HOME}/wlserver_10.3" />
<sysproperty key="osb.home" value="${OSB_HOME}" />
<sysproperty key="middleware.home" value="${MW_HOME}"/>
</java>
</target>
</configuration>
</execution>

i have highlighted the changes i made. If you have a different OEPE version, you need to find your corresponding jars for these:

    com.bea.common.configfwk
    com.bea.core.xml.xmlbeans
    org.eclipse.equinox.launcher_1.2.0.v20110502.jar

Additionally, I have Java 1.6.0_31. Although it's 64 bit version, it doesn't support "-d64" option. So i took that out. However, the most important parameter i added in is <sysproperty key="middleware.home" value="${MW_HOME}"/>. That resolved that perplexing error message:
...
Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/SchemaTypeLoader
...

==== post note:

Using java directly:
set classpath=C:\Oracle\Middleware\Oracle_OSB1\modules\com.bea.common.configfwk_1.6.0.0.jar;C:\Oracle\Middleware\Oracle_OSB1\modules\com.bea.core.xml.xmlbeans_2.2.0.0_2-5-1.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\Oracle_OSB1\lib\alsb.jar

set jvmarg=-XX:MaxPermSize=256m -Xmx768m -Dweblogic.home=C:\Oracle\Middleware/wlserver_10.3 -Dosb.home=C:\Oracle\Middleware\Oracle_OSB1 -Dmiddleware.home=C:\Oracle\Middleware

set java_options=-application com.bea.alsb.core.ConfigExport -data D:\proj\osbproj1 -configProject "OSB Configuration" -configSubProjects "OSBProject" -configJar "sbconfig.jar"

java %jvmarg% -jar C:\Oracle\Middleware\oepe11118\plugins\org.eclipse.equinox.launcher_1.2.0.v20110502.jar %java_options%

Here is a full expansion of java command line:

java -XX:MaxPermSize=256m  -Xmx768m  -Dweblogic.home=C:\Oracle\Middleware/wlserver_10.3  -Dosb.home=C:\Oracle\Middleware\Oracle_OSB1  -Dmiddleware.home=C:\Oracle\Middleware  -classpath  C:\Oracle\Middleware\Oracle_OSB1\modules\com.bea.common.configfwk_1.6.0.0.jar;C:\Oracle\Middleware\Oracle_OSB1\modules\com.bea.core.xml.xmlbeans_2.2.0.0_2-5-1.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\Oracle_OSB1\lib\alsb.jar  -jar  C:\Oracle\Middleware\oepe11118\plugins\org.eclipse.equinox.launcher_1.2.0.v20110502.jar  -application  com.bea.alsb.core.ConfigExport  -data  D:\proj\osbproj1  -configProject  "OSB Configuration"  -configSubProjects  OSBProject  -configJar  sbconfig.jar

keep in mind, "-data  D:\proj\osbproj1" points to source directory of your OSB Configuration and OSB project. In this case, i have an "OSB Configuration" project, and an "OSBProject".

No comments:

Post a Comment