Foros de discusión

Liferay Portal 7: Service Builder Broken

thumbnail
Fuad Efendi, modificado hace 9 años.

Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
Hi,

After recent refactoring and moving Service Builder outside of portal-impl.jar it is broken.
I spent many hours on a research but I cannot find the cause.

I added "System.out.println()"


	private void _createModelClp(Entity entity) throws Exception {
		if (Validator.isNull(_pluginName)) {
			return;
		}

		JavaClass javaClass = _getJavaClass(
			_outputPath + "/model/impl/" + entity.getName() + "Impl.java");

		Map<string, javamethod> methods = new HashMap&lt;&gt;();

		for (JavaMethod method : javaClass.getMethods()) {
			methods.put(method.getDeclarationSignature(false), method);
		}

		Type superClass = javaClass.getSuperClass();

		String superClassValue = superClass.getValue();
		
		System.out.println("superClassValue: "+superClassValue);

</string,>


Ant it outputs "java.lang.Object" instead of "BaseModelImpl"

Right now (2015.04.21), "Liferay Plugins" GIT repository is broken, "ant build-service" for sample-service-builder-portlet outputs this:


    [echo] Exception in thread "main" java.lang.NullPointerException
    [echo]     at com.liferay.portal.tools.service.builder.ServiceBuilder._getMethods(ServiceBuilder.java:4490)
    [echo]     at com.liferay.portal.tools.service.builder.ServiceBuilder._getMethods(ServiceBuilder.java:4484)
    [echo]     at com.liferay.portal.tools.service.builder.ServiceBuilder._createModelClp(ServiceBuilder.java:2583)
    [echo]     at com.liferay.portal.tools.service.builder.ServiceBuilder.<init>(ServiceBuilder.java:895)
    [echo]     at com.liferay.portal.tools.service.builder.ServiceBuilder.main(ServiceBuilder.java:305)</init>



It corresponds to the parent class "java.lang.Object" discovery by QDOX. There were almost no changes to this except refactoring.


Do we have JIRA story for this?

Thanks,
thumbnail
Ramalingaiah Dudidmetle, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Expert Mensajes: 486 Fecha de incorporación: 16/08/14 Mensajes recientes
Hi Fuad Efendi,
you have a problem in JAVA 8 not working,
java 8 remove and 7 or 6 install ,
it install java 7or 6 working fine,
i get same error service builder broken in Liferay 6.2

Thanks &Regards
Ram
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
I use Java 7 only
thumbnail
David H Nebinger, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
As well you should, neither java 6 nor java 8 are supported on the L7 milestones.
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
I am talking about current HEAD of "master" branch of both,
https://github.com/liferay/liferay-portal
https://github.com/liferay/liferay-plugins

It is updates daily; there is a bug somewhere which I am trying to fix & or, I would like to know who is going to fix it and how soon.

It is not related to Java version nor Java vendor.


Thanks,
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
Just try to clone "liferay-plugins" from GIT "master" branch, and run "ant build-service" on sample-service-builder-portlet.

Fortunately, I can use ServiceBuilder from Liferay 7 M4 SDK, but I am not sure that generated code will be forward compatible; plus I want(!!!) to know where the problem is.
thumbnail
James Falkner, modificado hace 9 años.

Moved to Milestone Release Feedback category

Liferay Legend Mensajes: 1399 Fecha de incorporación: 17/09/10 Mensajes recientes
Moving to Milestone feedback category. I think this breakage is temporary and will be fixed. The refactoring is still in pretty turbulent waters emoticon
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
I found that nothing wrong with ServiceBuilder; I run provided sample in isolated environment, and it works. Although it needs references to external portal-service.jar, portal-impl.jar, and util-java.jar

I found that this is a bug with build scripts in Liferay Plugins SDK recently introduced (by refactoring ServiceBuilder). Possibly, build-common-plugin.xml is outdated.

This worked for me (with additional JARs in a classpath):


	<taskdef classpathref="service.builder.classpath" resource="com/liferay/portal/tools/service/builder/ant/taskdefs.properties" />

	<target name="build-service">
		<service-builder apiDir="../tmp/api" hbmFileName="../tmp/src/META-INF/portal-hbm.xml" implDir="../tmp/src" inputFileName="service.xml" modelHintsFileName="../tmp/src/META-INF/portal-model-hints.xml" resourcesDir="../tmp/src" springFileName="../tmp/src/META-INF/portal-spring.xml" sqlDir="../tmp/sql" testDir="../tmp/test/integration" />
	</target>


Plus, there are some outdated Jars which are not needed by ServiceVuilder, but still there.

Work-in-Progress emoticon
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
I located the problem, this attribute is missing in build-common-plugin.xml:

<attribute name="service.target.entity.name" default="MyService"/>


"MyService" is dummy temporary PoC; I think whole "build-service" macrodef must be rewritten for new ServiceBuilder.
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
I was partially wrong; we have "liferay-plugins" repository with updated almost daily com.liferay.portal.tools.service.builder.jar, and we also have outdated "build-service" definition in ANT.

If you want to use newest Service Builder right now, then follow example ANT script from Service Builder source distribution, only subset of available parameters listed here:

<!--?xml version="1.0"?-->


<project>
	<path id="service.builder.classpath">
		<fileset dir="../lib" includes="*.jar" />
		<fileset dir="../../../../tools/sdk/dist" includes="com.liferay.portal.tools.service.builder-*.jar" />
	</path>

	<taskdef classpathref="service.builder.classpath" resource="com/liferay/portal/tools/service/builder/ant/taskdefs.properties" />

	<target name="build-service">
		<service-builder apiDir="../tmp/api" hbmFileName="../tmp/src/META-INF/portal-hbm.xml" implDir="../tmp/src" inputFileName="service.xml" modelHintsFileName="../tmp/src/META-INF/portal-model-hints.xml" resourcesDir="../tmp/src" springFileName="../tmp/src/META-INF/portal-spring.xml" sqlDir="../tmp/sql" testDir="../tmp/test/integration" />
	</target>
</project>
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
JIRA Issue Created:
https://issues.liferay.com/browse/LPS-55241

This issue is Windows specific; or any environment using backslash for a path. Perhaps it never happens on Linux.

Contributed solution:
https://github.com/liferay/liferay-portal/pull/712

Thank you!
thumbnail
Shinn Lok, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Junior Member Mensajes: 89 Fecha de incorporación: 14/01/11 Mensajes recientes
Hey Fuad,

Thanks for debugging this and sending us a fix!

I have forwarded your pull request:

https://github.com/brianchandotcom/liferay-portal/pull/26028
thumbnail
Fuad Efendi, modificado hace 9 años.

RE: Liferay Portal 7: Service Builder Broken

Regular Member Mensajes: 180 Fecha de incorporación: 5/04/07 Mensajes recientes
Hi Shinn,

Thank you very much for reviewing & improving the fix; the fix already applied, very fast!