I'm trying to call , from portlet B, a method of XXXLocalServiceUtil which has been created on portlet A with service builder. I have imported the exact same jar of portlet A in /WEB-INF/lib of portlet B but as it seems in the log a ClassNotFoundException is thrown. Any ideas?
Blockquote 13:04:25,904 ERROR [http-bio-8080-exec-77][render_portlet_jsp:132] null java.lang.RuntimeException: java.lang.ClassNotFoundException is not a valid exception at com.liferay.custom.action.service.AuditUserLocalServiceClp.addAuditUser(AuditUserLocalServiceClp.java:763) at com.liferay.custom.action.service.AuditUserLocalServiceUtil.addAuditUser(AuditUserLocalServiceUtil.java:287) at com.liferay.calendar.listeners.CalendarBookingListener.onAfterCreate(CalendarBookingListener.java:73) at com.liferay.calendar.listeners.CalendarBookingListener.onAfterCreate(CalendarBookingListener.java:1) at com.liferay.portal.model.BaseModelListener.onAfterCreate(BaseModelListener.java:1) at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.update(BasePersistenceImpl.java:337) at com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice.invoke(ShardPersistenceAdvice.java:54) at com.liferay.calendar.service.impl.CalendarBookingLocalServiceImpl.addCalendarBooking(CalendarBookingLocalServiceImpl.java:174) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115) at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62) at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56) at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111) Blockquote
Your XXXLocalServiceUtil will only available withing the Portlet A. To make your services available to both portlets, make them available globally on the server level.
In Tomcat you should put the services.jar file to /tomcat/lib/ext, and don't forget to remove that JAR from the portlet itself. Server must be restarted after this change.