I'm attempting to do a build with sencha cmd on a Sencha Touch 2.1 project (I didn't see an alternate Cmd forum so please let me know if another forum should be used)

When I attempt to run the '<x-sencha-init prefix="" />' task, I keep getting a NullPointerException regardless of the value of prefix I provide.

I am running the build.xml from parent twice removed, where the sencha app is relative at 'MyProject/www'

Any thoughts?

thank you,
Paul

-- full error trace

Code:

BUILD FAILED
java.lang.NullPointerException
at com.sencha.command.ConfigOverrideLoader.loadOverrides(ConfigOverrideLoader.java:139)
at com.sencha.command.ConfigOverrideLoader.getOverride(ConfigOverrideLoader.java:38)
at com.sencha.command.SenchaConfigManager.checkForOverride(SenchaConfigManager.java:173)
at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:166)
at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:57)
at com.sencha.ant.InitTask.doExecute(InitTask.java:35)
at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 1 second

BUILD FAILED
.../build.xml:890: com.sencha.exceptions.BasicException
at com.sencha.exceptions.BasicException.wrap(BasicException.java:43)
at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:26)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NullPointerException
at com.sencha.command.ConfigOverrideLoader.loadOverrides(ConfigOverrideLoader.java:139)
at com.sencha.command.ConfigOverrideLoader.getOverride(ConfigOverrideLoader.java:38)
at com.sencha.command.SenchaConfigManager.checkForOverride(SenchaConfigManager.java:173)
at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:166)
at com.sencha.command.SenchaConfigManager.getConfig(SenchaConfigManager.java:57)
at com.sencha.ant.InitTask.doExecute(InitTask.java:35)
at com.sencha.ant.BaseAntTask.execute(BaseAntTask.java:22)
... 16 more

29 Jan 2013, 1:13 PM

dongryphon

How are you loading sencha.jar in to your script?

In a generated app, to support direct loading from Ant (vs the "sencha ant" wrapper command), we use this logic:

Code:

<!--
Find Sencha Cmd
-->
<target name="find-cmd" unless="cmd.dir">
<!--
Run "sencha which" to find the Sencha Cmd basedir and get "cmd.dir" setup. We
need to execute the command with curdir set properly for Cmd to pick up that we
are running for an application.
-->
<exec executable="sencha" dir="${basedir}">
<arg value="which"/><arg value="-o=$cmddir$"/>
</exec>

The property file produced by "sencha which -o=$cmddir$" looks like this:

Code:

cmd.dir=...

There are other ways to find the sencha.jar depending on your environment, but it appears the code in "x-sencha-init" is relying on "cmd.dir" to be set. That is a bug we should have fixed in Cmd 3.1 (coming soon) but for now try setting "cmd.dir" to the location of the sencha.jar and see if that helps.