Foros de discusión

NoClassDefFoundError OSGi ServiceBuilder MVCPortlet

Phill Pover, modificado hace 7 años.

NoClassDefFoundError OSGi ServiceBuilder MVCPortlet

New Member Mensajes: 16 Fecha de incorporación: 26/01/11 Mensajes recientes
Hi all,

I'm struggling with trying to include an OSGi service builder module in an MVCPortlet. I've built both with Maven artifacts, and all seems to compile and install correctly, but no matter what, I get a NoClassDefFoundError when trying to create an object.

09:23:54,097 INFO  [Refresh Thread: Equinox Container: 40017fb2-c312-0017-1949-a29b717a00fc][BundleStartStopLogger:35] STARTED uk.ac.uea.portlet.myday.service_0.0.1.201703270921 [42]
09:23:55,768 INFO  [Refresh Thread: Equinox Container: 40017fb2-c312-0017-1949-a29b717a00fc][BundleStartStopLogger:35] STARTED com.liferay.server.admin.web_1.0.8 [412]
09:23:56,059 INFO  [Refresh Thread: Equinox Container: 40017fb2-c312-0017-1949-a29b717a00fc][BundleStartStopLogger:35] STARTED uk.ac.uea.portlet.myday.web_0.0.1.201703270921 [492]
09:23:56,147 INFO  [Refresh Thread: Equinox Container: 40017fb2-c312-0017-1949-a29b717a00fc][BundleStartStopLogger:35] STARTED uk.ac.uea.portlet.myday.api_0.0.1.201703270921 [44]
09:24:32,804 ERROR [http-nio-8080-exec-1][status_jsp:950] com.liferay.portal.kernel.portlet.PortletContainerException: com.liferay.portal.kernel.portlet.PortletContainerException: javax.servlet.ServletException: java.lang.NoClassDefFoundError: uk/ac/uea/portlet/myday/model/Subscription


I can use the objects created in Service Builder on the script console within Liferay, so I'm pretty confident that the service builder part is working, but whenever I try to load the page with my portlet on it, it give the NoClassDefFoundError.

Excerpts of code, if it helps:

@Override
	public void doView(RenderRequest request, RenderResponse response)
		throws PortletException, IOException {
		
		...
			
			Subscription s = getSubscriptionLocalService().createSubscription((long) 1);
			s.setName("test subscription");
			s.isNew();
			getSubscriptionLocalService().addSubscription(s);
                ...
                }

@Reference
	private volatile SubscriptionLocalService _subscriptionLocalService;
	
	public SubscriptionLocalService getSubscriptionLocalService() {
		return _subscriptionLocalService;
	}


What am I missing?

Thanks,
-Phill
Phill Pover, modificado hace 7 años.

RE: NoClassDefFoundError OSGi ServiceBuilder MVCPortlet (Respuesta)

New Member Mensajes: 16 Fecha de incorporación: 26/01/11 Mensajes recientes
So I’ve figured out the issue. I had a package in my portlet with the same package name as one generated by the service builder project. The dependency analyser was seeing the internal package and labelling it as private, which caused the one from service builder to be considered in the same way.

Renamed the package in my project and all is working fine now.

Thanks anyway.