Liferay 6.2 on Apache Tomcat 7: How to fix ClassNotFoundException
If you’re getting ClassNotFoundException while deploying Liferay portlet (mine is named Foobar) and you think your code is all right, maybe you should try to delete directories listed bellow.
I assume that you performed mvn clean install (in case you build with Apache Maven), so all classes are availabile (this applies in case if you have some classes generated through JAXB etc.).
But first of all remove portlet and stop server, bellow are steps to perform using Eclipse IDE:
- In Eclipse Liferay’s perspective in tab Servers right click on portlet name and then click on remove.
- Then stop server.
After that use some commander and delete contents of directories listed bellow.
Delete whole content of directories temp and work:
C:\dev\liferay-portal-6.2-ce-ga2\tomcat-7.0.42\temp
C:\dev\liferay-portal-6.2-ce-ga2\tomcat-7.0.42\work
Delete only folder Foobar-portlet in directory webapps (don’t delete whole content of directory webapps, otherwise you have to upload portal dependencies after that and that’s not desirable in our case):
C:\dev\liferay-portal-6.2-ce-ga2\tomcat-7.0.42\webapps\
You could also delete Foobar-portlet.xml from /conf/Catalinalocalhost
C:\dev\liferay-portal-6.2-ce-ga2\tomcat-7.0.42\conf\Catalina\localhost