4

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?

Damodaran
  • 10,882
  • 10
  • 60
  • 81
VijayaRagavan
  • 221
  • 2
  • 15

2 Answers2

2

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

Udo Held
  • 12,314
  • 11
  • 67
  • 93
0

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

mgill
  • 28
  • 4