Foros de discusión

Maven SB portlet + liferay:build-service with file specified.

thumbnail
Andew Jardine, modificado hace 8 años.

Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey Guys,

Rather than place a service.xml file in the usual place, I am trying to do something more along the lines of what Liferay does. I have a project that has multiple portlets (or will have) and I am introducing multiple service.xml files -- one per portlet -- so that I can control the package paths accordingly. It's a maven project, and the command that I am running is


mvn -e liferay:build-service -DserviceFileName=src/main/java/com/my/package/path/service.xml


but it isn't taking. I am getting an error in the console but I don't see anything that might be helpful.


[ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.1:build-service (default-cli) on project yp-common-plugins-portlet: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.1:build-service (default-cli) on project yp-common-plugins-portlet: null
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException
	at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:87)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: java.lang.NullPointerException
	at java.util.regex.Matcher.getTextLength(Matcher.java:1234)
	at java.util.regex.Matcher.reset(Matcher.java:308)
	at java.util.regex.Matcher.<init>(Matcher.java:228)
	at java.util.regex.Pattern.matcher(Pattern.java:1088)
	at com.liferay.maven.plugins.AbstractLiferayMojo.getPortalMajorVersion(AbstractLiferayMojo.java:242)
	at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:71)
	... 21 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
</init>


Does anyone know what this exception is complaining about?
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Plugin version 6.2.1? You could try the later 6.2.2...

It looks as though the code is trying to match something against a pattern w/ a regex form of "(\d+[.]\d+)". For the NPE, it could mean the value that holds the version is null or the matcher is null (although the matcher is a static instance variable so that's not likely).
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

I've bumped the version to use 6.2.10.10 but I am getting the same stack trace. Do you know if the command I am executing, passing the service.xml file location/name is valid?

EDIT: When I try it with ANT I don't get any exceptions. It says build successful but nothing is generated.
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Hmm, do you have all of your properties defined in maven, including the "liferay.version" property?
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David --

Ok -- so I did a bit of cleanup (and reading since my maven foo is pretty weak), but still no dice. Here is what I have.

1. I create a nwe maven service builder portlet called z-portlet.
2. This of course gave me the z-portlet-portlet and z-portlet-service modeules.
3. I modified my pom's introducing dependencyManagement into the parent pom and removing the versions from children. My parent pom now looks like this --

properties --


<liferay.version>6.2.10.11</liferay.version>
<liferay.maven.plugin.version>6.2.10.11</liferay.maven.plugin.version>


.. and then my dependencyManagement node --


	<dependencymanagement>
		<dependencies>
			<dependency>
				<groupid>com.yp.liferay</groupid>
				<artifactid>z-portlet-portlet-service</artifactid>
				<version>${pom.version}</version>
			</dependency>
			<dependency>
				<groupid>com.liferay.portal</groupid>
				<artifactid>portal-service</artifactid>
				<version>${liferay.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>com.liferay.portal</groupid>
				<artifactid>util-bridges</artifactid>
				<version>${liferay.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>com.liferay.portal</groupid>
				<artifactid>util-taglib</artifactid>
				<version>${liferay.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>com.liferay.portal</groupid>
				<artifactid>util-java</artifactid>
				<version>${liferay.version}</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>javax.portlet</groupid>
				<artifactid>portlet-api</artifactid>
				<version>2.0</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>javax.servlet</groupid>
				<artifactid>servlet-api</artifactid>
				<version>2.4</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>javax.servlet.jsp</groupid>
				<artifactid>jsp-api</artifactid>
				<version>2.0</version>
				<scope>provided</scope>
			</dependency>
			<dependency>
				<groupid>com.liferay.portal</groupid>
				<artifactid>portal-service</artifactid>
				<version>${liferay.version}</version>
				<scope>provided</scope>
			</dependency>
		</dependencies>
	</dependencymanagement>


4. As mentioned, I then removed the version and scope from the module poms.
5. I then tried a clean validate compile and package goals from both eclipse and from the command line. All worked.
6. I then ran my --


mvn -X -P yp liferay:build-service -DserviceFileName=z-portlet-portlet/src/main/java/com/yp/liferay/portlet/z/service.xml


I tried this is both the shell and from eclipse. In both cases I get the following error -- (mave with debug)


[ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.10.11:build-service (default-cli) on project z-portlet-portlet-service: null: MojoExecutionException: InvocationTargetException: Error creating bean with name 'com.liferay.portal.kernel.webdav.methods.MethodFactoryRegistryUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl#212e50ab' of type [com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl] while setting bean property 'methodFactoryRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl#212e50ab' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.webdav.methods.MethodFactoryImpl#45ffdd9c' of type [com.liferay.portal.webdav.methods.MethodFactoryImpl] while setting bean property 'defaultMethodFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.xml.SAXReaderUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' of type [com.liferay.portal.xml.SAXReaderImpl] while setting bean property 'secureSAXReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider: com.liferay.portal.security.xml.SecureXMLFactoryProvider -&gt; [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.10.11:build-service (default-cli) on project z-portlet-portlet-service: null
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException
	at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:88)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.liferay.maven.plugins.AbstractLiferayMojo.executeTool(AbstractLiferayMojo.java:224)
	at com.liferay.maven.plugins.ServiceBuilderMojo.doExecute(ServiceBuilderMojo.java:167)
	at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:81)
	... 21 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.webdav.methods.MethodFactoryRegistryUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl#212e50ab' of type [com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl] while setting bean property 'methodFactoryRegistry'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl#212e50ab' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.webdav.methods.MethodFactoryImpl#45ffdd9c' of type [com.liferay.portal.webdav.methods.MethodFactoryImpl] while setting bean property 'defaultMethodFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.xml.SAXReaderUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' of type [com.liferay.portal.xml.SAXReaderImpl] while setting bean property 'secureSAXReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
	at com.liferay.portal.spring.context.ArrayApplicationContext.<init>(ArrayApplicationContext.java:31)
	at com.liferay.portal.spring.util.SpringUtil._loadContext(SpringUtil.java:74)
	at com.liferay.portal.spring.util.SpringUtil.loadContext(SpringUtil.java:60)
	at com.liferay.portal.util.InitUtil.initWithSpring(InitUtil.java:189)
	at com.liferay.portal.util.InitUtil.initWithSpring(InitUtil.java:166)
	at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:198)
	... 28 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.webdav.methods.MethodFactoryRegistryImpl#212e50ab' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.webdav.methods.MethodFactoryImpl#45ffdd9c' of type [com.liferay.portal.webdav.methods.MethodFactoryImpl] while setting bean property 'defaultMethodFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.xml.SAXReaderUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' of type [com.liferay.portal.xml.SAXReaderImpl] while setting bean property 'secureSAXReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
	... 48 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.kernel.xml.SAXReaderUtil' defined in class path resource [META-INF/util-spring.xml]: Cannot create inner bean 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' of type [com.liferay.portal.xml.SAXReaderImpl] while setting bean property 'secureSAXReader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:266)
	... 54 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:964)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:910)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
	... 64 more
Caused by: java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585)
	at java.lang.Class.getConstructor0(Class.java:2885)
	at java.lang.Class.getDeclaredConstructor(Class.java:2058)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy$1.run(SimpleInstantiationStrategy.java:60)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy$1.run(SimpleInstantiationStrategy.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$3.run(AbstractAutowireCapableBeanFactory.java:952)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:950)
	... 68 more
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.security.xml.SecureXMLFactoryProvider
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 79 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :z-portlet-portlet-service
</goals></init></init></init>
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
liferay.version should be the version you're building against. 6.2.10.11 is 6.2 EE SP10 (hopefully that aligns with what you're building for).

liferay.maven.plugin.version points at a version of the plugin to use for maven builds. I don't know if the EE version can be used against CE and vice versa, but this may show that the two cannot be interchanged. It's definitely not in the source that I can find...

This class, com.liferay.portal.security.xml.SecureXMLFactoryProvider, was added to 6.2 EE SP 11, and I haven't found it in previous service packs (10 or earlier).
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

My install is actually an SP11 version. I downloaded the SP11 maven plugins and have installed them in my local repository -- so I can see in my repository folder under com/liferay/portal/.../6.2.12.

I updated the properties in my parent pom to


		<liferay.version>6.2.10.12</liferay.version>
		<liferay.maven.plugin.version>6.2.10.12</liferay.maven.plugin.version>


ran an ant clean and tried again, but same issue --


Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.xml.SAXReaderImpl#21c49e79' defined in class path resource [META-INF/util-spring.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:964)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:910)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:484)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270)
	... 64 more
Caused by: java.lang.NoClassDefFoundError: com/liferay/portal/security/xml/SecureXMLFactoryProvider
	at java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585)
	at java.lang.Class.getConstructor0(Class.java:2885)
	at java.lang.Class.getDeclaredConstructor(Class.java:2058)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy$1.run(SimpleInstantiationStrategy.java:60)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy$1.run(SimpleInstantiationStrategy.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:58)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$3.run(AbstractAutowireCapableBeanFactory.java:952)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:950)
	... 68 more
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.security.xml.SecureXMLFactoryProvider
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
	... 79 more
[ERROR] 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :z-portlet-portlet-service
</goals>


Any other ideas? Would you mind being able to quickly try this on your side? (assuming you haven't already emoticon )
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Is your liferay.app.server.lib.global.dir and liferay.app.server.portal.dir correctly pointing at the SP11 bundle?
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

I think so -- here is the full set of properties that I am using.


                <liferay.auto.deploy.dir>/home/aj/projects/ypg/liferay/liferay-portal-6.2-ee-sp11/deploy</liferay.auto.deploy.dir>
		<liferay.app.server.deploy.dir>/home/aj/projects/ypg/liferay/liferay-portal-6.2-ee-sp11/tomcat-7.0.42/webapps</liferay.app.server.deploy.dir>
		<liferay.app.server.lib.global.dir>/home/aj/projects/ypg/liferay/liferay-portal-6.2-ee-sp11/tomcat-7.0.42/lib/ext</liferay.app.server.lib.global.dir>
		<liferay.app.server.portal.dir>/home/aj/projects/ypg/liferay/liferay-portal-6.2-ee-sp11/tomcat-7.0.42/webapps/ROOT</liferay.app.server.portal.dir>


I just double checked them all and they are all resolving to the location they specify -- so I think that they're ok.
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
UPDATE: just to try to make some progress, I tried running the build-service target putting the service.xml file in the usual location and I am getting the same error.
thumbnail
Jack Bakker, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Master Mensajes: 978 Fecha de incorporación: 3/01/10 Mensajes recientes
Hey Andrew,

I once created a whole bunch of of theme projects named like bizclient-theme-mythemeA-theme bizclient-theme-mythemeB-theme bizclient-theme-mythemeC-theme where when I deployed them all, I only saw one theme in the webapps folder: bizclient-theme

Likewise I would think that the last -portlet in z-portlet-portlet would also get lopped off at liferay:deploy

I know you are at the liferay:build-service step, but perhaps there is something similar going on...
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Ok -- some joy. Mostly once I woke up and realized that I was specifying A PROFILE in the mvn command and until I updated that in my settings.xml file I was never going to find that SP11 resource :|.

That lead to a different error but it was a familiar one. In the end, for the record, my two properties are --


		<liferay.version>6.2.10.12</liferay.version>
		<liferay.maven.plugin.version>6.2.10.11</liferay.maven.plugin.version>


and that got me a little further. Although now I have this error --


java.lang.RuntimeException: The namespace element must be a valid keyword
	at com.liferay.portal.tools.servicebuilder.ServiceBuilder.<init>(ServiceBuilder.java:697)
	at com.liferay.portal.tools.servicebuilder.ServiceBuilder.main(ServiceBuilder.java:229)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at com.liferay.maven.plugins.AbstractLiferayMojo.executeTool(AbstractLiferayMojo.java:224)
	at com.liferay.maven.plugins.ServiceBuilderMojo.doExecute(ServiceBuilderMojo.java:167)
	at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:81)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
</init>


When I checked the ServiceBuilder line referenced in the stacktrace I found the logic --


			for (char c : _portletShortName.toCharArray()) {
				if (!Validator.isChar(c) &amp;&amp; (c != CharPool.UNDERLINE)) {
					throw new RuntimeException(
						"The namespace element must be a valid keyword");
				}
			}


.. and my namespace is set to <namespace>VirtualHostAlias</namespace> -- which I am pretty sure means that it should pass that validation, so the mystery continues.
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Do you have a value for the <short-name /> tag?
thumbnail
Andew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

I ended up taking the conversation to IRC. With some real time help and such James and I ended up discovering that the parameter appears to be ignored. In the maven-support project there is a ServiceBuilderMojo class for the maven goal (?) ... in there you can see the branch logic where it is supposed to use the name that is passed in unless none is passed in, causing it to fallback to the default service.xml file in the WEB-INF location. In my case, with debug enabled I can see the parameters and it shows my custom location, but the error I get is --


org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:6.2.10.11:build-service (default-cli) on project z-portlet-portlet: Unable to find service.xml with path /home/aj/projects/ypg/workspace/z-portlet/z-portlet-portlet/src/main/webapp/WEB-INF/service.xml
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to find service.xml with path /home/aj/projects/ypg/workspace/z-portlet/z-portlet-portlet/src/main/webapp/WEB-INF/service.xml
	at com.liferay.maven.plugins.ServiceBuilderMojo.doExecute(ServiceBuilderMojo.java:102)
	at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:81)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more


Soooooo.. it looks like a bug for now.
thumbnail
Andrew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
I never answered my own post! This was in fact (and still is as of this point) a bug in the ServiceBuilderMojo class. I managed to track it down to a line that sets the serviceFileName to the default location (WEB-INF/service.xml) regardless of what you send in. I'm going to do a blog post outlining how to fix the issue yourself so that you can leverage the file name but for anyone interested in tracking the problem -- and PLEASE UP VOTE IT! -- it's really annoying to have to ix this with each release when there is a PR that will fix it once and for all just sitting in the wings.

https://issues.liferay.com/browse/MAVEN-147
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Yeah, I've been stuck running w/ the older versions of the Liferay maven plugin because of the bug...
thumbnail
Andrew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey David,

I'll give you the coles notes:

1. Clone the right branch from the liferay-maven-support Github repo
2. Open the ServiceBuilderMojo.hava class.
3. Comment out line #262
4. Run mvn clean install (or deploy if you are pushing to remote repo)

.. and then you can start using liferay:build-service -DserviceFileName=.... I have several maven profiles that I used to switch between LR versions so I just made sure to put the liferay.maven.version to the correct 6.2.10.XX number based on whichever one I patched.
thumbnail
Andrew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
.. I should also add, David, that now that I KNOW you have an inside track, ahem ... maybe a little pressure can be applied to get that PR accepted? emoticon
thumbnail
David H Nebinger, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 14914 Fecha de incorporación: 2/09/06 Mensajes recientes
Ha! I don't believe that for a second, and neither should you emoticon
Martin Vaněk, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

New Member Mensajes: 11 Fecha de incorporación: 12/03/16 Mensajes recientes
Hello, Andrew

I would really like to do something something similar and thats why I ended up finding this thread since I am trying to achieve probably the same thing as you.
I have read the fix for the maven liferay plugin. Thanks that works for me!

Though I have no idea how would Liferay Portal deal with multiple services but only one service.properties file and other config files,, is that something you need to separate aswell? They different services could have different namespaces, schemas and versions


Also my goal is to have "separated" services in one plugin to to make sure if you deploy plugin only the one service which was build will be undergoing update. But I need to reference them each other. I can user service builde <reference> tag for that. If you could hint me something what would help me I would very much appretiate it.
thumbnail
Andrew Jardine, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hey Martin,

As far as I can tell, the service.properties is not a parameter and is shared by all services in the bundle.


public class ServiceBuilderMojo extends AbstractToolsLiferayMojo {

	protected void copyServicePropertiesFile() throws Exception {
		File servicePropertiesFile = new File(
			implResourcesDir, "service.properties");

		if (servicePropertiesFile.exists()) {
			FileUtil.copyFile(
				servicePropertiesFile, new File(implDir, "service.properties"));
		}
	}


There are many parameters that can be passed for configuration, but perhaps not to the degree that you are looking for --


String[] args = new String[28];

		args[0] = "service.input.file=" + serviceFileName;
		args[1] = "service.hbm.file=" + hbmFileName;
		args[2] = "service.orm.file=" + ormFileName;
		args[3] = "service.model.hints.file=" + modelHintsFileName;
		args[4] = "service.spring.file=" + springFileName;
		args[5] = "service.spring.base.file=" + springBaseFileName;
		args[6] = "service.spring.cluster.file=" + springClusterFileName;
		args[7] =
			"service.spring.dynamic.data.source.file=" +
				springDynamicDataSourceFileName;
		args[8] = "service.spring.hibernate.file=" + springHibernateFileName;
		args[9] =
			"service.spring.infrastructure.file=" +
				springInfrastructureFileName;
		args[10] =
			"service.spring.shard.data.source.file=" +
				springShardDataSourceFileName;
		args[11] = "service.api.dir=" + apiDir;
		args[12] = "service.impl.dir=" + implDir;
		args[13] = "service.json.file=" + jsonFileName;
		args[14] = "service.remoting.file=" + remotingFileName;
		args[15] = "service.sql.dir=" + sqlDir;
		args[16] = "service.sql.file=" + sqlFileName;
		args[17] = "service.sql.indexes.file=" + sqlIndexesFileName;
		args[18] =
			"service.sql.indexes.properties.file=" +
				sqlIndexesPropertiesFileName;
		args[19] = "service.sql.sequences.file=" + sqlSequencesFileName;
		args[20] = "service.auto.namespace.tables=" + autoNamespaceTables;
		args[21] = "service.bean.locator.util=" + beanLocatorUtil;
		args[22] = "service.props.util=" + propsUtil;
		args[23] = "service.plugin.name=" + pluginName;
		args[24] = "service.target.entity.name=" + targetEntityName;
		args[25] = "service.test.dir=";
		args[26] = "service.build.number=" + serviceBuildNumber;
		args[27] =
			"service.build.number.increment=" + serviceBuildNumberIncrement;


Now with that said I have had this conversation several times with people -- though admittedly it has historically been used as "a reason" for making millions of plugin projects rather than one that encapsulates all related plugins. "What if I want to change plugin A and do a release but not change anything in plugin B?" ... which is similar to your question of "What if I want to change entity A but not entity B?"

I don't know what source control model you use, but, in my mind, this situation isn't really a problem. If I say that release 1.2.1 is going to have updates to entity A .. then, well, that is what 1.2.1 includes. Entity B should not expected to be any different emoticon. If 1.2.2 changes entity B and not A, then ... well, entity A is the same as it was when 1.2.1 was released. If 1.2.3 changes both -- then a new baseline is established.

If you need to have Plugin A use v1 and Plugin B use v2 (of the same entity) then I think you need to have the dependency as a separate project.
Martin Vaněk, modificado hace 8 años.

RE: Maven SB portlet + liferay:build-service with file specified.

New Member Mensajes: 11 Fecha de incorporación: 12/03/16 Mensajes recientes
Thanks for the reply I see what you mean I agree with you. But the decision is not on me emoticon

I guess what we would like is to have portlet + service as a module which you can plug into another bundle which you can deploy to Liferay. I think this is meant for OSGi but I cannot know since I didnt work or learn about it yet.

Currently we have separeted plugins and then having their services as a dependency. The problem is when I want to have something in one transaction, I have learned that one service method is normally one transaction but when you reference serviceA in serviceB I have access only on *Util methods which causes liferay to create another transaction and thats problem. I think you can reference to persistence by <Entity>Util but thats only persistence not a service.