Deploy .ear with Ant to WebLogic Server fails - ant

I have build a working Java application which I can succesfully build and deploy to my WebLogic11g server.
I'm automating this process now with Ant.
I can build my application, the builded application works fine when deployed manually. But the deployment trough Ant isn't working.
My Ant file:
<!-- GENERAL -->
<property name="project.dir" value="CustomReportingProvider"/>
<!-- JAR -->
<property name="deploy.dir" value="${project.dir}/deploy"/>
<property name="jar.deploy.dir" value="${deploy.dir}/jar"/>
<property name="jar.classes.dir" value="${project.dir}/classes"/>
<property name="jar.meta-inf.dir" value="${jar.classes.dir}/META-INF"/>
<!-- EAR -->
<property name="ear.meta-inf.dir" value="src/META-INF"/>
<target name="clean">
<delete dir="${deploy.dir}"/>
</target>
<target name="package" depends="clean">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${jar.deploy.dir}"/>
<jar destfile="${deploy.dir}/jar/VSBReportingProvider.jar" basedir="${jar.classes.dir}" includes="**/*/*.class">
<metainf dir="${jar.meta-inf.dir}" includes="*.xml"/>
</jar>
<ear destfile="${deploy.dir}/VSBReportingProvider.ear" basedir="${jar.deploy.dir}" appxml="${ear.meta-inf.dir}/application.xml">
<metainf dir="${ear.meta-inf.dir}" includes="*.xml" excludes="application.xml"/>
</ear>
</target>
<path id="wlappc.classpath">
<fileset dir="C:\Oracle\Middleware10.3.4\wlserver_10.3\server\lib">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="wldeploy" classpathref="wlappc.classpath" classname="weblogic.ant.taskdefs.management.WLDeploy"/>
<target name="deploy" depends="package">
<wldeploy action="deploy"
name="VSB Reporting Provider"
source="${deploy.dir}/VSBReportingProvider.ear"
user="weblogic"
nostage="true"
password="weblogic1"
verbose="true"
adminurl="t3://localhost:7001"
targets="AdminServer"
debug="true"/>
</target>
The response: http://pastebin.com/x0En9WtA
It keeps saying it can not connect to the server, so I checked the following:
weblogic / weblogic1 account works.
AdminServer is running, can log-on to it.
The 'Enable tunneling' option is enabled.
The same application can be installed trough the web console.
Any help or idea on where to look, would be appreciated.

I find an answer on the Middleware Magic site:
Then please make sure to add "wlfullclient.jar" at the beginning of the CLASSPATH in your >ANT Script...Also please refer to http://forums.oracle.com/forums/thread.jspa?threadID=2188580&tstart=0 - See more at: http://middlewaremagic.com/weblogic/?tag=deploy#sthash.rTLTxQK3.dpuf
see http://middlewaremagic.com/weblogic/?tag=deploy

I figured it out.
I'm working on a Windows 7 machine and was using a linux command-line tool. I don't know the reason, but the linux console wasn't showing all my environment variables, as it couldn't find or read them, I don't know.
All works fine when I deploy from Windows CMD.

Related

Generating HTML report of testcases results in SoapUI

I have an testsuite of API testing in SOAP UI.
I want an HTML report of testcases results. I am using basic SOAP UI version. Give me a solution apart from SOAP UI Pro.
Yes, it is possible to generate Junit Style HTML reports using SoapUI Opensource Edition as well.
All you need to do is the execution of tests has to be done
use Apache-Ant software, more details on installing and configuring here
write build script
Here is the sample build script(build.xml):
Note that modify the SOAPUI_HOME(or define environment variable), soapui project file path, results directory path according to your environment.
<project basedir="." default="testreport" name="ant script for testing soapui project">
<property environment="env"/>
<property name="soapui.project" value="/app/demo-soapui-project.xml"/>
<property name="results.dir" value="/tmp/results"/>
<property name="reports.dir" value="${results.dir}/Reports"/>
<property name="html.dir" value="${reports.dir}/html"/>
<target name="execute.project">
<exec dir="${env.SOAPUI_HOME}" executable="testrunner.sh">
<arg line="-raj -f ${results.dir} ${soapui.project}" />
</exec>
</target>
<target name="testreport" depends="execute.project">
<mkdir dir="${reports.dir}"/>
<junitreport todir="${reports.dir}">
<fileset dir="${results.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${html.dir}" />
</junitreport>
</target>
</project>
and execute following command (run soapui project and generate report):
ant
There is also simple way (i.e., every thing configured and readily available envrionment) if you are willing to use this docker image.
Short video also available there on how to.

Apache tomcat server 7.0.42 fails to start after running ant build script

I am using apache ant 1.9.4. I have written build xml for starting apache tomcat server 7.0.42. But the server closes as soon it gets started. Also the build is showing successfull.
My build.xml is.,
<property name="build.dir" value="aar" />
<property name="deploy-location" value="D:\EIT SOFTWARES\apache-tomcat-7.0.42_aqar\webapps" />
<property name="catalina.home" value="D:\EIT SOFTWARES\apache-tomcat-7.0.42_aqar"/>
<property name="tomcat" value="${catalina.home}" />
<target name="start-tomcat">
<echo message="Starting tomcat">
</echo>
<exec executable="${catalina.home}\bin\startup.bat"></exec>
</echo>
</target>
What i am making wrong. Ant experts please help me.

ant-builder task not finishing

I'm using worklight 6.2.0.00.20140613-0730 and ant-worklight-builder.jar to build a app.
Most of my build script works except when I try to build my app.
It does something, it generates a native folder for a app and a .wlapp, but only for one environment.
On the ant log I have no error, nor a finished message.
Parts of my build are
<target name="Build App" depends="Stage App">
<app-builder
worklightserverhost="http://server-address:1234"
applicationFolder="${stage.apps.dir}/xpto"
nativeProjectPrefix="xpto"
outputFolder="${build.apps.dir}/xpto"/>
<!-- environments="list-of-environments" -->
</target>
<target name="Stage App" depends="stage.prepare">
<antcall target="regeneratenative.iPad" />
<antcall target="regeneratenative.iPhone" />
<copy toDir="${stage.apps.dir}/xpto" overwrite="true" filtering="true">
<fileset dir="${apps.dir}/xpto" />
</copy>
<copy toDir="${stage.apps.dir}/xpto2" overwrite="true" filtering="true">
<fileset dir="${apps.dir}/xpto2" />
</copy>
</target>
<target name="regeneratenative.iPad">
<delete failonerror="true" dir="${apps.dir}/xpto/ipad/native/"/>
</target>
<target name="regeneratenative.iPhone">
<delete failonerror="true" dir="${apps.dir}/xpto/iphone/native/"/>
</target>
I would expect it to generate the entire environment or at least show me a error.
Does anyone have any idea on what might be happening?
This is probably a environment setup problem as the above code run just fine on a windows box.
On my mac sometimes it hangs up some other times it runs just fine.

Maven-Ant dependency problem

I am trying to make a build file for a Java project in eclipse using Maven and Ant. However, I can't make the maven-ant-tasks dependency work. Can anybody help me on what to do with this? Maybe my URL and file is wrong. Here it is:
<property name="maven.ant.dir" value="http://apache.hoxt.com/maven/binaries"/>
<property name="maven.ant.file" value="http://apache.hoxt.com/maven/binaries/maven-ant-tasks-2.1.3.jar"/>
Here's how the Maven ANT task works
<project .. xmlns:artifact="antlib:org.apache.maven.artifact.ant">
..
<target name="retrieve" description="Retrieve dependencies using Maven">
<artifact:dependencies filesetId="compile.fileset" useScope="compile">
<pom file="${pom.dir}/pom.xml"/>
</artifact:dependencies>
<copy todir="${retrieve.dir}/compile">
<fileset refid="compile.fileset" />
<mapper type="flatten" />
</copy>
..
Documentation is here

Blackberry Apps - Importing a code-signed jar into an application project

I'm working on a library project that Blackberry Java developers can import into their projects. It uses protected RIM APIs which require that it be code-signed, which I have done. But, I can't get my Jar imported and working with a simple helloWorld app. I'm using the eclipse plug-in Blackberry-JDE.
EDIT : Solution found....
since I found the solution I removed the things I've tried, leaving only the solution ...
BUILDING THE SDK/Libary (use BB-ANT-TOOLS, either in eclipse or standalone)
steps:
A) I had to build my SDK's jar as an 'cldc' application not as a 'library'
project, using BB-ANT-TOOLS. This solved most of the issues I had above.
B) I then added an ANT task to take the resulting JAR from step A and
do the following:
unzip it,
edit the manifest file to remove the line "MicroEdition-Profile: MIDP-2.0" -- This line causes an error when you try to mark the jar for export.
then re-zipped the jar.
NOTE: I wrote a chopped down BB-ANT-TOOLS ant script to show how you could use
it to do these two steps above. The script is included below.
Consuming the SDK jar as an end-user or in your own project.
Then to integrate the jar in bb-eclipse you do the following:
A) Add the jar to the BuildPath
B) under "Java Build Path" on the "Order and Export" tab, Select the jar for
export. This causes rapc to build the jar into the COD file, so that you only
have one COD at the end.
now when a user builds this project the jar become integrated into the final
cod file, and it's very easy to deliver to the phone or sim.
<?xml version="1.0" encoding="UTF-8"?>
<project name="XXXXXMobileLib" default="full" basedir=".">
<description>
Description: Builds the BBLIB. Uses bb-ant-tools to build, sign and package for blackberry.
</description>
<taskdef resource="bb-ant-defs.xml" classpath="BIN/BB_ANT_lib/bb-ant-tools.1.x.x.jar" />
<property environment="env" />
<!-- User defined Vars -->
<property name="builderRoot" value="." />
<property name="SIG_PASSWORD" value="XXXXXXXXX" />
<property name="javaHome" value="${env.JAVA_HOME}" />
<echo>${javaHome}</echo>
<property name="jdehome" value="${env.BBJDE_HOME}\" />
<property name="simulator" value="${jdehome}\simulator" />
<property name="bin" value="${jdehome}\bin" />
<property name="releaseBuildOut" value="${builderRoot}\release_out\" />
<property name="srcBuildOut" value="${builderRoot}\srcBuild_out\" />
<property name="JarFixTemp" value="${builderRoot}\.tempZip\" />
<property name="buildVersion" value="${env.BUILD_VERSION}" />
<property name="application_id" value="com.XXXXX.foo.bar.${buildVersion}" />
<property name="application_name" value="XXXXX BBLIB v${buildVersion}" />
<property name="application_desc" value="XXXXX BBLIB v${buildVersion}" />
<property name="application_vendor" value="XXXXX" />
<property name="applicaiton_filename" value="XXXXXBBLIB${buildVersion}" />
<property name="applicaiton_srcs" value="${builderRoot}/src_in_location/" />
<property name="zipOutName" value="XXXXX-${buildVersion}BBLIB.zip" />
<property name="zipOutNameJavadocs" value="XXXXX-${buildVersion}BBLIBjavadoc.zip" />
<property name="jde.home" location="${jdehome}" />
<!--
MAIN ENTRY TARGET.
-->
<target name="full" depends="clean,javadoc,buildRIM,FixJarManifest,sign,distribute" />
<target name="FixJarManifest">
<tstamp/>
<mkdir dir="${JarFixTemp}"/>
<unzip src="${builderRoot}/release_out/${applicaiton_filename}.jar" dest="${JarFixTemp}"/>
<delete dir="${builderRoot}/release_out/${applicaiton_filename}.jar"/>
<!-- For some reason rapc puts this line into the manifest file, but it breaks the JDE plug-in when you try to
set the jar for export. Giving an error like this "Project {0} missing......"
To avoid having an empty line in the manifest, Im just injecting a new attribute BuildTime-->
<replace file="${JarFixTemp}/META-INF/MANIFEST.MF" token="MicroEdition-Profile: MIDP-2.0" value="Build-Time: ${DSTAMP}-${TSTAMP}"/>
<zip destfile="${builderRoot}/release_out/${applicaiton_filename}.jar"
basedir="${JarFixTemp}"
/>
<delete dir="${JarFixTemp}"/>
</target>
<!-- Cleanup any existing files in the outdir -->
<target name="clean">
<delete>
<fileset dir="${releaseBuildOut}" includes="**" />
</delete>
</target>
<!-- Generate the Javadocs -->
<target name="javadoc">
<javadoc access="public" destdir="${releaseBuildOut}/JavaDocs" author="true" version="true" use="true" defaultexcludes="yes" excludepackagenames="net.rim.*" windowtitle="FOO_BAR">
<fileset dir="${applicaiton_srcs}/XXXXXMobileLib">
<include name="src/**/*.java" />
</fileset>
</javadoc>
<zip destfile="${releaseBuildOut}/${zipOutNameJavadocs}" basedir="${releaseBuildOut}/JavaDocs" />
<delete dir="${releaseBuildOut}/JavaDocs"/>
</target>
<target name="buildRIM" description="Builds Project">
<rapc jdehome="${jdehome}" jdkhome="${javaHome}" destdir="${releaseBuildOut}" output="${applicaiton_filename}" quiet="false">
<!-- Building as a cldc applicaiton, so it can be packaged up with our final cod, as a single cod -->
<jdp type="cldc"
title="${application_desc}"
vendor="${application_vendor}"
version="${buildVersion}"
description="${application_desc}"
arguments=""
systemmodule="false"
runonstartup="false"
startuptier="7"
ribbonposition="0">
</jdp>
<src>
<fileset dir="${applicaiton_srcs}/MobileLib">
<include name="src/**/*.java" />
</fileset>
</src>
</rapc>
</target>
<target name="sign" depends="clean,buildRIM">
<sigtool password="${SIG_PASSWORD}">
<fileset dir="${releaseBuildOut}" includes="*.cod" />
</sigtool>
<echo>Contents of the signingtool's logfile: </echo>
<echo file="LogFile.txt" />
</target>
<!-- build and distribute the jar -->
<target name="distribute" depends="buildRIM" description="generate the distribution">
<alx destdir="${releaseBuildOut}" filename="${applicaiton_filename}.alx">
<application id="${application_id}" name="${application_name}">
<codset>
<fileset dir="${releaseBuildOut}" includes="*.cod" />
</codset>
</application>
</alx>
<!-- Create release zip -->
<delete file="${releaseBuildOut}/${zipOutName}" />
<zip destfile="${releaseBuildOut}/${zipOutName}">
<!-- zip up the BB jar and drop it for distribution -->
<zipfileset dir="${releaseBuildOut}" includes="**/*.jar" />
</zip>
<move todir="${releaseBuildOut}/UNUSED_BUILD_OUTPUT_FILES/"><!-- move unwanted files, leaving the zip behind -->
<fileset dir="${releaseBuildOut}">
<include name="**/*.*"/>
<exclude name="**/*.zip"/>
</fileset>
</move>
</target>
</project>
I have used your steps A & B to create a 'library' - thanks.
The latest Eclipse plugin for Blackberry (1.3.0.201102031007-19) has a "Blackberry | Package Project" command. I used this to create the jar file (it put it in a 'deliverables' folder in the project).
I then changed the manifest as you suggest to remove MIDP line (which apparently is a known bug). Finally, I followed the steps to add and deploy the lib to my project. (These, btw, are the same steps to adding the Banner / advertising library - very easy.)
I too have a stand-alone / external build script process that uses bb-ant-tools. I recently added the 'external library jar' feature to accommodate this. But using the new feature in Eclipse makes me question if I need to maintain my command-line build scripts as the GUI now does it for me.
The key for me was to switch the build of my library project to a "Blackberry Application" (e.g. CDLC app) as per your instructions. With it set as a 'Library' I was getting that "eviscerated" error.
Thanks for your post.

Resources