Foros de discusión

service builder not generating content for sql directory

Rico D'Amore, modificado hace 12 años.

service builder not generating content for sql directory

New Member Mensajes: 13 Fecha de incorporación: 29/03/12 Mensajes recientes
Hi,
My question revolves around the service builder. I have written a service.xml file with the intention of connecting to a different db than lportal. However, before I have gotten to the part where I create an ext-spring.xml file and my jdbc.properties file, I'm noticing that my build-services command is creating my WEB-INF/sql directory, but not putting anything in the files within that directory.

Here is the output from my service-builder task execution: I should mention that I'm using the jsf facet for liferay.

[Console output redirected to file:/Users/Rico/Documents/workspace/liferay/.metadata/.plugins/com.liferay.ide.eclipse.sdk/sdk.log]
Buildfile: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/build.xml
build-service:
[echo] Loading jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
[echo] Apr 10, 2012 6:17:24 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
[echo] INFO: Global lib directory /usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/lib/ext/
[echo] Apr 10, 2012 6:17:24 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
[echo] INFO: Portal lib directory /usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/
[echo] 18:17:24,541 INFO [EasyConf:122] Refreshed the configuration of all components
[echo] 18:17:24,933 INFO [ConfigurationLoader:56] Properties for jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal loaded from [jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties, jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties]
[echo] Loading jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
[echo] Loading jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties
[echo] SLF4J: Class path contains multiple SLF4J bindings.
[echo] SLF4J: Found binding in [jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/util-java.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[echo] SLF4J: Found binding in [jar:file:/usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/lib/util-java.jar!/org/slf4j/impl/StaticLoggerBinder.class]
[echo] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
[echo] Building Kid
[delete] Deleting: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/ServiceBuilder.temp
[mkdir] Created dir: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
compile-java:
[copy] Copied 7 empty directories to 4 empty directories under /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
[javac] Compiling 14 source files to /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
[zip] Building zip: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/lib/TagMyVideo-portlet-service.jar
[delete] Deleting directory /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
BUILD SUCCESSFUL
Total time: 11 seconds


As we can see above the sql directory is indeed being created and everything else that service-builder is being done without any trouble. But the files in the WEB-INF/sql directory are empty.

Can anyone comment on this? Here is my service.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE service-builder PUBLIC "-//Liferay//DTD Service Builder 6.1.0//EN" "http://www.liferay.com/dtd/liferay-service-builder_6_1_0.dtd">
<service-builder package-path="com.tagmyvideo.kid">
<author>Rico</author>
<namespace>kid</namespace>

<entity name="Kid"
local-service="true"
remote-service="false"
data-source="myAppDataSource"
session-factory="myAppSessionFactory"
tx-manager="myAppTransactionManager">

<!-- PK fields -->

<column name="kidId" type="long" primary="true" />
<column name="kidFirstName" type="String"/>
<column name="kidLastName" type="String"/>
<column name="kidAge" type="String"/>
<column name="kidEmail" type="String"/>
<column name="dateEntered" type="Date"/>


<!-- Order -->

<order>
<order-column name="kidId" order-by="asc"/>

</order>

<!-- Finder methods -->

<finder name="KidAge" return-type="Collection">
<finder-column name="kidAge"/>
</finder>
</entity>
</service-builder>

Thank you!
thumbnail
David H Nebinger, modificado hace 12 años.

RE: service builder not generating content for sql directory

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Does it work if you take out the undefined data-source, session-factory, and tx-manager beans?
Rico D'Amore, modificado hace 12 años.

RE: service builder not generating content for sql directory (Respuesta)

New Member Mensajes: 13 Fecha de incorporación: 29/03/12 Mensajes recientes
Hi,

No, I tried that just recently, but to no avail. However, I was suspecting that the project was in some way corrupt. I had been messing around with it for hours, and I felt that a fresh project might do the trick.

I created a new project, and before creating the ext-spring.xml, I created the service.xml and ran it. It worked. I have a feeling that I had old corrupt project data somewhere.

So short story is I found a work-around, but I don't know how it became corrupted to begin with. I wonder where I could look for files etc... that could be cleaned. I looked in the plugins directory within the sdk, and didn't find anything, but that by no means is where I was supposed to look. I completely wiped out the old project.

So, good news for the project, bad news for my understanding of how the issue was created (by me)....
Jyothi Rajesh, modificado hace 11 años.

RE: service builder not generating content for sql directory (Respuesta)

New Member Mensajes: 2 Fecha de incorporación: 22/11/12 Mensajes recientes
Hi,

We had a similar problem in our project. We were using a different database than the default one and the tables.sql was being generated as a 0KB file.

Here is what I found out. This is Liferay version 6.0.5 and I am not sure if this has been fixed in 6.1
"ServiceBuilder has a line in the _createSQLTables function as follows:
if (!entity.isDefaultDataSource()) {
continue;
}
"
Since we specify a different dataSource attribute for this entity in the service.xml file, this attribute is set to false for this entity. So, the tables never get generated!!!!

I searched for this quite a lot and then had to rely on the source. I debugged Service Builder when I ran the ant script to build the services and that is when I found this out!

Hope this gets fixed soon!

Thanks and Regards,
Jyothi
thumbnail
suresh yadagiri, modificado hace 10 años.

RE: service builder not generating content for sql directory

New Member Mensaje: 1 Fecha de incorporación: 29/06/12 Mensajes recientes
Good Observation . I had same problem with liferay-portal-6.0.6 CE. My Plan was to create tables in a different database. so for Entity tag i used datasource attribute. Then i ran build services. Observed that tables.sql is empty. Initially didn't realize this. After deploying the portlet not seeing any tables created in my database or default database.

<entity name="Employee" local-service="true" remote-service="true" data-source="mysqlDatasource">

servicecomponent table showing no sql executed.
'<?xml version="1.0" encoding="UTF-8"?>
<data>
<tables-sql><![CDATA[]]></tables-sql>
<sequences-sql><![CDATA[]]></sequences-sql>
<indexes-sql><![CDATA[]]></indexes-sql>
</data>'

Then I went back and verfied tables.sql. surprised with this being empty.

Now I have deleted datasource attribute from entity tag and ran build services again. This time tables.sql has generic sql to create table
<entity name="Employee" local-service="true" remote-service="true">
Then cleared servicecomponent table to make sure sqls runs agin; delete FROM servicecomponent where buildNamespace='cmc';

Then I bring back data-source name again in service.xml and deployed it. This time table created but it's in default database only/
thumbnail
Neetu Mishra, modificado hace 9 años.

RE: service builder not generating content for sql directory

Junior Member Mensajes: 75 Fecha de incorporación: 21/05/12 Mensajes recientes
suresh yadagiri:
Good Observation . I had same problem with liferay-portal-6.0.6 CE. My Plan was to create tables in a different database. so for Entity tag i used datasource attribute. Then i ran build services. Observed that tables.sql is empty. Initially didn't realize this. After deploying the portlet not seeing any tables created in my database or default database.

<entity name="Employee" local-service="true" remote-service="true" data-source="mysqlDatasource">

servicecomponent table showing no sql executed.
'<?xml version="1.0" encoding="UTF-8"?>
<data>
<tables-sql><![CDATA[]]></tables-sql>
<sequences-sql><![CDATA[]]></sequences-sql>
<indexes-sql><![CDATA[]]></indexes-sql>
</data>'

Then I went back and verfied tables.sql. surprised with this being empty.

Now I have deleted datasource attribute from entity tag and ran build services again. This time tables.sql has generic sql to create table
<entity name="Employee" local-service="true" remote-service="true">
Then cleared servicecomponent table to make sure sqls runs agin; delete FROM servicecomponent where buildNamespace='cmc';

Then I bring back data-source name again in service.xml and deployed it. This time table created but it's in default database only/


Hi Suresh,

I have the same problem, my sql file is empty in servicecomponent table. I dont want to create my custom portlet's DB in liferay default DB so are you able to resolve this issue?

Or anyone else who can help me in this regard.

Thanks in advance.
-Neetu