Bugs in ServiceBuilder

There are two bugs in Liferay’s 5.1.2 service builder

  1. The first bug I found is, whenever I setup ext-environment and using service builder to generate service layer without remote service (remote=”false” in service.xml). Liferay generates remoting-servlet-ext.xml file under ext/ext-web/WEB-INF with no beans at all. So generated content only <beans/> tag, since there’s no bean generated. However in ServiceBuilder.java, it always expects </beans> closing tag. This can be seen on line 2171 ServiceBuilder.java

          x = content.indexOf("</beans>");
       

Related error message is like this :

[java] java.lang.StringIndexOutOfBoundsException: String index out of range: -1
[java] at java.lang.String.substring(String.java:1768)
[java] at com.liferay.portal.tools.servicebuilder.ServiceBuilder._createRemotingXml(ServiceBuilder.java:2165)
[java] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:971)
[java] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:390)
[java] at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:157)

To fix this bug, just simply add the following line below those line :

			if(x<0){
				x=content.indexOf("<beans/>");
			}
     

2.  Another bug was found by one member of Liferay’s forum, Alex Wallace. This bug happens when you have ‘service’ word in your package name (package-path) in your service.xml.  This bug is described in this message board’s topic, along with the fix.

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: