java.lang.NoClassDefFoundError: org.eclipse.core.launcher.Main error while installing an EAR on Webshpere 8.0 - hudson

I am trying to auto deploy an EAR using hudson on Websphere 8.0. I have written a script for it and while executing the script it shows the following error.
I am using hudson and have configured a job which executes the following build.xml. I tried to install the ear generated from admin console of websphere and it works fine when installed manually but fails when trying to install from hudson it throws the above error.
[wsInstallApp] Installing Application [C:\Users\.hudson\jobs\Websphere Deploy\workspace\ESREAR-1.0-SNAPSHOT.ear]...
[wsadmin] Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.core.launcher.Main
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:371)
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:142)
[wsadmin] Caused by: java.lang.ClassNotFoundException: org.eclipse.core.launcher.Main
[wsadmin] at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
[wsadmin] at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:665)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:644)
[wsadmin] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:627)
[wsadmin] ... 2 more
my build.xml is as follows
<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="Auto Deployer for Jenkins" default="deploy" basedir=".">
<!-- Ant-Contrib (if, foreach, etc.) -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="C:/autobuild/WebSphere/Builder/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- WebSphere admin task -->
<taskdef name="wsAdmin" classname="com.ibm.websphere.ant.tasks.WsAdmin" />
<!-- Convert workspace path to forward slashes -->
<path id="toConvert1">
<pathelement location="${workspace}"/>
</path>
<pathconvert dirsep="/" property="workspaceConvert" refid="toConvert1"/>
<property name="wasroot" value="c:/opt/IBM/WebSphere/Profiles/base" />
<property name="user" value="iapawas01" />
<property name="password" value="IAPawas01" />
<target name="install">
<propertyregex property="appname" input="${earfile}"
regexp="([A-Za-z_]*)-(.*)"
select="\1"
defaultvalue=""
override="true"/>
<echo message="Application file ${earfile}"/>
<echo message="Application name ${appname}"/>
<echo message="Uninstalling application" />
<wsAdmin wasHome="${wasroot}" conntype="SOAP" host="${was_soaphost}" port="${was_soapport}" user="${user}" password="${password}" lang="jacl" script="deploy.jacl" failonError="false">
<arg value="uninstall"/>
<arg value="${workspaceConvert}"/>
<arg value="${appname}"/>
<arg value="${earfile}"/>
<arg value="${was_cell}"/>
<arg value="${was_node}"/>
<arg value="${was_server}"/>
<arg value="${was_vhost}"/>
</wsAdmin>
<echo message="Installing application" />
<wsAdmin wasHome="${wasroot}" conntype="SOAP" host="${was_soaphost}" port="${was_soapport}" user="${user}" password="${password}" lang="jacl" script="deploy.jacl" failonError="true">
<arg value="install"/>
<arg value="${workspaceConvert}"/>
<arg value="${appname}"/>
<arg value="${earfile}"/>
<arg value="${was_cell}"/>
<arg value="${was_node}"/>
<arg value="${was_server}"/>
<arg value="${was_vhost}"/>
</wsAdmin>
</target>
<target name="deploy">
<fileset dir="${workspace}" id="earfiles.list">
<include name="**/*.ear"/>
</fileset>
<pathconvert property="earfiles" refid="earfiles.list" pathsep=",">
<map from="${workspace}\" to=""/>
</pathconvert>
<foreach
list="${earfiles}"
target="install"
param="earfile"/>
</target>
</project>

What fix pack are you currently on?
There is a similar defect which was fixed in v8.0.0.3:
http://www-01.ibm.com/support/docview.wss?uid=swg1PM50904
If you're below 8.0.0.3 then you may want to try and apply fix pack 3 or even the latest release (fix pack 9) to see if it helps.

Related

WSO2 API Manager Tool: Unable to convert JSONtoSOAP and then SOAPtoJSON to communicate between mock backend and API

Following the guidelines from WSO2 Documentation at: https://docs.wso2.com/display/AM260/Convert+a+JSON+Message+to+SOAP+and+SOAP+to+JSON
The intended response was
I revised it a couple times but keep getting "400: bad request error"
my curl and the error
EDIT¹: After running tests I found out that the issue is just with the SOAPtoJSON conversion. When I POST without the OUT (SOAPtoJSON) sequence, I get the XML answer exactly as intended as shown here
Thats my JSONtoSOAP.xml:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="JSONtoSOAP" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap12:Body>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>$1</PhoneNumber>
<LicenseKey>$2</LicenseKey>
</CheckPhoneNumber>
</soap12:Body>
</soap12:Envelope>
</format>
<args>
<arg evaluator="xml" expression="//request/PhoneNumber" literal="true"/>
<arg evaluator="xml" expression="//request/LicenseKey" literal="true"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
</sequence>
Thats my SOAPtoJSON.xml:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="SOAPtoJSON" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom" separator=",">
<property name="TRACE" value="Global Mediation Extension"/>
</log>
<payloadFactory media-type="xml">
<format>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>$1</PhoneNumber>
<LicenseKey>$2</LicenseKey>
</CheckPhoneNumber>
</format>
<args>
<arg evaluator="xml" expression="//request/PhoneNumber"/>
<arg evaluator="xml" expression="//request/LicenseKey"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
</sequence>
I'm really new to the technology. And I just followed the steps from the documentation as mentioned. Maybe is was just a silly mistake (even though I revised it several times)
Maybe someone got the same problem and can help me out.
Thanks in advance.
Here is a new feature which generates a REST interface for your SOAP service. Try that. It supports SOAP-REST conversion automatically.
https://docs.wso2.com/display/AM260/Generate+REST+APIs+from+SOAP+Backends

wso2 API Manager - How to publish an API using a template?

I have been experimenting with wso2 API Manager 1.8.0 to expose a back end(http/post) system as a REST API. I am able to get it working, but I had to edit the API configuration through the Service Bus source view as pasted below. I would like to have the same template used for all of the new APIs that get published using API Publisher to ensure that we don't have to edit the service bus source every time an API get created.
Please suggest any options that you may have used..
<inSequence>
<script language="js" key="transform_script" function="buildQueryString"/>
<property name="uri.query" expression="get-property('queryString')"/>
<filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
<then>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('testuser:testuser#1'))"
scope="transport"/>
<send>
<endpoint name="testuser--AddNumbers_APIsandboxEndpoint_0">
<http method="POST"
uri-template="https://testhost:8443/test/http/6731cc67-3850-4b9b-b486-62cf2a664b46?${uri.query}"/>
</endpoint>
</send>
<bam>
<serverProfile name="bam-profile">
<streamConfig name="org_wso2_apimgt_statistics_destination" version="1.0.0"/>
</serverProfile>
</bam>
</then>
<else>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('testuser:testuser#1'))"
scope="transport"/>
<send>
<endpoint name="testuser--AddNumbers_APIsandboxEndpoint_0">
<http method="POST"
uri-template="https://testhost:8443/test/http/6731cc67-3850-4b9b-b486-62cf2a664b46?${uri.query}"/>
</endpoint>
</send>
<bam>
<serverProfile name="bam-profile">
<streamConfig name="org_wso2_apimgt_statistics_destination" version="1.0.0"/>
</serverProfile>
</bam>
</else>
</filter>
</inSequence>
<outSequence>
<payloadFactory media-type="json">
<format>
{
"apiName": "$1",
"apiVersion": "$2",
"runResponse":
{
"runId": "$3",
"runStart": "$4",
"runEnd": "$5",
"flowResponse": "$6",
"flowResult": "$7"
}
}
</format>
<args>
<arg evaluator="xml" expression="get-property('apiName')"/>
<arg evaluator="xml" expression="get-property('apiVersion')"/>
<arg evaluator="json" expression="$.runResponse.runReturn.item[0].value"/>
<arg evaluator="json" expression="$.runResponse.runReturn.item[3].value"/>
<arg evaluator="json" expression="$.runResponse.runReturn.item[4].value"/>
<arg evaluator="json" expression="$.runResponse.runReturn.item[5].value"/>
<arg evaluator="json" expression="$.runResponse.runReturn.item[6].value"/>
</args>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<send/>
</outSequence>
There appears to be some documentation for the older versions of API Manager about the API template under <APIM_HOME>/repository/resources/api-templates/default_api_template.xml file.
With API Manager 1.8.0, I can not find the same documentation page but editing the velocity_template.xml works for non-prototype API definitions.
I am still trying to incorporate my requirements into it.
Actually you want to do some do some transformation for your message. APIM 1.8 supports mediation extension. where you can add your own in,out and fault sequence and have your transformation there. this mediation extension support for globally and per api basis. you can find the details here[1]
so if you create a global level sequence it will be applied to all apis.In your case you have to create one global insequnce to add basic oauth related stuff and one global out sequence to add payload factory related stuff
1.https://docs.wso2.com/display/AM180/Adding+Mediation+Extensions

How to build a SWC with documentation

UPDATE
solved: embed doc with swc
solved: weird param names: param0, param1, etc.
I created a swc lib using compc.
Then I created the lib doc with asdoc.
But I dont know how to bind them together, since when I use the .swc in another project params names are weird (like myMethod(param0:Number)) and there is no doc description.
I'm using Ant, this is my config file:
<?xml version="1.0" encoding="utf-8" ?>
<project name="uil" default="compile" basedir=".">
<property name="flexsdk" location="C:/sdks/flex_sdk_4.6/bin"/>
<property name="compc" location="${flexsdk}/compc.exe"/>
<property name="asdoc" location="${flexsdk}/asdoc.exe"/>
<property name="src" location="../src"/>
<property name="bin" location="../bin"/>
<target name="compile" depends="doc">
<exec executable="${compc}" failonerror="true">
<arg line="-debug=false" />
<arg line="-optimize=true" />
<arg line="-strict=true" />
<arg line="-locale=en_US" />
<arg line="-include-sources=${src}" />
<arg line="-output=${bin}/uil.swc" />
</exec>
</target>
<target name="doc">
<exec executable="${asdoc}" failonerror="true">
<arg line="-main-title 'UIL API Documentation'" />
<arg line="-window-title 'UIL API Documentation'" />
<arg line="-source-path ${src} -doc-sources ${src}" />
<arg line="-output ${bin}/uil-asdoc" />
</exec>
</target>
</project>
Edit: How it was solved
The line that make all the magic is this:
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
Then I replaced all my <exec> tags to <compc> and <asdoc> and everything worked. You can see the entire code here.
Try to use zip ant target as in the build.xml of the Starling framework:
<!-- call asdoc to generate dita xml files -->
<asdoc output="${temp.dir}" lenient="true" failonerror="true" keep-xml="true" skip-xsl="true" fork="true">
<compiler.source-path path-element="${basedir}/src" />
<doc-sources path-element="${basedir}/src" />
</asdoc>
<!-- update swc with asdoc xml -->
<zip destfile="${deploy.dir}/${ant.project.name}.swc" update="true">
<zipfileset dir="${temp.dir}/tempdita" prefix="docs">
<include name="*.*"/>
<exclude name="ASDoc_Config.xml" />
<exclude name="overviews.xml" />
</zipfileset>
</zip>

WSO2 ESB 4.6.0 Get PayloadFactory format from configuration

I am trying to put together a sequence that pulls out properties from an initial request and stores those properties until the response comes back, replace certain regions and send that to another service. I have successfully accomplished this but I want to refine my approach by hosting the payloadFactory format in the registry and reference it using the key attribute within the format tag.
Here is an example of what I want to accomplish: Sajini's Blog
Here is the code I am currently working with:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory>
<format>
<AddEditEmailAddress xmlns="http://tempuri.org/">
<eResponse xmlns:a="http://schemas.datacontract.org/2004/07/NoelGroup.Users.Core.Task.BusinessLayer" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> $1
<Success xmlns="http://schemas.datacontract.org/2004/07/NoelGroup.Users.Task.BusinessLayer">true</Success> $2
</eResponse>
<personId>$3</personId>
</AddEditEmailAddress>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('default','BROKEN_OBJECT')"/>
<arg xmlns:ns="http://org.apache.synapse/xsd" xmlns:a="http://schemas.datacontract.org/2004/07/NoelGroup.Users.Core.Task.BusinessLayer" expression="get-property('default','EMAILS')"/>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('default','PERSON_ID')"/>
</args>
</payloadFactory>
And here is what I desire:
<sequence xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory>
<format key="conf:/User_Sync_Assets/Email_Req.xml"/>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('default','BROKEN_OBJECT')"/>
<arg xmlns:ns="http://org.apache.synapse/xsd" xmlns:a="http://schemas.datacontract.org/2004/07/NoelGroup.Users.Core.Task.BusinessLayer" expression="get-property('default','EMAILS')"/>
<arg xmlns:ns="http://org.apache.synapse/xsd" expression="get-property('default','PERSON_ID')"/>
</args>
</payloadFactory>
This feature will be available in ESB 4.7.0 release.

How to reduce development cycles when building BlackBerry WebWorks or PhoneGap applications?

I'm interested in hearing how WebWorks developers are saving time during their development cycles by using any clever build processes / testing techniques.
What tips & tricks would you recommend to help reduce the amount of time it takes to build & test a WebWorks (or PhoneGap) application?
For example, here's a great suggestion (http://dborba.com/?p=274) from Demian Borba:
Build your app once, but configure it to load its start page from your dev web server
Make changes in that content, and they will be reflected when you re-launch your app (no need to recompile / redeploy the app)
Can even use Livereloader to make it even faster
If you use ant, here some target you will find useful:
<target name="zip" depends="init" description="Archive your files before building the bar" >
<zip
destfile="${build.dir}/${type.name}.zip"
basedir="${basedir}"
excludes="*.project,*.settings/,.*properties,*.svn,*.svn/*, builder/, .gitignore, .git/*"
includes="*,WebContent/"
/>
</target>
<target name="bar" depends="zip" description="create the bar file" >
<exec executable="${bbwp}">
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="${build.dir}/${type.name}.zip"/>
<arg line="-o '${build.dir}'" />
<arg line="-v" />
<!-- Allows debugging on port 1337 -->
<arg line="-d" />
<!-- Sign to Appworld -->
<!-- <arg line="-g ${keyPass} - -buildId 10" /> -->
</exec>
</target>
<target name="install" depends="bar" description="Deploy the the .bar file to your simulator. The old application is automatically uninstalled." >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-installApp" />
<arg value="-launchApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
<target name="uninstall" description="Uninstall an application from the Simulator. " >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-uninstallApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
Here an exemple of the variable for a windows environment:
<property name="password" value=""/>
<property name="simIP" value="169.254.0.1" />
<property name="keyPass" value="" />
<property name="sdk.HOME" location="C:\Program Files\Research In Motion\BlackBerry 10 WebWorks SDK 1.0.1.8" />
<property name="build.dir" location="${basedir}\build" />
<property name="bar.file" location="${build.dir}\device\${type.name}.bar" />
<property name="sdk.JAVA_HOME" location="C:\Program Files\Java\jre6" />
<property name="bbwp" location="${sdk.HOME}\bbwp.bat" />
<property name="BarDeploy.dir" location="${sdk.HOME}\dependencies\tools\lib" />
Blackberry has just released the official Ant build script