留言板

liferay-mobile-sdk-builder NullPointerException

thumbnail
Genar Codina,修改在7 年前。

liferay-mobile-sdk-builder NullPointerException

Junior Member 帖子: 28 加入日期: 16-4-18 最近的帖子
I am using:
liferay-mobile-sdk-builder-6.2.0.17
in order to get the custom services deployed in a Liferay 6.2 CE Server.

That server has the following public address:

http://212.36.85.172/api/jsonws

in the previous address it is possible to see that the "Context Path" contains several portlets, and the one develped by us is called "Servicio-mobile-portlet"; so, I try to create the custom SDK for the methods published by that custom portlet ("Servicio-mobile-portlet").

To create the SDK for iOS I have executed:
./gradlew createModule -P=all --debug --info
and then I have introduced the following information:

Context:Servicio-mobile-portlet
Platforms:ios
Server:http://212.36.85.172:80
Filter:
Portal Version:62
Module Version:1.0


And then I have got the following error:

Module was successfully created at /Users/genarcodina/develop/DaVinci/liferay-mobile-sdk-builder-6.2.0.17/modules/Servicio-mobile-portlet/.
SDK Builder will generate now all services with the details you provided.
:createModule (Thread[main,5,main]) completed. Took 3 mins 26.902 secs.
:generate (Thread[main,5,main]) started.
:generate
Executing task ':generate' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
Starting process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java''. Working directory: /Users/genarcodina/develop/DaVinci/liferay-mobile-sdk-builder-6.2.0.17 Command: /Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -cp /Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.velocity/velocity/1.7/2ceb567b8f3f21118ecdec129fe1271dbc09aa7a/velocity-1.7.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.velocity/velocity-tools/2.0/69936384de86857018b023a8c56ae0635c56b6a0/velocity-tools-2.0.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.json/json/20140107/d1ffca6e2482b002702c6a576166fd685e3370e3/json-20140107.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/com.github.ithildir/liferay-sdk-builder-windows/6.2.0.4/1e8b90dbb273cd153dc134163cb270593560f7d1/liferay-sdk-builder-windows-6.2.0.4.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/com.liferay.mobile/liferay-sdk-builder-sample/6.2.0.2/6f3c441ac0a581c4eab7ef1b41d0f0710c3012a5/liferay-sdk-builder-sample-6.2.0.2.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpclient/4.2.5/666e26e76f2e87d84e4f16acb546481ae1b8e9a6/httpclient-4.2.5.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-collections/commons-collections/3.2.1/761ea405b9b37ced573d2df0d1e3a4e0f9edc668/commons-collections-3.2.1.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-lang/commons-lang/2.4/16313e02a793435009f1e458fa4af5d879f6fb11/commons-lang-2.4.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-beanutils/commons-beanutils/1.7.0/5675fd96b29656504b86029551973d60fb41339b/commons-beanutils-1.7.0.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-digester/commons-digester/1.8/dc6a73fdbd1fa3f0944e8497c6c872fa21dca37e/commons-digester-1.8.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-chain/commons-chain/1.1/3038bd41dcdb2b63b8c6dcc8c15f0fdf3f389012/commons-chain-1.1.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-validator/commons-validator/1.3.1/d1fd6b1510f25e827adffcf17de3c85fa00e9391/commons-validator-1.3.1.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/dom4j/dom4j/1.1/690b3108a502c8f033ea87e7278aec309ffa668/dom4j-1.1.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/oro/oro/2.0.8/5592374f834645c4ae250f4c9fbb314c9369d698/oro-2.0.8.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/sslext/sslext/1.2-0/c86a7db4ac0bc450e675f3d44b3d64cdc934361b/sslext-1.2-0.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.struts/struts-core/1.3.8/66178d4a9279ebb1cd1eb79c10dc204b4199f061/struts-core-1.3.8.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.struts/struts-taglib/1.3.8/e87e9817bdf03c2367fb5f6d5ead953db2df4c21/struts-taglib-1.3.8.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.struts/struts-tiles/1.3.8/6d212f8ea5d908bc9906e669428b7694dff60785/struts-tiles-1.3.8.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.4/b1b6ea3b7e4aa4f492509a4952029cd8e48019ad/commons-io-2.4.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/com.liferay.mobile/liferay-sdk-builder/7.0.0/e76bb5416df7236797e3ab4388101a58ace9a498/liferay-sdk-builder-7.0.0.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.2.4/3b7f38df6de5dd8b500e602ae8c2dd5ee446f883/httpcore-4.2.4.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-codec/commons-codec/1.6/b7f0fc8f61ecadeb3695f0b9464755eee44374d4/commons-codec-1.6.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/antlr/antlr/2.7.2/546b5220622c4d9b2da45ad1899224b6ce1c8830/antlr-2.7.2.jar:/Users/genarcodina/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/5043bfebc3db072ed80fbd362e7caf00e885d8ae/commons-logging-1.1.1.jar com.liferay.mobile.sdk.SDKBuilder platforms=ios url=http://212.36.85.172:80 context=Servicio-mobile-portlet filter= packageName=com.liferay.mobile.android portalVersion=62 destination=/Users/genarcodina/develop/DaVinci/liferay-mobile-sdk-builder-6.2.0.17/modules/Servicio-mobile-portlet/
Successfully started process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java''
Exception in thread "main" java.lang.NullPointerException
	at com.liferay.mobile.sdk.SDKBuilder.main(SDKBuilder.java:46)
:generate FAILED
:generate (Thread[main,5,main]) completed. Took 2.652 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generate'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

BUILD FAILED

Total time: 3 mins 42.27 secs
Stopped 0 compiler daemon(s).


So, paying attention on:

Exception in thread "main" java.lang.NullPointerException
	at com.liferay.mobile.sdk.SDKBuilder.main(SDKBuilder.java:46)


I have gone to the source code of "SDKBuilder.java", at line 46; that is:

public class SDKBuilder {

        public static void main(String[] args) throws IOException {
                SDKBuilder builder = new SDKBuilder();

                Map<string, string> arguments = builder.parseArguments(args);

                String[] platforms = arguments.get("platforms").split(",");
                String url = arguments.get("url");
                String context = arguments.get("context");  //This is line 46
                String packageName = arguments.get("packageName");
                String filter = arguments.get("filter");
                int portalVersion = Integer.valueOf(arguments.get("portalVersion"));
                String destination = arguments.get("destination");

                try {
                        builder.build(
                                platforms, url, context, packageName, filter, portalVersion,
                                destination);
                }
                catch (Exception e) {
                        _log.log(Level.SEVERE, e.getMessage(), e);
                }
        }
...</string,>


Line 46 corresponds to:

String context = arguments.get("context");

So, it seems that there is an error trying to get the context (which in my case is "Servicio-mobile-portlet").

I do not know the cause of that error; perhaps the problem is in the way the corresponding .jar/.war files of "Servicio-mobile-portlet" have been generated (however, all the custom services can be seen in a browser in the following url: http://212.36.85.172/api/jsonws)

Any suggestion will be welcomed.

Thanks in advance,
thumbnail
Javier Gamarra,修改在7 年前。

RE: liferay-mobile-sdk-builder NullPointerException

Expert 帖子: 348 加入日期: 15-2-12 最近的帖子
Can you try with the previous release? it's the tag builder-6.2.0.16

It seems to be a bug with the 7.0 support.
thumbnail
Genar Codina,修改在7 年前。

RE: liferay-mobile-sdk-builder NullPointerException

Junior Member 帖子: 28 加入日期: 16-4-18 最近的帖子
Hi,

Thanks for your answer; however I have tried also the version builder-6.2.0.16, but I could not generate the custom mobile SDK (I tried also to use the last version "builder-7.0.0", but without a successful result).

I could try to create a project related to this project and then to debug it.

Thanks,
thumbnail
Mauricio Mariño,修改在7 年前。

RE: liferay-mobile-sdk-builder NullPointerException

New Member 发布: 1 加入日期: 16-9-3 最近的帖子
Hi, it looks like the problem is in the sdk-builder dependencies loading, look at the "sdk-boulder.gradle" file, from line 5 to line 10,


dependencies {
	if (project.parent &amp;&amp; (project.parent.name == 'liferay-mobile-sdk')) {
		builder project(':builder')
	}
	else {
		builder group: 'com.liferay.mobile', name: 'liferay-sdk-builder', version: '6.2.0.+'
	}
}


Remote dependency is loaded: (version: '6.2.0.+') as checking for a local 'builder' project validation fails , it seems that the remote version loaded is wrong, a quick fix is to remove the validation and load local builder project:

dependencies {
		builder project(':builder')
}
thumbnail
Genar Codina,修改在7 年前。

RE: liferay-mobile-sdk-builder NullPointerException

Junior Member 帖子: 28 加入日期: 16-4-18 最近的帖子
Hi Mauricio,

Thanks for your suggestion. You are right, using the changes proposed by you I could finally generate the corresponding files (.zip for iOS and .jar for Android).
Egor Merkushev,修改在7 年前。

RE: liferay-mobile-sdk-builder NullPointerException

New Member 帖子: 2 加入日期: 17-1-27 最近的帖子
Why is this fix not in git? I spent a lot of time to build SDK...
thumbnail
Bruno Farache,修改在7 年前。

RE: liferay-mobile-sdk-builder NullPointerException

Liferay Master 帖子: 603 加入日期: 07-5-14 最近的帖子