Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Rico D'Amore
service builder not generating content for sql directory
10 aprile 2012 11.47
Risposta

Rico D'Amore

Punteggio: New Member

Messaggi: 13

Data di Iscrizione: 29 marzo 2012

Messaggi recenti

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:
Loading jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
Apr 10, 2012 6:17:24 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
INFO: Global lib directory /usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/lib/ext/
Apr 10, 2012 6:17:24 PM com.liferay.portal.kernel.log.Jdk14LogImpl info
INFO: Portal lib directory /usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/
18:17:24,541 INFO [EasyConf:122] Refreshed the configuration of all components
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]
Loading jar:file:/usr/local/Portal-Dev/bundles/liferay/tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
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
SLF4J: Class path contains multiple SLF4J bindings.
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]
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]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Building Kid
Deleting: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/ServiceBuilder.temp
Created dir: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
compile-java:
Copied 7 empty directories to 4 empty directories under /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
Compiling 14 source files to /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/service-classes
Building zip: /usr/local/Portal-Dev/plugins/portlets/TagMyVideo-portlet/docroot/WEB-INF/lib/TagMyVideo-portlet-service.jar
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!
David H Nebinger
RE: service builder not generating content for sql directory
10 aprile 2012 12.54
Risposta

David H Nebinger

Punteggio: Liferay Legend

Messaggi: 7895

Data di Iscrizione: 1 settembre 2006

Messaggi recenti

Does it work if you take out the undefined data-source, session-factory, and tx-manager beans?
Rico D'Amore
RE: service builder not generating content for sql directory
10 aprile 2012 13.27
Risposta

Rico D'Amore

Punteggio: New Member

Messaggi: 13

Data di Iscrizione: 29 marzo 2012

Messaggi recenti

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
RE: service builder not generating content for sql directory
4 marzo 2013 1.03
Risposta

Jyothi Rajesh

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 22 novembre 2012

Messaggi recenti

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
suresh yadagiri
RE: service builder not generating content for sql directory
6 luglio 2013 20.01
Risposta

suresh yadagiri

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 28 giugno 2012

Messaggi recenti

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/
Neetu Mishra
RE: service builder not generating content for sql directory
9 gennaio 2015 14.09
Risposta

Neetu Mishra

Punteggio: Junior Member

Messaggi: 74

Data di Iscrizione: 21 maggio 2012

Messaggi recenti

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