Forums de discussion
JSF Portlet + Liferay Faces + Service Builder
Michel Schmidt, modifié il y a 6 années.
JSF Portlet + Liferay Faces + Service Builder
New Member Publications: 21 Date d'inscription: 27/02/17 Publications récentes
Hi everybody,
I'm having problems calling an OSGi service from my jsf portlet.
Here are my specs:
Liferay 7 GA4
JSF Portlet (with LiferayFaces and Gradle) generated via archetype:generate as stated on liferayfaces.org
Liferay IDE 3.1.2.201709011126-ga3
I have added a simple project, as an attachment
So I already have deployed the chat in the portal, and it is working.
I have created two users, set the buddy list strategy to "sites", created a site and added both users as members to the site.
So far everything works, both users see each other and can chat.
What I'm trying to do is, call EntryLocalServiceImpl from chat-service.
So I followed the tutorials about the ServiceTrackers, but whenever I am trying to deploy that jsf portlet, I'm getting the following exception:
Any help appreciated!
I'm having problems calling an OSGi service from my jsf portlet.
Here are my specs:
Liferay 7 GA4
JSF Portlet (with LiferayFaces and Gradle) generated via archetype:generate as stated on liferayfaces.org
Liferay IDE 3.1.2.201709011126-ga3
I have added a simple project, as an attachment
So I already have deployed the chat in the portal, and it is working.
I have created two users, set the buddy list strategy to "sites", created a site and added both users as members to the site.
So far everything works, both users see each other and can chat.
What I'm trying to do is, call EntryLocalServiceImpl from chat-service.
So I followed the tutorials about the ServiceTrackers, but whenever I am trying to deploy that jsf portlet, I'm getting the following exception:
Any help appreciated!
15:52:38,671 ERROR [Framework Event Dispatcher: Equinox Container: 009ae7a4-04b4-0017-1dc8-e1628e46aeee][com_liferay_portal_osgi_web_servlet_context_helper:97] FrameworkEvent ERROR
org.osgi.framework.ServiceException: Exception in com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationServiceFactory.getService()
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:222)
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111)
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:496)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461)
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:619)
at org.osgi.util.tracker.ServiceTracker.addingService(ServiceTracker.java:414)
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.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initContext(WabBundleProcessor.java:436)
at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:132)
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:158)
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:163)
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:498)
at aQute.remote.util.Link.executeCommand(Link.java:335)
at aQute.remote.util.Link$2.run(Link.java:173)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader._getFilterInstance(WebXMLDefinitionLoader.java:1075)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader._setFilter(WebXMLDefinitionLoader.java:1134)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader.endElement(WebXMLDefinitionLoader.java:165)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader.loadWebXMLDefinition(WebXMLDefinitionLoader.java:515)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.definition.WebXMLDefinitionLoader.loadWebXML(WebXMLDefinitionLoader.java:451)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationImpl.<init>(ServletContextHelperRegistrationImpl.java:76)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationServiceFactory.getService(ServletContextHelperRegistrationServiceFactory.java:49)
at com.liferay.portal.osgi.web.servlet.context.helper.internal.ServletContextHelperRegistrationServiceFactory.getService(ServletContextHelperRegistrationServiceFactory.java:32)
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210)
... 44 more
Caused by: java.lang.NullPointerException
at com.liferay.portal.kernel.util.PropsUtil.get(PropsUtil.java:32)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.<clinit>(InvokerFilter.java:328)
... 70 more
15:52:40,656 ERROR [pool-17-thread-2][com_liferay_portal_osgi_web_wab_extender:97] Catastrophic initialization failure! Shutting down null WAB due to: null
java.lang.NullPointerException
at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.initContext(WabBundleProcessor.java:443)
at com.liferay.portal.osgi.web.wab.extender.internal.WabBundleProcessor.init(WabBundleProcessor.java:132)
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:158)
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:163)
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:498)
at aQute.remote.util.Link.executeCommand(Link.java:335)
at aQute.remote.util.Link$2.run(Link.java:173)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Pièces jointes:
Neil Griffin, modifié il y a 6 années.
RE: JSF Portlet + Liferay Faces + Service Builder
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
I'm not sure of the exact cause of the deployment failure, but the stacktrace indicates line 443 of WabBundleProcessor.java might have a problem with WEB-INF/web.xml.
Also, I wanted to mention that Controller.java never calls a "getService" method in order to populate the userLocalService or stateLocalService instance variables. See line#93 of UsersModelBean.java in the primefaces-users-portlet demo for an example of correct usage.
Also, I wanted to mention that Controller.java never calls a "getService" method in order to populate the userLocalService or stateLocalService instance variables. See line#93 of UsersModelBean.java in the primefaces-users-portlet demo for an example of correct usage.
Neil Griffin, modifié il y a 6 années.
RE: JSF Portlet + Liferay Faces + Service Builder (Réponse)
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Another problem I noticed is that the WAR contains WEB-INF/com.liferay.portal.kernel-2.51.0.jar which is incorrect.
In build.gradle, try changing:
In build.gradle, try changing:
compile group: 'com.liferay.portal', name: 'com.liferay.portal.kernel', version: '2.51.0'
to this:providedCompile group: 'com.liferay.portal', name: 'com.liferay.portal.kernel', version: '2.51.0'
Juan Gonzalez, modifié il y a 6 années.
RE: JSF Portlet + Liferay Faces + Service Builder
Liferay Legend Publications: 3089 Date d'inscription: 28/10/08 Publications récentes
What Neil said could be causing the issue you are having that seems to be happening when using PropsUtil:
So, please do what Neil said and don't include portal-impl, and let us know.
Thanks!
Caused by: java.lang.NullPointerException
at com.liferay.portal.kernel.util.PropsUtil.get(PropsUtil.java:32)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.<clinit>(InvokerFilter.java:328)
... 70 more</clinit>
So, please do what Neil said and don't include portal-impl, and let us know.
Thanks!
Michel Schmidt, modifié il y a 6 années.
RE: JSF Portlet + Liferay Faces + Service Builder
New Member Publications: 21 Date d'inscription: 27/02/17 Publications récentes
Thank you for your answers guys!
Indeed, after changing portal-kernels scope the deployment exception no longer occurs.
So the error was caused by me deploying portal-kernel through my portlet it seems.
Thanks a lot!
Indeed, after changing portal-kernels scope the deployment exception no longer occurs.
So the error was caused by me deploying portal-kernel through my portlet it seems.
Thanks a lot!
Neil Griffin, modifié il y a 6 années.
RE: JSF Portlet + Liferay Faces + Service Builder
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
Thanks for letting us know Michel. Glad to know that it is working for you now.