Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Jan Bub
Maven ServiceBuilder reference error
November 13, 2012 3:57 AM
Answer

Jan Bub

Rank: Junior Member

Posts: 78

Join Date: March 2, 2011

Recent Posts

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
November 12, 2012 5:08 PM
Answer

Mika Koivisto

Rank: Liferay Legend

Posts: 1518

Join Date: August 7, 2006

Recent Posts

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
November 13, 2012 3:59 AM
Answer

Jan Bub

Rank: Junior Member

Posts: 78

Join Date: March 2, 2011

Recent Posts

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
November 19, 2012 11:52 AM
Answer

Mika Koivisto

Rank: Liferay Legend

Posts: 1518

Join Date: August 7, 2006

Recent Posts

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
November 20, 2012 7:54 AM
Answer

Jan Bub

Rank: Junior Member

Posts: 78

Join Date: March 2, 2011

Recent Posts

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
November 20, 2012 8:57 AM
Answer

Mika Koivisto

Rank: Liferay Legend

Posts: 1518

Join Date: August 7, 2006

Recent Posts

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!