VijayaRagavan
VijayaRagavan

Reputation: 221

[java.lang.ClassCastException: CustomPortlet incompatible with javax.portlet.Portlet

I tried creating portlet using MyEclipse following MyEclipse tutorial. I did all the stesps and exported project as WAR. When installed it to the Portal and put it on a page, it said "This portlet is unavailable".

Find the related discussion here.

The exception is: SRVE0068E: An exception was thrown by one of the service methods of the servlet [CustomPortlet] in application [PA_Vijay]. Exception created : [java.lang.ClassCastException: CustomPortlet incompatible with javax.portlet.Portlet

This is my java code:

import java.io.IOException;
import java.io.PrintWriter;

import javax.portlet.GenericPortlet;
import javax.portlet.PortletConfig;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import javax.portlet.UnavailableException;


public class CustomPortlet extends GenericPortlet {

    /**
     * Helper method to serve up the view mode.
     */

    public void init(PortletConfig pc)throws UnavailableException, PortletException{

        super.init(pc);
    }

    protected void doView(RenderRequest request, RenderResponse response)
            throws PortletException, IOException {
        response.setContentType("text/html");
        PrintWriter writer = response.getWriter();
        writer.print("<p>This is the custom portlet created from MyEclipseIDE</p>");
    }

}

Where lies the problem?

Upvotes: 4

Views: 1586

Answers (2)

mgill
mgill

Reputation: 28

Portlet capability in eclipse is probably creating the project for Pluto server. The jars in the lib folder maybe conflicting with the Websphere Portal runtime.

  1. Empty the Web-INF/lib folder and give it shot.
  2. Or you could just create a Dynamic Web project and mimic the file/folder structure from a working websphere portlet sample
  3. Or import a websphere portal sample portlet and modify that to suit your needs.

Hope this helps

Upvotes: 0

Udo Held
Udo Held

Reputation: 12538

Check that you don't deploy the portlet-api.jar with your application. If you deploy it with your application it can cause problems.

Upvotes: 2

Related Questions