I get the error:
Caused by: java.lang.ClassCastException: com.xxx.JbossBirtPortlet cannot be cast to javax.portlet.Portlet
at org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl.start(PortletContainerImpl.java:254)
The error is because of a Classloader conflict of tomcat and my portlet, that loads file portlet.jar according to these links: https://community.jboss.org/thread/81246?tstart=0
Deploying a simple Portlet to Liferay - ClassCastException
Then the problem: I need portlet.jar to build my war but my war must not contain portlet.jar, because then arises a ClassLoader conflict.I can not delete portlet.jar from tomcat, because it is needed to other portlets.
So how do I resolve this?
Then the problem: I need portlet.jar to build my war but my war must not contain portlet.jar, because then arises a ClassLoader conflict.I can not delete portlet.jar from tomcat, because it is needed to other portlets.
Correct, you shouldn't include these classes in your WAR if they're provided by the application server.
If you're using Maven, mark your dependency on the portlet API as <scope>provided</scope>
. It will be available when your WAR is built, but won't be included in the WAR. If you're not using Maven, RTFM on how to achieve similar functionality with your build tool.