Foren

Liferay 7 NoClassDefFoundError on module

Sébastien B, geändert vor 1 Jahr.

Liferay 7 NoClassDefFoundError on module

New Member Beiträge: 17 Beitrittsdatum: 07.11.12 Neueste Beiträge
Hello,

I have an issue concerning dependence package between two module.

On my first module, i have a simple class i would like to export :

package com.example.portlet;

public class TestAnoUtil {

}


bnd.bnd :
Bundle-SymbolicName: testano.dependencies
Bundle-Version: 1.0.0
Export-Package: com.example.portlet


On my second module, i have a component which has a method with TestAnoUtil return :
package com.example.portlet;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
import javax.portlet.Portlet;
import org.osgi.service.component.annotations.Component;
@Component(
	immediate = true,
	service = Portlet.class
)
public class TestanoWebmvcportletPortlet extends MVCPortlet {
	public TestAnoUtil getTesAnoUtil(){
		return null;	
	}
}


No Issue to build those modules but when i deploy it, both of them are Started and Active in gogo shell but i have an exception immediatly after :
13:41:34,345 ERROR [Framework Event Dispatcher: Equinox Container: f0c3b115-00d8-0016-1bc5-d337d0d8c24f][com_liferay_portal_osgi_web_portlet_tracker:97] FrameworkEvent ERROR 
java.lang.NoClassDefFoundError: com/example/portlet/TestAnoUtil
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetPublicMethods(Class.java:2902)
	at java.lang.Class.getMethods(Class.java:1615)

Caused by: java.lang.ClassNotFoundException: com.example.portlet.TestAnoUtil cannot be found by testano.web_1.0.0
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:444)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:357)


Any ideas ? Thanks !

Sébastien
thumbnail
Jaydip Lakhatariya, geändert vor 7 Jahren.

RE: Liferay 7 NoClassDefFoundError on module

Junior Member Beiträge: 53 Beitrittsdatum: 18.04.13 Neueste Beiträge
Hi,

Make sure you have deployed both modules in liferay and have proper dependencies in gradle file.

Regards,
Jaydip
Sébastien B, geändert vor 1 Jahr.

RE: Liferay 7 NoClassDefFoundError on module

New Member Beiträge: 17 Beitrittsdatum: 07.11.12 Neueste Beiträge
Yes, both module are well deployed and 'Active' (checked with Gogo Shell)

On my main module, i've also imported my dependencies with gradle :

compile project(':modules:testano:testano-dependencies')



Sébastien
thumbnail
Jaydip Lakhatariya, geändert vor 7 Jahren.

RE: Liferay 7 NoClassDefFoundError on module

Junior Member Beiträge: 53 Beitrittsdatum: 18.04.13 Neueste Beiträge
Hi,

I don't see you have imported class TestAnoUtil into your second module. Does this two separate module projects ?

Regards,
Jaydip
Sébastien B, geändert vor 1 Jahr.

RE: Liferay 7 NoClassDefFoundError on module

New Member Beiträge: 17 Beitrittsdatum: 07.11.12 Neueste Beiträge
I've not imported it. The fact to import this package in the second module should be automatic because i've exported it on my first module. In addition, i don't have error import/package thrown when i check with gogo shell.
Kushagra Khanna, geändert vor 6 Jahren.

RE: Liferay 7 NoClassDefFoundError on module

Junior Member Beiträge: 45 Beitrittsdatum: 28.12.14 Neueste Beiträge
Hi,

Have you resolved this issue ?
I am facing the same issue, please share steps that you have followed to resolve the same.

Thanks,
Kushagra