4 Replies Latest reply on May 8, 2006 8:07 AM by silicio

    Failure in Deploying the Simplest of Portlets

    elam

      Hi all,

      I'm simply trying to print a 'hello world'.

      After my war file is dropped into the deployment directory, in the management portlet, under instances it always says "Portlet not deployed".

      Can someone tell me what I'm doing wrong, please?

      Here's my war file structure: - test2.war

      WEB-INF:
       classes
       Test2.class
       jboss-app.xml
       jboss-web.xml
       portal.xml
       test2-object.xml
       web.xml
      

      And the individual code for each file:
      Test2.class:
      
      mport java.io.PrintWriter;
      import java.io.IOException;
      
      import javax.portlet.GenericPortlet;
      import javax.portlet.RenderRequest;
      import javax.portlet.RenderResponse;
      import javax.portlet.PortletException;
      
      public class Test2 extends GenericPortlet {
       /**
       * The portlet's main view prints "Hello, World"
       */
      
       public void doView(RenderRequest request, RenderResponse response)
       throws PortletException, IOException
      
       {
       response.setContentType("text/html");
       PrintWriter out = response.getWriter();
      
       out.println("Hello, World");
       }
      
       public void render(RenderRequest rRequest, RenderResponse rResponse) throws javax.portlet.PortletException, IOException
       {
       rResponse.setTitle(getTitle(rRequest));
       doDispatch(rRequest, rResponse);
       }
      
      }
      



      jboss-app.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-app>
       <app-name>Test2</app-name>
      </jboss-app>
      

      jboss-web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
      </jboss-web>
      

      portal.xml
      <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd /opt/SUNWps/dtd/portlet.xsd"
       version="1.0">
       <portlet>
       <portlet-name>Test2Portlet</portlet-name>
       <portlet-class>com.whiteware.portlet.tests.Test2</portlet-class>
       <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>VIEW</portlet-mode>
       </supports>
       <portlet-info>
       <title>My Own JBoss Portlet</title>
       </portlet-info>
       </portlet>
      </portlet-app>
      

      test2-object.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <deployments>
       <deployment>
       <if-exists>overwrite</if-exists>
       <instance>
       <instance-name>Test2PortletInstance</instance-name>
       <component-ref>test2.Test2Portlet</component-ref>
       </instance>
       </deployment>
      </deployments>
      

      web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
      </web-app>