ServiceWrapper issue

thumbnail
Shiva Lingam K, modified 6 Years ago. New Member Posts: 18 Join Date: 5/9/18 Recent Posts
Hi everyone,

I am creating Servicewrapper hook on CalendarBooking in Liferay 7.2.While I am using the below code i am getting the following exception

public CalEventLocalServiceHook(CalendarBookingLocalService calendarBookingLocalService) {
super(calendarBookingLocalService);
}

@Override
public CalendarBooking updateCalendarBooking(long userId, long calendarBookingId, long calendarId,
Map<Locale, String> titleMap, Map<Locale, String> descriptionMap, String location, long startTime,
long endTime, boolean allDay, String recurrence, long firstReminder, String firstReminderType,
long secondReminder, String secondReminderType, ServiceContext serviceContext) throws PortalException {

System.out.println("CalendarBooking Service Wrapper............");
return super.updateCalendarBooking(userId, calendarBookingId, calendarId, titleMap, descriptionMap, location, startTime,
endTime, allDay, recurrence, firstReminder, firstReminderType, secondReminder, secondReminderType,
serviceContext);
}

2019-08-19 12:02:14.497 ERROR [fileinstall-D:/Liferay 7.2/liferay-dxp-7.2.10-ga1/osgi/modules][CalEventLocalServiceHook:93] bundle ca.cityofkingston.hooks:1.0.0 (1105)[ca.cityofkingston.hooks.CalEventLocalServiceHook(5064)] : Constructor with 0 arguments not found. Component will fail. 
2019-08-19 12:02:14.499 ERROR [fileinstall-D:/Liferay 7.2/liferay-dxp-7.2.10-ga1/osgi/modules][CalEventLocalServiceHook:93] bundle ca.cityofkingston.hooks:1.0.0 (1105)[ca.cityofkingston.hooks.CalEventLocalServiceHook(5064)] :  Error during instantiation of the implementation object: Constructor not found. 
2019-08-19 12:02:14.500 WARN  [Framework Event Dispatcher: Equinox Container: 3d6792b6-f581-41e0-a425-a9454bcba16a][Framework:99] FrameworkEvent WARNING 
org.osgi.framework.ServiceException: org.apache.felix.scr.impl.manager.SingleComponentManager.getService() returned a null service object
    at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:232)
    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:524)
    at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:464)
    at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:624)
    at com.liferay.registry.internal.RegistryImpl.getService(RegistryImpl.java:182)
    at com.liferay.portal.deploy.hot.ServiceWrapperRegistry$ServiceWrapperServiceTrackerCustomizer.addingService(ServiceWrapperRegistry.java:66)
    at com.liferay.portal.deploy.hot.ServiceWrapperRegistry$ServiceWrapperServiceTrackerCustomizer.addingService(ServiceWrapperRegistry.java:57)
    at com.liferay.registry.internal.ServiceTrackerCustomizerAdapter.addingService(ServiceTrackerCustomizerAdapter.java:35)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(A or.java:263)
 )

2019-08-19 12:02:14.502 ERROR [fileinstall-D:/Liferay 7.2/liferay-dxp-7.2.10-ga1/osgi/modules][CalEventLocalServiceHook:93] bundle ca.cityofkingston.hooks:1.0.0 (1105)[ca.cityofkingston.hooks.CalEventLocalServiceHook(5064)] :  Error during instantiation of the implementation object: Constructor not found. 
2019-08-19 12:02:14.504 ERROR [Framework Event Dispatcher: Equinox Container: 3d6792b6-f581-41e0-a425-a9454bcba16a][Framework:93] FrameworkEvent ERROR 
java.lang.NullPointerException
    at com.liferay.portal.deploy.hot.ServiceWrapperRegistry$ServiceWrapperServiceTrackerCustomizer.addingService(ServiceWrapperRegistry.java:75)
    at com.liferay.portal.deploy.hot.ServiceWrapperRegistry$ServiceWrapperServiceTrackerCustomizer.addingService(ServiceWrapperRegistry.java:57)
    at com.liferay.registry.internal.ServiceTrackerCustomizerAdapter.addingService(ServiceTrackerCustomizerAdapter.java:35)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:943)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
    

Can anyone help me how to resolve the issue?Thanks,Shiva
thumbnail
David H Nebinger, modified 6 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
So you have to make a constructor with no arguments, inside the constructor call super(null);.

For OSGi, it won't know what arguments to pass in, so it wants a no-arg instructor. Later it will inject the service being wrapped by calling the setCalendarBookingLocalService(svc) method.