Phonegap and Blackberry WebWorks: build\StandardInstall does not exist - blackberry

My environment is Windows XP.
JDK and Apache ant are installed.
Phonegap version is 1.7.0
BlackBerry Webworks SDK for smartphone: version 2.3.1
I'm following the instruction of http://docs.phonegap.com/en/1.7.0/guide_getting-started_blackberry_index.md.html#Getting%20Started%20with%20Blackberry to try phonegap on blackberry.
The sample Blackberry WebWorks sample application I use is this https://github.com/phonegap/phonegap/tree/master/lib/blackberry/sample
First I execute 'ant blackberry build'. Although it said "BUILD SUCCESSFUL", however, neither StandardInstall nor .cod was created. And the output contained error message like this:
[exec] E:\Temp\widgetGen.15924526831337325595265.tmp\extension\blackberry\common\util\URLDecoder.java:183: unclosed string literal
[exec] decodingMap.put( "%AC", "? );
[exec] ^
[exec] 100 errors
[exec] Error!: Error: java compiler failed: C:\Program Files\Java\jdk1.6.0_32\bin\javac.exe #E:\TEMP\rapc_02802fef.dir\options
[exec] [ERROR] RAPC exception occurred
The full build log is here http://www.cis.nctu.edu.tw/~gis90571/a.txt
Then I execute 'ant blackberry load-simulator', it shows:
...
BUILD FAILED
D:\WebWorks_projects\helloworld\build.xml:33: The following error occurred while
executing this line:
D:\WebWorks_projects\helloworld\blackberry.xml:123: D:\WebWorks_projects\hellowo
rld\build\StandardInstall does not exist.
the content of blackberry.xml is:
123: <copy todir="${simulator.dir}">
124: <fileset dir="${build.dir}/StandardInstall" includes="*.cod, *.cso, *.csl, *.alx" />
125: </copy>
(I put the sample app provided by phonegap in D:\WebWorks_projects and changed its name to "helloworld".)
I'm new to ant and blackberry.
Could someone please offer some help or hint? Thanks.
Answer:
It seems that the source file URLDecoder.java in \ext\common\blackberry\common\util is broken due to some encoding issue. Fix it and the problem solved.
An useful article here: http://whatdrewknows.blogspot.com/2012/04/cordova-blackberry-development-part-2.html

Your application is not successfully getting built.
If your application gets build and generate 3 folders
OTAInstall
StandardInstall
widget
As well as one application.zip file is also created.
If you get all these files then your application was successfully compiled and built.

Related

Worklight 6.2 Consumer Edition : Error in deploying worklight applications and adapters

I have build my project through "build-all" Ant Task and I have deployed the war file using the "install" ant task. After Deployment through this I was getting "No Runtime Environment Found" message on the screen. But After removing following JNDI entries in "server.xml" file the browse button appear on the screen:
<jndiEntry jndiName="MyProject/publicWorkLightProtocol" value='http'/>
<jndiEntry jndiName="MyProject/publicWorkLightPort" value='9080'/>
<jndiEntry jndiName="MyProject/ibm.worklight.admin.environmentid" value='WL_UAT_Config1'/>
Following message is also coming above browse button : FWLSE0023E: application 'myProjecy' not found, please redeploy. [project MyProject]
Then I tried to deployed my adapter and application files and Server is giving following errors on console :
[ERROR ] FWLSE0228E: Failed to deploy the application deployable. Reason: null [project MyProject]
[ERROR ] Preparation to deploy 'myProject' failed
java.lang.NullPointerException
[ERROR ] Result: MyProject: WL_UAT_Server///1.2.3.4: ApplicationDeploymentException:java.lang.NullPointerException
[ERROR ] Preparation to deploy adapter '' failed.
Missing xml file
[ERROR ] Result: MyProject: WL_UAT_Server///1.2.3.4: RuntimeException:Missing xml file
However, If I use this "server.xml" file and deploy the war using "deploy-war" ant task. Everything just works fine. Also, if I deploy everything on server through eclipse everything works fine. Let me know if you guys need any more info over this.
The class loader of the project WAR file is not set to parent last
<application context-root="/MyProject" id="MyProject" location="MyProject.war" name="MyProject" type="war">
<classloader commonLibraryRef="worklight-6.2.0">
<privateLibrary>
<fileset dir="${wlp.user.dir}/shared/resources" includes="org.hsqldb.hsqldb_2.2.5.jar"/>
</privateLibrary>
</classloader>
</application>
It should -- see https://www-01.ibm.com/support/knowledgecenter/SSZH4A_6.2.0/com.ibm.worklight.deploy.doc/admin/t_configuring_liberty_profile_manually.html
Ant tasks do install the hsqldb library, which is not listed in the supported software for Worklight http://www-01.ibm.com/support/docview.wss?uid=swg27024838 .... This file was probably crafted manually related to the Worklight Install part.

Blackberry Phonegap load device showing error

I am developing the blackberry phonegap application. I have set all environment required to build the application. I am using command prompt to debug the application when i build the application it build successfully. But while loading the device it causing error as follows.
C:\bbtest>ant blackberry load-device
Buildfile: C:\bbtest\build.xml
blackberry:
load-device:
generate-cod-name:
[echo] Generated name: cordovaExample.cod
clean:
[delete] Deleting directory C:\bbtest\build
package-app:
[mkdir] Created dir: C:\bbtest\build\widget
[copy] Copying 24 files to C:\bbtest\build\widget
[zip] Building zip: C:\bbtest\build\cordovaExample.zip
load-device:
[exec] [INFO] Parsing command line options
[exec] [INFO] Parsing bbwp.properties
[exec] [INFO] Validating application archive
[exec] [INFO] Parsing config.xml
[exec] [INFO] Populating application source
[exec] [INFO] Compiling BlackBerry WebWorks applicatio
n
[exec] [INFO] Starting signing tool
[exec] [INFO] Signing complete
[exec] [INFO] Generating output files
[exec] [INFO] BlackBerry WebWorks application packagin
g complete
[exec] RIM Wireless Handheld Java Loader
[exec] Copyright 2001-2009 Research In Motion Limited
[exec] Connecting to device...debug: HRESULT error during Open: 80040154
[exec] Error: unable to open port
BUILD FAILED
C:\bbtest\build.xml:49: The following error occurred while executing this line:
C:\bbtest\blackberry.xml:53: exec returned: 3
Total time: 53 seconds
C:\bbtest>
Any Idea why this is happing any help would be appreciated.
Its hard to nail down the problem with that information but I suspect you have a problem with "target name" in your xml.
Make sure the load-device is correctly targeted in your blackberry.xml as shown.
<target name="load-device" depends="package-app">
<bbwp code-sign="true" />
<exec executable="${javaloader}" dir="." failonerror="true">
<arg value="-u" />
<arg value="-w${properties.blackberry.sim.password}" />
<arg value="load" />
<arg file="${build.dir}/StandardInstall/${cod.name}.cod" />
</exec>
</target>
Also make sure that your directories are properly set in project.properties.
blackberry.bbwp.dir=C:\\TheBlackBerryWebWorksSDK
blackberry.sim.dir=C:\\TheEclipseBlackBerry\\plugins\\net.rim.ejde.componentpack5.0.0_5.0.0.25\\components\\simulator
blackberry.mds.dir=C:\\TheBlackBerryWebWorksSDK\\mds
I think that you may not have BlackBerry Desktop Manager installed. You can download this from http://uk.blackberry.com/software/desktop/desktop-pc.html
This error is also thrown when using the incorrect deployment command.
In my case I tried to deploy my application to a BB10 device using ant blackberry load-device instead of ant qnx load-device.
Here's a snippet from the documentation:
BlackBerry 10 (QNX) - ant qnx load-device
BlackBerry PlayBook - ant playbook load-device
BlackBerry Smartphone (OS5-7) - ant blackberry load-device
See http://cordova.apache.org/docs/en/2.5.0/guide_getting-started_blackberry_index.md.html

Error preverifying class com.google.common.collect.Ordering in blackberry

I got this error when I included guava-11.0-rc1.jar which contains the package com.google.common.* . But when I try to package it, it gives me the error:
Error preverifying class com.google.common.collect.Ordering MyApp line 0
BlackBerry Packaging Problem
Can anybody tell me what can be done to solve this? Thanks in advance.
Make sure the classes in that library are Java-ME compatible. Remember CLDC is a subset of Java SE and the equivalent desktop compilation level would be 1.2
If they were compatible, then to solve the preverification error you must first preverify your jar. You might be wondering what preverification is. There's a good explanation in this answer.
Preverification is usually done (or should be done) by the Eclipse plugin, but some versions do not. If this is your case, you should do it manually. In your JDE folder, there is a tool called preverify. You could find it in a path that typically looks like this in a Windows machine:
(1) C:\Program files\Research In Motion\BlackBerry JDE <vers>\bin\
You'll also need a library called net_rim_api.jar located in a path like this:
(2) C:\Program files\Research In Motion\BlackBerry JDE <vers>\lib\net_rim_api.jar`
This is all you need to launch the command. Open command line and change dir to the bin folder (1). Then type :
preverify -classpath <classpath for lib> -d <output directory> <file to preverify>
Where:
<classpath for lib> is the path in (2)
<output directory> is the directory where the preverified jar will be saved.
<file to preverify> is the absolute path to the file you want to preverify (guava-11.0-rc1.jar in your case)
If everything went well, now you'll have a new jar in <output directory> which is slightly bigger than the input jar file. This is the one you should include in your project. The preverify tool does not change your original jar.

CruiseControl.net ndk-build on Windows 64bit without Cygwin

Latest Android NDK (version 8) allows to call ndk-build without additional cygwin installed.
My question is: can I plug this into CruiseControl.Net for periodical native build?
I assume that most likely I would need to use Ant as a build method and then add it to ccnet server config.
So the questions are:
How to call ndk-build.cmd from an Ant command
How to configure build.xml file?
I tried several approaches, but all of those failed. Could you give me some clues if it is possible at all?
I ran into the same problem (the CreateProcess failures, etc) when trying to invoke "ndk-build.cmd" directly from build.xml, using CC.net on Windows. I figured out how to get this to work, and so I felt compelled to share my solution.
First, create a 1-line Windows command file as follows (I named it "ndkwrapper.cmd"):
sh ndkwrap.sh %1 %2 %3
Next, create a simple bash shell script as follows (named "ndkwrap.sh"):
#!/usr/bin/sh
# Wrapper around ndk-build script for Windows
#
NDK_PROJECT_PATH=/cygdrive/c/workspace/agnc_android
export NDK_PROJECT_PATH
/cygdrive/c/Android/android-ndk-r8b/ndk-build $1 $2 $3
Of course, your exact paths (for your workspace and NDK directories) may be different, but note, in particular, that "/cygdrive/c" refers to "C:".
One very important step here, after you create the script above, is to convert the line endings from Windows to UNIX. You can do this with a utility called "dos2unix.exe" which is freely available. I don't remember where I got it, but it was part of some open source package of GNU/Linux tools ported to Windows. (Google on "UNIX file utilities for Windows".) If you don't convert the line endings, then sh or bash will have trouble reading the script, and you'll get all kinds of erros about "\r" ...
So, to invoke the equivalent of "ndk-build.cmd clean", for example, you'd type "ndkwrapper.cmd clean" to delete your intermediate and output NDK-related build files, in preparation for a full NDK build.
In your build.xml file for CC.net on Windows, you can invoke the NDK makefile as follows:
<tasks>
<exec>
<executable>cmd.exe</executable>
<baseDirectory>C:\Android</baseDirectory>
<buildArgs>/C ndkwrapper.cmd clean</buildArgs>
</exec>
Hope this helps!
Ben
i observed problems with running ndk-build as an CCNET task as well.
It took me a while, but at the end i noticed, that you have to provide HOST_OS and HOST_ARCH as ndk-build parameters to let it run.
<exec>
<executable>cmd</executable>
<buildArgs>/C ndk-build HOST_OS=windows HOST_ARCH=x86 -B NDK_PROJECT_PATH=[PROJECT] APP_BUILD_SCRIPT=[ANDROIDMKFILE] NDK_APPLICATION_MK=[APPLICATIONMKFILE] NDK_LOG=1</buildArgs>
<buildTimeoutSeconds>120</buildTimeoutSeconds>
</exec>
hope it helps anyone to save time.
Ok I got some progress, I am able to build the jni code via ant or nant but in both cases plugging it to the cc.net server config gives me strane error:
but now CC.net gives me strange errors:
<builderror>
<type>NAnt.Core.BuildException</type>
<message><![CDATA[External Program Failed: G:\\android-ndk-r8b\\ndk-build.cmd (return code was 2)]]></message>
<location>
<filename>G:/MYPath/project.build</filename>
<linenumber>7</linenumber>
<columnnumber>4</columnnumber>
</location>
<stacktrace><![CDATA[ at NAnt.Core.Tasks.ExternalProgramBase.ExecuteTask()
at NAnt.Core.Tasks.ExecTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()]]></stacktrace>
</builderror>
</failure>
<duration>296.40000000000003</duration>
</buildresults>Buildfile: file:///G:/MYPath/project.build
Target framework: Microsoft .NET Framework 4.0
Target(s) specified: build
clean:
[echo] Starting Android ndk CLEAN ...
[exec] Android NDK: Unable to determine HOST_OS from uname -s:
[exec] Android NDK: Please define HOST_OS in your environment.
[exec] process_begin: CreateProcess(NULL, uname -s, ...) failed.
[exec] G:/android-ndk-r8b/build/core/init.mk:131: *** Android NDK: Aborting. . Stop.
BUILD FAILED - 0 non-fatal error(s), 2 warning(s)
My project in cc.net config:
<project>
<name>MY_PROJECT_NAME</name>
<workingDirectory>PATH_TO_MY_PROJECT</workingDirectory>
<tasks>
<nant>
<executable>G:\nant-0.92\bin\Nant.exe</executable>
<baseDirectory>PATH_TO_MY_PROJECT</baseDirectory>
<buildFile>MYPROJECTNAME.build</buildFile>
<buildArgs>build</buildArgs>
<buildTimeoutSeconds>1200</buildTimeoutSeconds>
</nant>
</tasks>
</project>
And my NAnt build file:
<project name="my name" default="build" basedir=".">
<description>My project Build Files.</description>
<target name="clean" description="remove all generated files">
<echo message="Starting Android ndk CLEAN ..."/>
<exec program="G:\\android-ndk-r8b\\ndk-build.cmd" failonerror="true"
basedir="MY PROJECT PATH">
<arg value="clean" />
</exec>
<echo message="Android ndk CLEAN done."/>
</target>
<target name="build" description="remove all generated files" depends="clean">
<echo message="Starting Android ndk BUILD ..."/>
<exec program="G:/android-ndk-r8b/ndk-build.cmd" failonerror="true" />
<echo message="Android ndk BUILD done."/>
</target>
</project>
As I said I can run a Nant.exe for my project and it cleans and build correctly.
It looks like the cc.net tries to run the other ndk-build commend which is used for linux and is missing some commands as uname.
Do you have any idea what cI could be doing wrong ?
The original question is asking about ant builds. This answer is related to a problem in CC.NET and ant and gradle builds are going to be affected in the same way.
We are using gradle and with some custom gradle tasks it is possible to compile the native code of your project as well by calling ndk-build.cmd (from a path that has no spaces in it).
After the gradle file is prepared properly shell initiated gradle builds will work but cc.net initiated builds will fail.
Our CC.NET task is defined as follows:
<exec executable=".\gradlew.bat">
<baseDirectory>$(projSrcDir)</baseDirectory>
<buildArgs>clean assemblePlayRelease assembleProRelease</buildArgs>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
</exec>
The problem is related to a CC.NET bug that causes the shell variable names to be in lower case. Windows shell scripts do not care about the case of shell variable names but because the NDK fires up make variable case becomes an issue. The init.mk make file that is part of the build process relies on shell variable names to identify the host OS type. In particular the shell variable OS. Normally the OS value is defined like this:
OS=Windows_NT
But when the variable is passed to gradle from CC.NET it gets transformed into this:
os=Windows_NT
This causes the detection mechanism in init.mk to fail and tries to execute the unix detection sequence and looks for the Unix uname utility that is not present on Windows resulting in:
Android NDK: Unable to determine HOST_OS from uname -s:
Android NDK: Please define HOST_OS in your environment.
make.exe: Entering directory `D:/CC.NET/svncheckout/pes/src/project/src/main/jni'
make.exe: Leaving directory `D:/CC.NET/svncheckout/pes/src/project/src/main/jni'
And ultimately:
process_begin: CreateProcess(NULL, uname -s, ...) failed.
c:/ndk/build/core/init.mk:160: *** Android NDK: Aborting. . Stop.
FAILURE: Build failed with an exception.
The workaround is less then ideal but it gets the job done. The idea is to edit the ndk-build.cmd and change the case of the passed variables only when we are building from CC.NET.
Simply insert this code after the #echo off line in ndk-build.cmd:
IF DEFINED ccnetproject (
ECHO Applying Environment variable hack for CC.NET.
SET OS2=%os%
SET OS=
REM SET PATH=%path%
SET TEMP2=%temp%
SET TEMP=
)
IF DEFINED ccnetproject (
SET OS=%OS2%
SET OS2=
SET TEMP=%TEMP2%
SET TEMP2=
)
This script first makes temporary copies of values in the lower case OS and TEMP variables. Next it undefines them by clearing their values. An finally the reverse is done.
Two steps are needed because just saying
SET OS=%os%
doesn't do much since scripts are case insensitive. It first locates the OS variable, finds a lower case version and assigns its own value back to itself.
This was tested on CC.NET v1.6.7981.1, gradle v1.1.0 and Android NDK v10 (64bit).

Error using Ant to create EJB after upgrading WAS from 6.0 to 7.0

Ant task breaks at the <wsejbdeploy> tag. The exception message is :
[wsejbdeploy] Error executing deployment: java.lang.ClassNotFoundException.
Error is com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension.
[wsejbdeploy] java.lang.ClassNotFoundException:
com.ibm.etools.ejbdeploy.batch.plugin.BatchExtension
[wsejbdeploy] at java.lang.Class.forName(Class.java:136)
In addition to that, ivy.xml reports problems, but when I inspect it, the messages have no sense (screenshot). I suspect the problems could be:
a) Additional files that I have for the build which conflict with the upgraded Ant (in RSA 7.0 i've had Ant 1.6.5 and RSA 8.0 comes with Ant 1.7.1). Additional files are:
required for ant tasks execution
ant-contrib/ant-contrib.jar
antelope-tasks/AntelopeTasks_3.2.10.jar
antform/antform.jar
antform/defaultStyle.txt
antlr/antlr.jar
checkstyle/checkstyle-4.2.jar
checkstyle/checkstyle-optional-4.2.jar
checkstyle/checkstyle-frames-errors.xsl
clover/clover.jar
clover/cenquatasks.jar
clover/clover.license
doccheck/doccheck-modified.jar
ivy/ivy-20060723172807.jar
jakarta-commons/commons-beanutils.jar
resources/checkstyle/checks-source.xml
resources/checkstyle/checksTransformation.xsl
b) Changes in the Ant regarding EJB build which require some settings to be reconfigured.
c) Something else :)
Except the Error, everything else is a stab in the dark so feel free to ask for any additional info.
The problem was in the additional file needed for wsejbdeploy. In the 6.0 version, you copy wsanttasks.jar and wsprofile.jar from the websphere 6.0 installation folder and then reference it like this
<taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy"
classpathref="all-libs"/>
where "all-libs" is a reference to the folder where you copied the jars. In websphere 7.0 there is no wsanttasks.jar and you must reference the runtime file, eg
<taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy">
<classpath>
<pathelement path="C:/IBM/SDP80/runtimes/base_v7/plugins/com.ibm.ws.runtime.jar" />
</classpath>

Resources