Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Jan Bub
Maven ServiceBuilder reference error
13 novembre 2012 3.57
Risposta

Jan Bub

Punteggio: Junior Member

Messaggi: 78

Data di Iscrizione: 2 marzo 2011

Messaggi recenti

Hey,

while developing my portlet with maven I got an error during the service bulding process. Building services works fine untl I define a reference to a Liferay Entitity.

1<reference package-path="com.liferay.portal.model" entity="User" />


When I wrote this into my service.xml I got the follwing error emoticon :
 1
 2[INFO] --- liferay-maven-plugin:6.1.1:build-service (default-cli) @ dfinder-portlet ---
 313:16:52,142 INFO  [main][PropsUtil:110] Global shared lib directory /home/jb01/.m2/repository/javax/servlet/servlet-api/2.5/
 413:16:52,142 INFO  [main][PropsUtil:121] Global lib directory /home/jb01/.m2/repository/com/liferay/portal/portal-service/6.1.1/
 513:16:52,142 INFO  [main][PropsUtil:147] Portal lib directory /home/jb01/workspaces/memo/dfinder/dfinder-portlet/target/liferay-work/appServerPortalDir/WEB-INF/lib/
 6Loading jar:file:/home/jb01/.m2/repository/com/liferay/portal/portal-impl/6.1.1/portal-impl-6.1.1.jar!/portal.properties
 7[INFO] Building from /home/jb01/workspaces/memo/dfinder/dfinder-portlet/src/main/webapp/WEB-INF/service.xml
 8java.io.IOException: Unable to open resource in class loader com/liferay/portal/model/service.xml
 9[INFO] ------------------------------------------------------------------------
10[INFO] Reactor Summary:
11[INFO]
12[INFO] dfinder ........................................ SUCCESS [5.329s]
13[INFO] dfinder Portlet Service ........................ SUCCESS [3.262s]
14[INFO] dfinder Portlet ................................ SUCCESS [3.263s]
15[INFO] ------------------------------------------------------------------------
16    at com.liferay.portal.kernel.util.StringUtil.read(StringUtil.java:1229)
17    at com.liferay.portal.kernel.util.StringUtil.read(StringUtil.java:1192)
18    at com.liferay.portal.tools.servicebuilder.ServiceBuilder.getEntity(ServiceBuilder.java:929)
19    at com.liferay.portal.tools.servicebuilder.ServiceBuilder._parseEntity(ServiceBuilder.java:4951)
20    at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:636)
21    at com.liferay.maven.plugins.ServiceBuilderMojo.doExecute(ServiceBuilderMojo.java:125)
22    at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:65)
23    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
24    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
25    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
26    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
27    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
28    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
29    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
30    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
31    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
32    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
33    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
34    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
35    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
36    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
37    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
38    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
39    at java.lang.reflect.Method.invoke(Method.java:601)
40    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
41    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
42    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
43    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
44[INFO] BUILD SUCCESS
45[INFO] ------------------------------------------------------------------------
46[INFO] Total time: 12.063s
47[INFO] Finished at: Mon Nov 12 13:16:52 CET 2012
48[INFO] Final Memory: 20M/351M
49[INFO] ----------------------------


Is there anybody who help me?
Mika Koivisto
RE: Maven ServiceBuilder reference error
12 novembre 2012 17.08
Risposta

Mika Koivisto

Punteggio: Liferay Legend

Messaggi: 1518

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

Can you check if it works in ant based plugins sdk? If it does and this is maven specific issue then can you open a issue in http://issues.liferay.com/browse/MAVEN
Jan Bub
RE: Maven ServiceBuilder reference error
13 novembre 2012 3.59
Risposta

Jan Bub

Punteggio: Junior Member

Messaggi: 78

Data di Iscrizione: 2 marzo 2011

Messaggi recenti

I tried it and it seems not to be a maven problem. emoticon

I created an empty project (JSF-Primefaces) and created ServiceBuilder-XML file. Same procedure: Everything works fine until i define a reference.

 1[Console output redirected to file:/home/jb01/workspace/.metadata/.plugins/com.liferay.ide.eclipse.sdk/sdk.log]
 2Buildfile: /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-plugins-sdk-6.1.1/portlets/dFinder-portlet/build.xml
 3build-service:
 4     [echo] Loading jar:file:/home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/system.properties
 5     [echo] Nov 13, 2012 11:51:31 AM com.liferay.portal.kernel.log.Jdk14LogImpl info
 6     [echo] INFO: Global shared lib directory /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-plugins-sdk-6.1.1/lib/
 7     [echo] Nov 13, 2012 11:51:31 AM com.liferay.portal.kernel.log.Jdk14LogImpl info
 8     [echo] INFO: Global lib directory /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/lib/ext/
 9     [echo] Nov 13, 2012 11:51:31 AM com.liferay.portal.kernel.log.Jdk14LogImpl info
10     [echo] INFO: Portal lib directory /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/
11     [echo] Loading jar:file:/home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties
12     [echo] Loading jar:file:/home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties
13     [echo] Nov 13, 2012 11:51:31 AM com.liferay.portal.kernel.log.Jdk14LogImpl info
14     [echo] INFO: Properties for portal loaded from [jar:file:/home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/com/liferay/portal/tools/dependencies/portal-tools.properties, jar:file:/home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-portal-6.1.1-ce-ga2/tomcat-7.0.27/webapps/ROOT/WEB-INF/lib/portal-impl.jar!/portal.properties]
15     [echo] java.io.IOException: Unable to open resource in class loader com/liferay/portal/model/service.xml
16     [echo]     at com.liferay.portal.kernel.util.StringUtil.read(StringUtil.java:1229)
17     [echo]     at com.liferay.portal.kernel.util.StringUtil.read(StringUtil.java:1192)
18     [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.getEntity(ServiceBuilder.java:929)
19     [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder._parseEntity(ServiceBuilder.java:4951)
20     [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:636)
21     [echo]     at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:151)
22    [mkdir] Created dir: /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-plugins-sdk-6.1.1/portlets/dFinder-portlet/docroot/WEB-INF/service-classes
23compile-java:
24      [zip] Warning: skipping zip archive /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-plugins-sdk-6.1.1/portlets/dFinder-portlet/docroot/WEB-INF/lib/dFinder-portlet-service.jar because no files were included.
25   [delete] Deleting directory /home/jb01/opt/liferay/6.1.1-ce-ga2/liferay-plugins-sdk-6.1.1/portlets/dFinder-portlet/docroot/WEB-INF/service-classes
26BUILD SUCCESSFUL
27Total time: 4 seconds
emoticonemoticonemoticon
Mika Koivisto
RE: Maven ServiceBuilder reference error
19 novembre 2012 11.52
Risposta

Mika Koivisto

Punteggio: Liferay Legend

Messaggi: 1518

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

Ah now I see where the problem is. Your package is incorrect. It should be just com.liferay.portal.
Jan Bub
RE: Maven ServiceBuilder reference error
20 novembre 2012 7.54
Risposta

Jan Bub

Punteggio: Junior Member

Messaggi: 78

Data di Iscrizione: 2 marzo 2011

Messaggi recenti

Hey, thats right. In the meantime i got it. Thank you for the answer.

Service.xml has to look linke this.

1
2...
3<column name="users" type="Collection" entity="com.liferay.portal.User" mapping-key="userId" />
4<column name="calEvents" type="Collection" entity="com.liferay.portlet.calendar.CalEbents" mapping-key="pk" />
5...
6<reference package-path="com.liferay.portlet.calendar" entity="CalEvent" />
7<reference package-path="com.liferay.portal" entity="User" />


That is confusing because in java the package name is com.liferay.portal.model. Whatever, it is working. Thnaks. emoticon
Mika Koivisto
RE: Maven ServiceBuilder reference error
20 novembre 2012 8.57
Risposta

Mika Koivisto

Punteggio: Liferay Legend

Messaggi: 1518

Data di Iscrizione: 7 agosto 2006

Messaggi recenti

It's the base package which is defined in service.xml that you need to refer to.

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!