Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nuno Fontes
JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 5, 2017 9:22 AM
Answer

Nuno Fontes

Rank: New Member

Posts: 4

Join Date: January 5, 2016

Recent Posts

Hi,

I am developing a JSF portlet and call a service builder on it. I read the documentation and follow its instructions. You can see it in the code below

 1
 2@RequestScoped
 3@ManagedBean(name = "changePin")
 4public class ChangePin {
 5
 6    //-Properties
 7    private static Logger logger = Logger.getLogger(ChangePin.class);
 8
 9    private Integer newPin;
10    private Integer newPinConfirmation;
11    private ChangePinLocalServiceTracker changePinLocalServiceTracker;
12
13    @PostConstruct
14    public void postConstruct() {
15        Bundle bundle = FrameworkUtil.getBundle(this.getClass());
16        BundleContext bundleContext = bundle.getBundleContext();
17        changePinLocalServiceTracker = new ChangePinLocalServiceTracker(bundleContext);
18        changePinLocalServiceTracker.open();
19    }
20   
21    @PreDestroy
22    public void preDestroy() {
23        changePinLocalServiceTracker.close();
24    }
25   
26    //-Actions
27    public String submit() {
28
29        System.out.println("################# submit method ###############+++++++++++");
30
31        HBPinManagement_1_0LocalService changePinLocalService = changePinLocalServiceTracker.getService();
32       
33        changePinLocalService.changePin(1234567, 666666);
34       
35        return "view";
36    }
37
38    //-Getters/Setters
39
40}


1
2public class ChangePinLocalServiceTracker extends ServiceTracker<HBPinManagement_1_0LocalService, HBPinManagement_1_0LocalService> {
3   
4    public ChangePinLocalServiceTracker(BundleContext bundleContext) {
5        super(bundleContext, HBPinManagement_1_0LocalService.class, null);
6    }
7   
8}


 1
 2<dependencies>
 3        <dependency>
 4            <groupId>commons-fileupload</groupId>
 5            <artifactId>commons-fileupload</artifactId>
 6            <version>1.3.1</version>
 7            <optional>true</optional>
 8        </dependency>
 9
10        <dependency>
11            <groupId>commons-io</groupId>
12            <artifactId>commons-io</artifactId>
13            <version>2.4</version>
14            <optional>true</optional>
15        </dependency>
16
17        <dependency>
18            <groupId>javax.faces</groupId>
19            <artifactId>javax.faces-api</artifactId>
20            <version>${faces.api.version}</version>
21            <scope>provided</scope>
22        </dependency>
23
24        <dependency>
25            <groupId>org.glassfish</groupId>
26            <artifactId>javax.faces</artifactId>
27            <version>${mojarra.version}</version>
28            <scope>runtime</scope>
29        </dependency>
30
31        <dependency>
32            <groupId>com.liferay.faces</groupId>
33            <artifactId>com.liferay.faces.bridge.ext</artifactId>
34            <version>${liferay.faces.bridge.ext.version}</version>
35        </dependency>
36
37        <dependency>
38            <groupId>com.liferay.faces</groupId>
39            <artifactId>com.liferay.faces.bridge.impl</artifactId>
40            <version>${liferay.faces.bridge.version}</version>
41        </dependency>
42
43        <dependency>
44            <groupId>log4j</groupId>
45            <artifactId>log4j</artifactId>
46            <version>1.2.14</version>
47        </dependency>
48
49        <dependency>
50                    <groupId>org.osgi</groupId>
51                   <artifactId>org.osgi.service.component.annotations</artifactId>
52                  <version>${org.osgi.service.component.annotations.version}</version>
53        </dependency>
54
55        <dependency>
56            <groupId>com.liferay.portal</groupId>
57            <artifactId>com.liferay.portal.kernel</artifactId>
58            <version>${com.liferay.portal.kernel.version}</version>
59            <scope>provided</scope>
60        </dependency>
61
62        <dependency>
63            <groupId>org.osgi</groupId>
64            <artifactId>org.osgi.util.tracker</artifactId>
65            <version>${org.osgi.util.tracker.version}</version>
66            <scope>provided</scope>
67        </dependency>
68
69        <dependency>
70            <groupId>org.osgi</groupId>
71            <artifactId>org.osgi.core</artifactId>
72            <version>${org.osgi.core.version}</version>
73            <scope>provided</scope>
74        </dependency>
75<dependencies>


LiferayPortal 7 GA3/liferay-ce-portal-7.0-ga3/osgi/war][com_liferay_portal_osgi_web_wab_extender:97] Catastrophic initialization failure! Shutting down changePin-100 WAB due to: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
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.GeneratedMethodAccessor467.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.http.servlet.internal.registration.ListenerRegistration$EventListenerInvocationHandler.invoke(ListenerRegistration.java:132)
at com.sun.proxy.$Proxy479.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:526)
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.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1252)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1224)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:313)
Caused by: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:764)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:353)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
... 52 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:751)
... 54 more
Caused by: java.lang.NullPointerException
at com.liferay.faces.bridge.ext.mojarra.spi.internal.ConfigurationResourceProviderBase.getResourcesPattern(ConfigurationResourceProviderBase.java:51)
at com.liferay.faces.bridge.ext.mojarra.spi.internal.FacesConfigResourceProviderLiferayImpl.getResources(FacesConfigResourceProviderLiferayImpl.java:39)
at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1362)
at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1331)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:742)
... 54 more
16:54:37,263 INFO [fileinstall-C:/XPANDIT/CFG LiferayPortal 7 GA3/liferay-ce-portal-7.0-ga3/osgi/war][PortletHotDeployListener:364] Unregistering portlets for changePin-100
16:54:37,274 WARN [BridgeImpl:72]
16:54:37,278 INFO [fileinstall-C:/XPANDIT/CFG LiferayPortal 7 GA3/liferay-ce-portal-7.0-ga3/osgi/war][PortletHotDeployListener:394] 1 portlet for changePin-100 was unregistered
05-Jan-2017 16:54:37.280 INFO [fileinstall-C:/XPANDIT/CFG LiferayPortal 7 GA3/liferay-ce-portal-7.0-ga3/osgi/war] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext

And this is the exception that I got.

Does anyone know what may be causing the problem?

Thanks
Nuno Fontes
RE: JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 6, 2017 4:34 AM
Answer

Nuno Fontes

Rank: New Member

Posts: 4

Join Date: January 5, 2016

Recent Posts

Has anyone successfully tracked or called a *LocalService on a JSF portlet?

Thanks
Vernon Singleton
RE: JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 6, 2017 5:39 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Expert

Posts: 297

Join Date: January 14, 2013

Recent Posts

Hi Nuno,

Nuno Fontes:
Has anyone successfully tracked or called a *LocalService on a JSF portlet?

The primefaces-user-portlet demo does exactly that. Take a look at this code the code here to see for yourself.

Nuno Fontes:
I am developing a JSF portlet and call a service builder on it. I read the documentation and follow its instructions. You can see it in the code below

For the error(s) you noted, could you provide a short, self-contained, example that we could use to re-produce the errors? If you can do that, I would be happy to help you get your issue fixed.

By the way, did you start with one of our archetypes to make your project? It is a quick way to create a new working portlet, and it will help you get the versions correct for many of the basic jars you will need.

Hope that helps,
Vernon
Nuno Fontes
RE: JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 9, 2017 2:51 AM
Answer

Nuno Fontes

Rank: New Member

Posts: 4

Join Date: January 5, 2016

Recent Posts

Hi Vernon,

Thank your for your reply.

I am using this one: 25: remote -> com.liferay.faces.archetype:com.liferay.faces.archetype.jsf.portlet (Maven archetype for a Liferay JSF portlet)
Vernon Singleton
RE: JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 13, 2017 11:01 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Expert

Posts: 297

Join Date: January 14, 2013

Recent Posts

Hi Nuno,

Nuno Fontes:
I am using this one: 25: remote -> com.liferay.faces.archetype:com.liferay.faces.archetype.jsf.portlet (Maven archetype for a Liferay JSF portlet)

That looks like a good archetype to use, as long as it is the one for Liferay 7 in your case.

Did you get a chance to try the primefaces user portlet, and take a look at its example source that shows how to use a local service?

- Vernon
Nuno Fontes
RE: JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 17, 2017 8:44 AM
Answer

Nuno Fontes

Rank: New Member

Posts: 1

Join Date: January 11, 2017

Recent Posts

Thanks Vernon,

Problem solved!

Thank you!
Vernon Singleton
RE: JSF portlet + Service BUilder - Liferay 7 - Deployment problems
January 17, 2017 11:00 AM
Answer

Vernon Singleton

LIFERAY STAFF

Rank: Expert

Posts: 297

Join Date: January 14, 2013

Recent Posts

Hi Nuno,

Nuno Fontes:
Problem solved!

Thank you!

Glad you were able to get it working.
Enjoy.