掲示板

Liferay 7 JSF portlet with Ivy

7年前 に Do Kha SI によって更新されました。

Liferay 7 JSF portlet with Ivy

New Member 投稿: 6 参加年月日: 15/01/23 最新の投稿
Dear all,
I create new project with ant (ivy) but problem:

02:32:07,694 ERROR [pool-6-thread-1][com_liferay_portal_osgi_web_wab_extender:97] Catastrophic initialization failure! Shutting down xxx-portlet WAB due to: java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User;
java.lang.RuntimeException: java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User;
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
at com.liferay.portal.osgi.web.wab.extender.internal.adapter.ServletContextListenerExceptionAdapter.contextInitialized(ServletContextListenerExceptionAdapter.java:51)
at sun.reflect.GeneratedMethodAccessor473.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.eclipse.equinox.http.servlet.internal.registration.ListenerRegistration$EventListenerInvocationHandler.invoke(ListenerRegistration.java:132)
at com.sun.proxy.$Proxy469.contextInitialized(Unknown Source)
at org.eclipse.equinox.http.servlet.internal.context.ContextController.doAddListenerRegistration(ContextController.java:359)
at org.eclipse.equinox.http.servlet.internal.context.ContextController.addListenerRegistration(ContextController.java:312)
at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:67)
at org.eclipse.equinox.http.servlet.internal.customizer.ContextListenerTrackerCustomizer.addingService(ContextListenerTrackerCustomizer.java:1)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:901)
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:917)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:127)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:225)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:464)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482)
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:1001)
at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initListeners(WabBundleProcessor.java:525)
at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:152)
at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer._initWabBundle(WebBundleDeployer.java:186)
at com.liferay.portal.osgi.web.wab.extender.internal.WebBundleDeployer.doStart(WebBundleDeployer.java:106)
at com.liferay.portal.osgi.web.wab.extender.internal.WabFactory$WABExtension.start(WabFactory.java:162)
at org.apache.felix.utils.extender.AbstractExtender.createExtension(AbstractExtender.java:259)
at org.apache.felix.utils.extender.AbstractExtender.modifiedBundle(AbstractExtender.java:232)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:482)
at org.osgi.util.tracker.BundleTracker$Tracked.customizerModified(BundleTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:232)
at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:444)
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:905)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:165)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)
at org.eclipse.osgi.container.Module.publishEvent(Module.java:461)
at org.eclipse.osgi.container.Module.start(Module.java:452)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:421)
at aQute.remote.agent.AgentServer.start(AgentServer.java:146)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at aQute.remote.util.Link.executeCommand(Link.java:330)
at aQute.remote.util.Link$2.run(Link.java:163)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2575)
at java.lang.Class.getDeclaredFields(Class.java:1908)
at com.sun.faces.application.annotation.ManagedBeanConfigHandler.collectAnnotatedFields(ManagedBeanConfigHandler.java:242)
at com.sun.faces.application.annotation.ManagedBeanConfigHandler.getBeanInfo(ManagedBeanConfigHandler.java:151)
at com.sun.faces.application.annotation.ManagedBeanConfigHandler.process(ManagedBeanConfigHandler.java:137)
at com.sun.faces.application.annotation.ManagedBeanConfigHandler.push(ManagedBeanConfigHandler.java:123)
at com.sun.faces.application.annotation.AnnotationManager.applyConfigAnnotations(AnnotationManager.java:234)
at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:446)
at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:244)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.ValidatorConfigProcessor.process(ValidatorConfigProcessor.java:120)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.ConverterConfigProcessor.process(ConverterConfigProcessor.java:126)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.ComponentConfigProcessor.process(ComponentConfigProcessor.java:117)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:362)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:137)
at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:239)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:439)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
... 58 more
Caused by: java.lang.ClassNotFoundException: com.liferay.portal.model.User cannot be found by xxx-portlet_7.0.0.1
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:394)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:357)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:349)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 82 more

Version: Liferay 7.0.2
Ivy depen:
<dependency name="javax.faces-api" org="javax.faces" rev="2.2" />
<dependency name="javax.faces" org="org.glassfish" rev="2.2.13" />
<dependency name="com.liferay.faces.bridge.ext" org="com.liferay.faces" rev="5.0.0" />
<dependency name="com.liferay.faces.bridge.impl" org="com.liferay.faces" rev="4.0.0" />


Please help me!
I can create project with maven but I love ant.
Thank you very much!
thumbnail
7年前 に Neil Griffin によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
You should be able to develop JSF portlets for Liferay Portal using Ivy, Gradle, or Maven. However at the time of this writing, we only have examples and archetypes for Maven.

If you want to use Ivy, then for now I would recommend creating a new project from a Maven archetype and then examining the resulting war file for dependencies in WEB-INF/lib. For example:

1. Visit www.liferayfaces.org and use the dropdown lists to choose your Liferay Version, JSF Version, and Component Suite.

2. Copy/paste the "mvn archetype:generate" command that the website shows you. For example:
mvn archetype:generate \
  -DarchetypeGroupId=com.liferay.faces.archetype \
  -DarchetypeArtifactId=com.liferay.faces.archetype.jsf.portlet \
  -DarchetypeVersion=5.0.0 \
  -DgroupId=com.mycompany \
  -DartifactId=com.mycompany.my.jsf.portlet


3. Build the project:
cd com.mycompany.my.jsf.portlet
mvn clean package


4. Examine the resulting war for dependencies in WEB-INF/lib:
jar tvf target/com.mycompany.my.jsf.portlet-1.0-SNAPSHOT.war | grep jar


5. You should see the following:
WEB-INF/lib/com.liferay.faces.bridge.api-4.0.0.jar
WEB-INF/lib/com.liferay.faces.bridge.ext-5.0.0.jar
WEB-INF/lib/com.liferay.faces.bridge.impl-4.0.0.jar
WEB-INF/lib/com.liferay.faces.util-3.0.0.jar
WEB-INF/lib/javax.faces-2.2.13.jar
WEB-INF/lib/log4j-1.2.14.jar

6. Create an Ivy equivalent of this project with build.xml and ivy.xml and make sure that the resulting war has the same dependencies in WEB-INF/lib.

Now, regarding the NoClassDefFoundError for com.liferay.portal.model.User, it might be the case that you have com.liferay.portal.kernel as a dependency in the WEB-INF/lib folder of the war file. You would have to use the Ivy equivalent of the Maven "provided" scope in order to prevent it from being included in WEB-INF/lib.

Kind Regards,

Neil
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Hi Do Kha, just looking at:
Do Kha SI:
D

02:32:07,694 ERROR [pool-6-thread-1][com_liferay_portal_osgi_web_wab_extender:97] Catastrophic initialization failure! Shutting down xxx-portlet WAB due to: java.lang.NoClassDefFoundError: Lcom/liferay/portal/model/User;



you are actually using Liferay 6.2 dependencies, NOT Liferay 7 (it should be com.liferay.portal.kernel.model.User).

Can you take a look at that?

Thanks.
7年前 に Do Kha SI によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

New Member 投稿: 6 参加年月日: 15/01/23 最新の投稿
Thank Neil, Juan!
It works fine. I was add scope provided for depen on ivy.
Thank you very much
thumbnail
7年前 に Neil Griffin によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
You are very welcome. So glad to hear that things are working for you now. Thanks for using Liferay Faces emoticon
7年前 に Do Kha SI によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

New Member 投稿: 6 参加年月日: 15/01/23 最新の投稿
Hi Neil,
Can you help me command line build service builder with maven.
I try command but have problem
mvn -e liferay:build-service -DserviceFileName=service.xml

ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:7.0.0-m2:build-service (default-cli) on project vn.telsoft.demo19-portlet-service: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:7.0.0-m2:build-service (default-cli) on project vn.telsoft.demo19-portlet-service: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
thumbnail
7年前 に Juan Gonzalez によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Do Kha SI:
Hi Neil,
Can you help me command line build service builder with maven.
I try command but have problem
mvn -e liferay:build-service -DserviceFileName=service.xml

ERROR] Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:7.0.0-m2:build-service (default-cli) on project vn.telsoft.demo19-portlet-service: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.liferay.maven.plugins:liferay-maven-plugin:7.0.0-m2:build-service (default-cli) on project vn.telsoft.demo19-portlet-service: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)


Hi Do.

Right now there isn't Maven support for Liferay 7. Please watch this ticket so you get notifications about when is implemented: https://issues.liferay.com/browse/MAVEN-153

Thanks!
7年前 に Do Kha SI によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

New Member 投稿: 6 参加年月日: 15/01/23 最新の投稿
Hi Juan, Neil!
I add plugin to maven project:

<plugins>
<plugin>
<groupId>com.liferay</groupId>
<artifactId>com.liferay.portal.tools.service.builder</artifactId>
<version>1.0.126</version>
<configuration>
<apiDirName>src/main/java</apiDirName>
<beanLocatorUtil>com.liferay.util.bean.PortletBeanLocatorUtil</beanLocatorUtil>
<hbmFileName>../vn.telsoft.demo19-portlet/src/main/java/META-INF/module-hbm.xml</hbmFileName>
<implDirName>../vn.telsoft.demo19-portlet/src/main/java</implDirName>
<inputFileName>service.xml</inputFileName>
<modelHintsFileName>../vn.telsoft.demo19-portlet/src/main/resources/META-INF/portlet-model-hints.xml</modelHintsFileName>
<osgiModule>true</osgiModule>
<propsUtil>vn.telsoft.demo16.util.ServiceProps</propsUtil>
<resourcesDirName>../vn.telsoft.demo19-portlet/src/main/resources</resourcesDirName>
<springFileName>../vn.telsoft.demo19-portlet/src/main/resources/META-INF/spring/module-spring.xml</springFileName>
<springNamespaces>beans,osgi</springNamespaces>
<sqlDirName>../vn.telsoft.demo19-portlet/src/main/resources/META-INF/sql</sqlDirName>
<sqlFileName>tables.sql</sqlFileName>
<testDirName>../vn.telsoft.demo19-portlet/src/test/java/integration</testDirName>
</configuration>
</plugin>
</plugins>

It build service fine with command: mvn liferay:build-service
But I don't know how to deploy jar file service builder to liferay server.
Can you help me?
thumbnail
7年前 に Neil Griffin によって更新されました。

RE: Liferay 7 JSF portlet with Ivy

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
Very sorry for the delay in responding -- is this still an issue in your environment?