You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-user@portals.apache.org by Søren Blidorf <so...@nolas.dk> on 2010/06/03 11:58:27 UTC

Help setting up hello world

Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 


Re: SV: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Yep. See: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

Basically in Maven 2:

src/main/java/ - is the start of all classes to be compiled for the jar or war
src/main/resources/ - this stuff goes into WEB-INF/classes in war package, so it is a good place for properties files, for example (and i18n/resource bundles would go under packages under this, etc.). You could just as easily use src/main/webapp/WEB-INF/classes, but don't do that because... well, because I said so. ;)
src/main/webapp/ this is the root of the expanded war in the war package, so something you want in (expanded war root dir)/WEB-INF/web.xml would go into src/main/webapp/WEB-INF

and for unit tests, src/test/... is like src/main/... but just used for unit tests/surefire

The link mentioned above describes more, but those are the ones you'll deal with most for webapps and portlets. And there are other Maven 2 paths under target/ that are generated during build/etc. In the end, the war goes into the target dir.

One that is helpful to know sooner rather than later is (in pom.xml):
     <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <warName>portletname</warName>
                    ...

Defining the warName will make sure that the filename of the war stays the same regardless of the version specified for the project/war/artifact.

There are many other things about Maven 2 to learn though, and although it can be a little frustrating at first, it is an awesome build and dependency management tool.

Gary


On Jun 3, 2010, at 3:01 PM, Søren Blidorf wrote:

> That did it.
>  
> My mistake was that I read the directory diagram so that webapp goes in java. :o/
>  
> HelloWorldPortlet (top level directory)
>                       |- pom.xml (the pom file)
>                       |- src (Subdir containing main subdirectory)
>                           |- main (Subdir containing java, resources and webapp subdirs)
>                                             |- java (java source code goes under here)
>                                                 |       `- com
>                                                 |           `- mycompany
>                                                 |               `- portlet
>                                                 |                   `- HelloWorldPortlet.java (portlet source)
>                                                 |- webapp  (webapp resources (jsp, css, images) go under here)
>                                                                   `- jsp
>                                                                                         `- HelloWorldPortletView.jsp (for view mode)                                                                                                 
>                                                                                         `- HelloWorldPortletEdit.jsp (for edit mode)                                                                                                   
>                                                                   `- META-INF
>                                                                                         `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
>                                                                   `- WEB-INF
>                                                                                        `- portlet.xml (JSR-168 deployment descriptor)
>                                                                                        `- web.xml (This will be modified by maven-pluto-plugin)
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:15
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: Help setting up hello world
>  
> To be more literally answering your question, and copying pasting code from that wiki page in large part, it might look like this:
>  
> ---start src/main/java/helloworld/HelloWorld.java which after war deployed becomes /path/to/tomcat/webapps/webapp_name/WEB-INF/classes/helloworld/HelloWorld.java ---
> package helloworld;
> import javax.portlet.*; 
> import java.io.*; 
>  
> public class HelloWorld extends GenericPortlet { 
>    public void doView(RenderRequest request,RenderResponse response) 
>       throws PortletException,IOException { 
>  
>       // Get our preferences
>       PortletPreferences pref = request.getPreferences();
>  
>       // Get the value of "displaytext" from our preferences, if not available,
>       // then use the second string passed to the function
>       String displayText = pref.getValue("displaytext", "MISSING: display-text");
>       // displays the string from our preferences
>  
>       response.setContentType(request.getResponseContentType()); 
>       PrintWriter writer = response.getWriter(); 
>       writer.write(displayText); 
>    } 
> }
> ---end HelloWorld.java---
>  
> ---start src/main/webapp/WEB-INF/web.xml which after war deployed becomes /path/to/tomcat/webapps/webapp_name/WEB-INF/web.xml ---
> <?xml version="1.0" encoding="ISO-8859-1"?> 
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
>    "http://java.sun.com/dtd/web-app_2_3.dtd">
>  
> <web-app>
>    <display-name>HelloWorld</display-name>
>    <description>Hello World Portlet</description>
> </web-app>
> ---end web.xml---
>  
> ---start src/main/webapp/WEB-INF/portlet.xml after war deployed becomes /path/to/tomcat/webapps/webapp_name/WEB-INF/portlet.xml ---
> <?xml version="1.0" encoding="UTF-8"?>
> <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0"> 
>    <portlet> 
>       <portlet-name>HelloWorld</portlet-name> 
>       <portlet-class>helloworld.HelloWorld</portlet-class> 
>       <expiration-cache>0</expiration-cache> 
>       <supports> 
>          <mime-type>text/html</mime-type> 
>          <portlet-mode>VIEW</portlet-mode> 
>       </supports> 
>       <supported-locale>en</supported-locale>
>       <portlet-info> 
>          <title>HelloWorld</title> 
>          <keywords>Hello, world, test</keywords>
>       </portlet-info>
>       <portlet-preferences>
>          <preference>
>             <name>displaytext</name>
>             <value>Hello, from your preferences</value>
>          </preference>
>       </portlet-preferences>
>    </portlet>
> </portlet-app>
> ---end portlet.xml---
>  
> with Pluto related jars put into /path/to/tomcat/shared/lib (and if tomcat6 then /path/to/tomcat/conf/server.xml modified to support use of shared/lib).
>  
> On Jun 3, 2010, at 2:01 PM, Gary Weaver wrote:
> 
> 
> If you look at that second link I sent:
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
>  
> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <display-name>yourportletname</display-name>
>     <description>Description of the portlet</description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>
>             /WEB-INF/context/portlet/nameofyourportlet.xml
>         </param-value>
>     </context-param>
>     <context-param>
>         <param-name>webAppRootKey</param-name>
>         <param-value>some.parent.package.newofyourportlet</param-value>
>     </context-param>
>     <listener>
>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>     </listener>
>     <listener>
>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
>     <servlet>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>     </servlet-mapping>
> </web-app>
>  
> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
>  
> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
>  
> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
>  
> Gary
>  
>  
> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
> 
> 
> Thanks Gary. I will look at it.
>  
> When I use mvn package I get a build error - invalid web.xml.
>  
> Does anybody know what is needed in the web.xml for maven to concider it valid?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 17:22
> Til: pluto-user@portals.apache.org
> Emne: Re: Help setting up hello world
>  
> Soren,
>  
> Assuming you are talking about this hello world example?:
> http://portals.apache.org/pluto/v20/deploying.html
>  
> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> Some other example portlets are here:
> https://source.jasig.org/portlets/
> there are also some in here but not all of these work:
> https://source.jasig.org/sandbox/
>  
> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>  
> Some miscellaneous tips/notes:
> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>  
> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>  
> Wish I could provide more info, but maybe some of that will help.
>  
> Gary
>  
>  
> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>  
> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>  
>  
>  
>  


SV: SV: Help setting up hello world

Posted by Søren Blidorf <so...@nolas.dk>.
That did it.

 

My mistake was that I read the directory diagram so that webapp goes in
java. :o/

 

HelloWorldPortlet (top level directory)

                      |- pom.xml (the pom file)

                      |- src (Subdir containing main subdirectory)

                          |- main (Subdir containing java, resources and
webapp subdirs)

                                            |- java (java source code goes
under here)

                                                |       `- com

                                                |           `- mycompany

                                                |               `- portlet

                                                |                   `-
HelloWorldPortlet.java (portlet source)

                                                |- webapp  (webapp resources
(jsp, css, images) go under here)

                                                                  `- jsp 

 
`- HelloWorldPortletView.jsp (for view mode)


 
`- HelloWorldPortletEdit.jsp (for edit mode)


                                                                  `-
META-INF

 
`- HelloWorldPortlet.xml (Tomcat context deployment descriptor)

                                                                  `- WEB-INF

 
`- portlet.xml (JSR-168 deployment descriptor)

 
`- web.xml (This will be modified by maven-pluto-plugin)

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:15
Til: pluto-user@portals.apache.org
Emne: Re: SV: Help setting up hello world

 

To be more literally answering your question, and copying pasting code from
that wiki page in large part, it might look like this:

 

---start src/main/java/helloworld/HelloWorld.java which after war deployed
becomes
/path/to/tomcat/webapps/webapp_name/WEB-INF/classes/helloworld/HelloWorld.ja
va ---

package helloworld;

import javax.portlet.*; 

import java.io.*; 

 

public class HelloWorld extends GenericPortlet { 

   public void doView(RenderRequest request,RenderResponse response) 

      throws PortletException,IOException { 

 

      // Get our preferences

      PortletPreferences pref = request.getPreferences();

 

      // Get the value of "displaytext" from our preferences, if not
available,

      // then use the second string passed to the function

      String displayText = pref.getValue("displaytext", "MISSING:
display-text");

      // displays the string from our preferences

 

      response.setContentType(request.getResponseContentType()); 

      PrintWriter writer = response.getWriter(); 

      writer.write(displayText); 

   } 

}

---end HelloWorld.java---

 

---start src/main/webapp/WEB-INF/web.xml which after war deployed becomes
/path/to/tomcat/webapps/webapp_name/WEB-INF/web.xml ---

<?xml version="1.0" encoding="ISO-8859-1"?> 

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" 

   "http://java.sun.com/dtd/web-app_2_3.dtd">

 

<web-app>

   <display-name>HelloWorld</display-name>

   <description>Hello World Portlet</description>

</web-app>

---end web.xml---

 

---start src/main/webapp/WEB-INF/portlet.xml after war deployed becomes
/path/to/tomcat/webapps/webapp_name/WEB-INF/portlet.xml ---

<?xml version="1.0" encoding="UTF-8"?>

<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd"
version="1.0"> 

   <portlet> 

      <portlet-name>HelloWorld</portlet-name> 

      <portlet-class>helloworld.HelloWorld</portlet-class> 

      <expiration-cache>0</expiration-cache> 

      <supports> 

         <mime-type>text/html</mime-type> 

         <portlet-mode>VIEW</portlet-mode> 

      </supports> 

      <supported-locale>en</supported-locale>

      <portlet-info> 

         <title>HelloWorld</title> 

         <keywords>Hello, world, test</keywords>

      </portlet-info>

      <portlet-preferences>

         <preference>

            <name>displaytext</name>

            <value>Hello, from your preferences</value>

         </preference>

      </portlet-preferences>

   </portlet>

</portlet-app>

---end portlet.xml---

 

with Pluto related jars put into /path/to/tomcat/shared/lib (and if tomcat6
then /path/to/tomcat/conf/server.xml modified to support use of shared/lib).

 

On Jun 3, 2010, at 2:01 PM, Gary Weaver wrote:





If you look at that second link I sent:

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

It has an example simple web.xml, portlet.xml, etc. If you are new to Java
or Java web applications, you probably out to read up on that and Maven
prior to getting into the portlet side of things, though.

 

As for where to go after Hello World, I lot of people use Spring Portlet
MVC, in which case you might do something like this in web.xml (I tried to
strip out the unnecessary parts, but not sure how good of a job I did):

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>yourportletname</display-name>

    <description>Description of the portlet</description>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>

            /WEB-INF/context/portlet/nameofyourportlet.xml

        </param-value>

    </context-param>

    <context-param>

        <param-name>webAppRootKey</param-name>

        <param-value>some.parent.package.newofyourportlet</param-value>

    </context-param>

    <listener>

 
<listener-class>org.springframework.web.util.WebAppRootListener</listener-cl
ass>

    </listener>

    <listener>

 
<listener-class>org.springframework.web.context.ContextLoaderListener</liste
ner-class>

    </listener>

    <servlet>

        <servlet-name>ViewRendererServlet</servlet-name>

 
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-
class>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

        <servlet-name>ViewRendererServlet</servlet-name>

        <url-pattern>/WEB-INF/servlet/view</url-pattern>

    </servlet-mapping>

</web-app>

 

And could look at this as an example of spring context, pom.xml,
portlet.xml, etc.:
https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/

 

There are also a Grails Portlet project and a Rails-portlet project, I think
both aimed at JSR-286 implementations like Liferay (I know the latter is at
the moment).

 

If you want to see what is it really doing in the assembly portion, look at
FileAssembler.java. For example I found it here:

http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apach
e/pluto/util/assemble/file/FileAssembler.java

 

Gary

 

 

On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:





Thanks Gary. I will look at it.

 

When I use mvn package I get a build error - invalid web.xml.

 

Does anybody know what is needed in the web.xml for maven to concider it
valid?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 17:22
Til: pluto-user@portals.apache.org
Emne: Re: Help setting up hello world

 

Soren,

 

Assuming you are talking about this hello world example?:

http://portals.apache.org/pluto/v20/deploying.html

 

I also just found another example, even though it is geared for uPortal
rather than the example Pluto server. (But uPortal uses Pluto and supports
JSR-168 compliant portlets, so should work.):

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

Some other example portlets are here:

https://source.jasig.org/portlets/

there are also some in here but not all of these work:

https://source.jasig.org/sandbox/

 

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are
still JSR-168), but that shouldn't matter afaik just to get something simple
working.

 

Some miscellaneous tips/notes:

* Pluto's jars should be in the shared/lib area, which requires some change
to the default Tomcat 6 config to have it look for. That is the most
appropriate place for it, afaik.

* Like any war, if you unzip the war, it should unzip its contents into the
current directory (i.e. is isn't unzipping into (webapp directory name)/...
). That is just a war thing, not specific to portlets. This only matters if
you tried to make the war by hand.

* Pluto's assembly API must be used to prep the war. There is a
maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto
assembly looks at the portlet.xml then modifies the web.xml and adds
portlet*.tld file(s).

* Even though Tomcat is much more lenient when it decompresses a war, Pluto
assembly (used by maven-pluto-plugin) uses the standard Java API to unjar
the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and
there should be only one manifest), it will choke (and the error is not that
helpful).

* Just because maven-pluto-plugin preps the war doesn't mean it is a valid
portlet (or even valid web.xml and portlet.xml for a portlet) or that it
will even register in Pluto afaik. You need to make sure that web.xml is
cleaned up and that you didn't try to add the stuff that Pluto assembly puts
into it. (For info on how to clean it up if you need that, see the unplutofy
project).

* In newer versions of pluto (not sure what version, but sometime between
1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So
you can someone tell if a portlet is available and at least valid enough for
Pluto to register it (although it still may not work) if the logs showed
that it registered. It may not register each time though? Registering is
different than just Tomcat deploying the war (it is the line right after
that in the logs usually, I think).

 

Hopefully none of that info is wrong, and please anyone feel free to correct
or clarify those.

 

Wish I could provide more info, but maybe some of that will help.

 

Gary

 

 

On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:

 

Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 

 

 

 


Re: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
To be more literally answering your question, and copying pasting code from that wiki page in large part, it might look like this:

---start src/main/java/helloworld/HelloWorld.java which after war deployed becomes /path/to/tomcat/webapps/webapp_name/WEB-INF/classes/helloworld/HelloWorld.java ---
package helloworld;
import javax.portlet.*; 
import java.io.*; 

public class HelloWorld extends GenericPortlet { 
   public void doView(RenderRequest request,RenderResponse response) 
      throws PortletException,IOException { 

      // Get our preferences
      PortletPreferences pref = request.getPreferences();

      // Get the value of "displaytext" from our preferences, if not available,
      // then use the second string passed to the function
      String displayText = pref.getValue("displaytext", "MISSING: display-text");
      // displays the string from our preferences

      response.setContentType(request.getResponseContentType()); 
      PrintWriter writer = response.getWriter(); 
      writer.write(displayText); 
   } 
}
---end HelloWorld.java---

---start src/main/webapp/WEB-INF/web.xml which after war deployed becomes /path/to/tomcat/webapps/webapp_name/WEB-INF/web.xml ---
<?xml version="1.0" encoding="ISO-8859-1"?> 
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
   <display-name>HelloWorld</display-name>
   <description>Hello World Portlet</description>
</web-app>
---end web.xml---

---start src/main/webapp/WEB-INF/portlet.xml after war deployed becomes /path/to/tomcat/webapps/webapp_name/WEB-INF/portlet.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0"> 
   <portlet> 
      <portlet-name>HelloWorld</portlet-name> 
      <portlet-class>helloworld.HelloWorld</portlet-class> 
      <expiration-cache>0</expiration-cache> 
      <supports> 
         <mime-type>text/html</mime-type> 
         <portlet-mode>VIEW</portlet-mode> 
      </supports> 
      <supported-locale>en</supported-locale>
      <portlet-info> 
         <title>HelloWorld</title> 
         <keywords>Hello, world, test</keywords>
      </portlet-info>
      <portlet-preferences>
         <preference>
            <name>displaytext</name>
            <value>Hello, from your preferences</value>
         </preference>
      </portlet-preferences>
   </portlet>
</portlet-app>
---end portlet.xml---

with Pluto related jars put into /path/to/tomcat/shared/lib (and if tomcat6 then /path/to/tomcat/conf/server.xml modified to support use of shared/lib).

On Jun 3, 2010, at 2:01 PM, Gary Weaver wrote:

> If you look at that second link I sent:
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
> 
> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
> 
> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <display-name>yourportletname</display-name>
>     <description>Description of the portlet</description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>
>             /WEB-INF/context/portlet/nameofyourportlet.xml
>         </param-value>
>     </context-param>
>     <context-param>
>         <param-name>webAppRootKey</param-name>
>         <param-value>some.parent.package.newofyourportlet</param-value>
>     </context-param>
>     <listener>
>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>     </listener>
>     <listener>
>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
>     <servlet>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>     </servlet-mapping>
> </web-app>
> 
> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
> 
> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
> 
> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
> 
> Gary
> 
> 
> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
> 
>> Thanks Gary. I will look at it.
>>  
>> When I use mvn package I get a build error - invalid web.xml.
>>  
>> Does anybody know what is needed in the web.xml for maven to concider it valid?
>>  
>> Soren
>>  
>> -----Oprindelig meddelelse-----
>> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
>> Sendt: 3. juni 2010 17:22
>> Til: pluto-user@portals.apache.org
>> Emne: Re: Help setting up hello world
>>  
>> Soren,
>>  
>> Assuming you are talking about this hello world example?:
>> http://portals.apache.org/pluto/v20/deploying.html
>>  
>> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
>> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>>  
>> Some other example portlets are here:
>> https://source.jasig.org/portlets/
>> there are also some in here but not all of these work:
>> https://source.jasig.org/sandbox/
>>  
>> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>>  
>> Some miscellaneous tips/notes:
>> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
>> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
>> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
>> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
>> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
>> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>>  
>> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>>  
>> Wish I could provide more info, but maybe some of that will help.
>>  
>> Gary
>>  
>>  
>> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>> 
>> 
>> Hi.
>>  
>> I am new to portlets and Pluto.
>>  
>> I have installed Pluto on my existing Tomcat and it works fine.
>>  
>> However I am having difficulties setting up a helloworld portlet.
>>  
>> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>>  
>> I have tried different examples on google, but nothing works.
>>  
>> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>>  
>> Soren
>>  
>>  
> 


Re: SV: SV: SV: SV: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Søren,

Only some of the jars need to go in that directory. Probably just the tld and api jars, but I'm not sure which ones right now.

Unfortunately I don't know much about the Pluto portal, so I can't help much. My guess from looking at the error is that the portlet did not register with Pluto for some reason.

You might try to make sure that the portlet will work in whatever the default distribution is of the Pluto portal is before trying to get it working in Tomcat.

Wish I had more time to help,

Gary


On Jun 7, 2010, at 3:44 AM, Søren Blidorf wrote:

> Hi Gary.
>  
> Thanks for all your effort.
>  
> I am using Tomcat 5.5 so I guess there should be no problems with shared/lib.
>  
> BUT, I tried to place a lib folder containing the Pluto/portlet jars in the webapps WEB-INF which changed the error message.
>  
> Can you tell if it’s a problem with the shared/lib? Also theme is mentioned it the error, should I do anything about theme in a simple helloworld example???
>  
> Without lib folder:
>  
> SEVERE: Unable to invoke portlet.  Resource /PlutoInvoker/HelloWorldPortlet unavailable for [Ljava.lang.String;@44b7f7 seconds.
> javax.servlet.UnavailableException: Portlet HelloWorldPortlet unavailable
>                       at org.apache.pluto.container.driver.PortletServlet.dispatch(PortletServlet.java:300)
>                       at org.apache.pluto.container.driver.PortletServlet.doGet(PortletServlet.java:261)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>                       at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
>                       at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
>                       at org.apache.pluto.driver.container.DefaultPortletInvokerService.invoke(DefaultPortletInvokerService.java:233)
>                       at org.apache.pluto.driver.container.DefaultPortletInvokerService.render(DefaultPortletInvokerService.java:117)
>                       at org.apache.pluto.container.impl.PortletContainerImpl.doRender(PortletContainerImpl.java:157)
>                       at org.apache.pluto.driver.tags.PortletTag.doStartTag(PortletTag.java:165)
>                       at org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspService(portlet_002dskin_jsp.java:79)
>                       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>                       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
>                       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>                       at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
>                       at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
>                       at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fforEach_005f1(pluto_002ddefault_002dtheme_jsp.java:505)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fotherwise_005f0(pluto_002ddefault_002dtheme_jsp.java:453)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fchoose_005f0(pluto_002ddefault_002dtheme_jsp.java:321)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspService(pluto_002ddefault_002dtheme_jsp.java:160)
>                       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>                       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
>                       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>                       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>                       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>                       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>                       at org.apache.pluto.driver.PortalDriverServlet.doGet(PortalDriverServlet.java:189)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>                       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
>                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>                       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>                       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>                       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>                       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>                       at java.lang.Thread.run(Unknown Source)
>  
> Error with lib in WEB-INF:
>  
> java.lang.NullPointerException
>                       at org.apache.pluto.container.impl.PortletContainerImpl.doRender(PortletContainerImpl.java:141)
>                       at org.apache.pluto.driver.tags.PortletTag.doStartTag(PortletTag.java:165)
>                       at org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspService(portlet_002dskin_jsp.java:79)
>                       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>                       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
>                       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>                       at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:574)
>                       at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:499)
>                       at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:965)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fforEach_005f1(pluto_002ddefault_002dtheme_jsp.java:505)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fotherwise_005f0(pluto_002ddefault_002dtheme_jsp.java:453)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth_c_005fchoose_005f0(pluto_002ddefault_002dtheme_jsp.java:321)
>                       at org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspService(pluto_002ddefault_002dtheme_jsp.java:160)
>                       at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
>                       at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
>                       at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
>                       at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
>                       at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
>                       at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
>                       at org.apache.pluto.driver.PortalDriverServlet.doGet(PortalDriverServlet.java:189)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>                       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
>                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>                       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
>                       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>                       at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>                       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>                       at java.lang.Thread.run(Unknown Source)
>  
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 4. juni 2010 16:19
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: SV: SV: SV: Help setting up hello world
>  
> Oops, instead of .tld files in shared/lib I meant pluto-taglib-2.0.1.jar should go in there (after you'd made mods to tomcat config to support shared/lib as part of classpath. And the some of the other pluto jars (api jar(s), ... ?) need to go in there as well.
>  
> Long story short- once you make that change to the pom.xml mentioned in last email to include the modified web.xml, as long as you have pluto-taglib-2.0.1.jar and whatever other jars needed for pluto/JSR-286 in tomcat/shared/lib, you don't need to worry about portlet*.tld in the portlet war (in fact the portlet tlds shouldn't be in the war in later versions of Pluto.
>  
>  
> On Jun 4, 2010, at 9:58 AM, Gary Weaver wrote:
> 
> 
> Søren,
>  
> It has been a long while since I looked at that plugin since in uPortal, Pluto assembly is called by an ant target, deployPortletApp.
>  
> It looks like you need to change the war plugin config so that it uses the web.xml that maven-pluto-plugin produces:
>  
>       <!-- configure maven-war-plugin to use updated web.xml -->
> 
>       <plugin>
> 
>         <artifactId>maven-war-plugin</artifactId>
> 
>         <configuration>
> 
>           <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
> 
>         </configuration>
> 
>       </plugin>
>  
> (when that plugin executes, it produces that modified web.xml which has to be explicitly included in the war)
>  
> btw- I saw that in an example here: http://wpcertification.blogspot.com/2010/04/maven-script-to-build-flex-portlet.html
>  
> As for portlet.tld (and actually I think that may not be the exact name of it in Pluto 2.x), it looks like it doesn't add that tag library file to the war like happens in uPortal with deployPortletApp.
>  
> I can't think of a reason those tag library (tld) files shouldn't just be put into tomcat/shared/lib so I'm guessing that is where they should go instead in Pluto 2.x.
>  
> In your tomcat dir, do a recursive find for *.tld files and odds are when you installed Pluto, it already put them somewhere. I'm guessing you used this to install Pluto? Again, since I use uPortal, I'm not familiar with it- these instructions look like they are for Pluto 1.1 but perhaps they work for Pluto 2?:
> http://portals.apache.org/pluto/app-servers.html
>  
> And I'm guessing the Pluto 2 bundle comes with the tld also, but again- I didn't check:
> http://portals.apache.org/pluto/v20/getting-started.html
>  
> I'm sorry for the confusion! I'm a little new to Pluto 2.x and mostly just used to uPortal. :P
>  
> Thanks!
> Gary
>  
>  
> On Jun 4, 2010, at 1:48 AM, Søren Blidorf wrote:
> 
> 
> My war don’t contain the portlet.tld.
>  
> As I understand you that is created by Maven from my pom.xml. So I guess something is wrong with my pom.xml.
>  
> I have created it as in the example in Pluto/deploying. Would you look at my attached pom.xml?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 21:47
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: SV: SV: Help setting up hello world
>  
> Some things to check:
>  
> 1. Make sure that you did whatever was necessary to have Pluto assembly modify web.xml and have it add portlet.tld to your war (you don't add those things- it does). This is done via the pluto-maven-plugin which you'd need to setup in your pom.xml and make sure it is using the same version of Pluto as is in Tomcat or it won't work. (That is not discussed on the page I sent, because uPortal uses an ant target to do that (deployPortletApp).)
>  
> 2. If the deployed war contains the web.xml modification by Pluto and the portlet.tld file, then make sure when it deployed that in tomcat/logs/catalina.out (or in some log in there) it shows that the portlet registered (I think- at least that is what happens in uPortal).
>  
> Note that you cannot visit the http://localhost:8080/helloworld/ directly. It can only be viewed within the portal. Unfortunately I can't tell you how to manage portlets within Pluto portal. Hopefully there is documentation about that somewhere. :(
>  
> Gary
>  
>  
> On Jun 3, 2010, at 3:32 PM, Søren Blidorf wrote:
>  
> I have now created a page on pluto and added my HelloWorldPortlet.
>  
> When I open the page I get: HelloWorldPortlet not ready.
>  
> Does anybody know what that means? I get no errors in the log!
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:20
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: SV: Help setting up hello world
>  
> Try a simpler example first (the one I sent and in the wiki page I sent) first. After that, if you haven't figured it out, copy all of the source (pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the body of the email saying what is what, and copy and paste how you ran maven and exactly what it output, so people can help.
>  
> Thanks!
> Gary
>  
>  
> On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:
>  
> The problem is that there is nothing wrong with my web.xml.
>  
> No matter what I try including web.xml from the second link I get the same error.
>  
> Could it be that it cannot find it?
>  
> My file structure is:
>  
> HelloWorldPortlet (top level directory)
>         |- pom.xml (the pom file)
>         |- src (Subdir containing main subdirectory)
>             |- main (Subdir containing java, resources and webapp subdirs)
>                 |- java (java source code goes under here)
>                    |       `- com
>                    |           `- mycompany
>                    |               `- portlet
>                    |                   `- HelloWorldPortlet.java (portlet source)
>                    |- webapp  (webapp resources (jsp, css, images) go under here)
>                        `- jsp
>                               `- HelloWorldPortletView.jsp (for view mode)                               
>                               `- HelloWorldPortletEdit.jsp (for edit mode)                               
>                        `- META-INF
>                               `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
>                        `- WEB-INF
>                                `- portlet.xml (JSR-168 deployment descriptor)
>                                `- web.xml (This will be modified by maven-pluto-plugin)
>  
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:01
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: Help setting up hello world
>  
> If you look at that second link I sent:
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
>  
> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <display-name>yourportletname</display-name>
>     <description>Description of the portlet</description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>
>             /WEB-INF/context/portlet/nameofyourportlet.xml
>         </param-value>
>     </context-param>
>     <context-param>
>         <param-name>webAppRootKey</param-name>
>         <param-value>some.parent.package.newofyourportlet</param-value>
>     </context-param>
>     <listener>
>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>     </listener>
>     <listener>
>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
>     <servlet>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>     </servlet-mapping>
> </web-app>
>  
> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
>  
> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
>  
> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
>  
> Gary
>  
>  
> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
>  
> Thanks Gary. I will look at it.
>  
> When I use mvn package I get a build error - invalid web.xml.
>  
> Does anybody know what is needed in the web.xml for maven to concider it valid?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 17:22
> Til: pluto-user@portals.apache.org
> Emne: Re: Help setting up hello world
>  
> Soren,
>  
> Assuming you are talking about this hello world example?:
> http://portals.apache.org/pluto/v20/deploying.html
>  
> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> Some other example portlets are here:
> https://source.jasig.org/portlets/
> there are also some in here but not all of these work:
> https://source.jasig.org/sandbox/
>  
> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>  
> Some miscellaneous tips/notes:
> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>  
> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>  
> Wish I could provide more info, but maybe some of that will help.
>  
> Gary
>  
>  
> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>  
> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>  
>  
>  
>  
>  
> <pom.xml>
>  
>  


SV: SV: SV: SV: SV: Help setting up hello world

Posted by Søren Blidorf <so...@nolas.dk>.
Hi Gary.

 

Thanks for all your effort.

 

I am using Tomcat 5.5 so I guess there should be no problems with
shared/lib.

 

BUT, I tried to place a lib folder containing the Pluto/portlet jars in the
webapps WEB-INF which changed the error message.

 

Can you tell if it’s a problem with the shared/lib? Also theme is mentioned
it the error, should I do anything about theme in a simple helloworld
example???

 

Without lib folder:

 

SEVERE: Unable to invoke portlet.  Resource /PlutoInvoker/HelloWorldPortlet
unavailable for [Ljava.lang.String;@44b7f7 seconds.

javax.servlet.UnavailableException: Portlet HelloWorldPortlet unavailable

                      at
org.apache.pluto.container.driver.PortletServlet.dispatch(PortletServlet.jav
a:300)

                      at
org.apache.pluto.container.driver.PortletServlet.doGet(PortletServlet.java:2
61)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)

                      at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)

                      at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)

                      at
org.apache.pluto.driver.container.DefaultPortletInvokerService.invoke(Defaul
tPortletInvokerService.java:233)

                      at
org.apache.pluto.driver.container.DefaultPortletInvokerService.render(Defaul
tPortletInvokerService.java:117)

                      at
org.apache.pluto.container.impl.PortletContainerImpl.doRender(PortletContain
erImpl.java:157)

                      at
org.apache.pluto.driver.tags.PortletTag.doStartTag(PortletTag.java:165)

                      at
org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspService(portlet_0
02dskin_jsp.java:79)

                      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)

                      at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)

                      at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)

                      at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)

                      at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)

                      at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
65)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth
_c_005fforEach_005f1(pluto_002ddefault_002dtheme_jsp.java:505)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth
_c_005fotherwise_005f0(pluto_002ddefault_002dtheme_jsp.java:453)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth
_c_005fchoose_005f0(pluto_002ddefault_002dtheme_jsp.java:321)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspServic
e(pluto_002ddefault_002dtheme_jsp.java:160)

                      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)

                      at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)

                      at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)

                      at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDis
patcher.java:463)

                      at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:398)

                      at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:301)

                      at
org.apache.pluto.driver.PortalDriverServlet.doGet(PortalDriverServlet.java:1
89)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)

                      at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)

                      at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:524)

                      at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)

                      at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)

                      at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)

                      at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

                      at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

                      at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)

                      at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)

                      at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)

                      at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)

                      at java.lang.Thread.run(Unknown Source)

 

Error with lib in WEB-INF:

 

java.lang.NullPointerException

                      at
org.apache.pluto.container.impl.PortletContainerImpl.doRender(PortletContain
erImpl.java:141)

                      at
org.apache.pluto.driver.tags.PortletTag.doStartTag(PortletTag.java:165)

                      at
org.apache.jsp.WEB_002dINF.themes.portlet_002dskin_jsp._jspService(portlet_0
02dskin_jsp.java:79)

                      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)

                      at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)

                      at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)

                      at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)

                      at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)

                      at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
65)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth
_c_005fforEach_005f1(pluto_002ddefault_002dtheme_jsp.java:505)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth
_c_005fotherwise_005f0(pluto_002ddefault_002dtheme_jsp.java:453)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspx_meth
_c_005fchoose_005f0(pluto_002ddefault_002dtheme_jsp.java:321)

                      at
org.apache.jsp.WEB_002dINF.themes.pluto_002ddefault_002dtheme_jsp._jspServic
e(pluto_002ddefault_002dtheme_jsp.java:160)

                      at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)

                      at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)

                      at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)

                      at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDis
patcher.java:463)

                      at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:398)

                      at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:301)

                      at
org.apache.pluto.driver.PortalDriverServlet.doGet(PortalDriverServlet.java:1
89)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

                      at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

                      at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)

                      at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)

                      at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:213)

                      at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)

                      at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:524)

                      at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)

                      at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)

                      at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)

                      at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

                      at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

                      at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)

                      at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)

                      at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)

                      at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)

                      at java.lang.Thread.run(Unknown Source)

 

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 4. juni 2010 16:19
Til: pluto-user@portals.apache.org
Emne: Re: SV: SV: SV: SV: Help setting up hello world

 

Oops, instead of .tld files in shared/lib I meant pluto-taglib-2.0.1.jar
should go in there (after you'd made mods to tomcat config to support
shared/lib as part of classpath. And the some of the other pluto jars (api
jar(s), ... ?) need to go in there as well.

 

Long story short- once you make that change to the pom.xml mentioned in last
email to include the modified web.xml, as long as you have
pluto-taglib-2.0.1.jar and whatever other jars needed for pluto/JSR-286 in
tomcat/shared/lib, you don't need to worry about portlet*.tld in the portlet
war (in fact the portlet tlds shouldn't be in the war in later versions of
Pluto.

 

 

On Jun 4, 2010, at 9:58 AM, Gary Weaver wrote:





Søren,

 

It has been a long while since I looked at that plugin since in uPortal,
Pluto assembly is called by an ant target, deployPortletApp.

 

It looks like you need to change the war plugin config so that it uses the
web.xml that maven-pluto-plugin produces:

 

      <!-- configure maven-war-plugin to use updated web.xml -->


      <plugin>


        <artifactId>maven-war-plugin</artifactId>


        <configuration>


 
<webXml>${project.build.directory}/pluto-resources/web.xml</webXml>


        </configuration>


      </plugin>

 

(when that plugin executes, it produces that modified web.xml which has to
be explicitly included in the war)

 

btw- I saw that in an example here:
http://wpcertification.blogspot.com/2010/04/maven-script-to-build-flex-portl
et.html

 

As for portlet.tld (and actually I think that may not be the exact name of
it in Pluto 2.x), it looks like it doesn't add that tag library file to the
war like happens in uPortal with deployPortletApp.

 

I can't think of a reason those tag library (tld) files shouldn't just be
put into tomcat/shared/lib so I'm guessing that is where they should go
instead in Pluto 2.x.

 

In your tomcat dir, do a recursive find for *.tld files and odds are when
you installed Pluto, it already put them somewhere. I'm guessing you used
this to install Pluto? Again, since I use uPortal, I'm not familiar with it-
these instructions look like they are for Pluto 1.1 but perhaps they work
for Pluto 2?:

http://portals.apache.org/pluto/app-servers.html

 

And I'm guessing the Pluto 2 bundle comes with the tld also, but again- I
didn't check:

http://portals.apache.org/pluto/v20/getting-started.html

 

I'm sorry for the confusion! I'm a little new to Pluto 2.x and mostly just
used to uPortal. :P

 

Thanks!

Gary

 

 

On Jun 4, 2010, at 1:48 AM, Søren Blidorf wrote:





My war don’t contain the portlet.tld.

 

As I understand you that is created by Maven from my pom.xml. So I guess
something is wrong with my pom.xml.

 

I have created it as in the example in Pluto/deploying. Would you look at my
attached pom.xml?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 21:47
Til: pluto-user@portals.apache.org
Emne: Re: SV: SV: SV: Help setting up hello world

 

Some things to check:

 

1. Make sure that you did whatever was necessary to have Pluto assembly
modify web.xml and have it add portlet.tld to your war (you don't add those
things- it does). This is done via the pluto-maven-plugin which you'd need
to setup in your pom.xml and make sure it is using the same version of Pluto
as is in Tomcat or it won't work. (That is not discussed on the page I sent,
because uPortal uses an ant target to do that (deployPortletApp).)

 

2. If the deployed war contains the web.xml modification by Pluto and the
portlet.tld file, then make sure when it deployed that in
tomcat/logs/catalina.out (or in some log in there) it shows that the portlet
registered (I think- at least that is what happens in uPortal).

 

Note that you cannot visit the http://localhost:8080/helloworld/ directly.
It can only be viewed within the portal. Unfortunately I can't tell you how
to manage portlets within Pluto portal. Hopefully there is documentation
about that somewhere. :(

 

Gary

 

 

On Jun 3, 2010, at 3:32 PM, Søren Blidorf wrote:

 

I have now created a page on pluto and added my HelloWorldPortlet.

 

When I open the page I get: HelloWorldPortlet not ready.

 

Does anybody know what that means? I get no errors in the log!

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:20
Til: pluto-user@portals.apache.org
Emne: Re: SV: SV: Help setting up hello world

 

Try a simpler example first (the one I sent and in the wiki page I sent)
first. After that, if you haven't figured it out, copy all of the source
(pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the
body of the email saying what is what, and copy and paste how you ran maven
and exactly what it output, so people can help.

 

Thanks!

Gary

 

 

On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:

 

The problem is that there is nothing wrong with my web.xml.

 

No matter what I try including web.xml from the second link I get the same
error.

 

Could it be that it cannot find it?

 

My file structure is:

 

HelloWorldPortlet (top level directory)

        |- pom.xml (the pom file)

        |- src (Subdir containing main subdirectory)

            |- main (Subdir containing java, resources and webapp subdirs)

                |- java (java source code goes under here)

                   |       `- com

                   |           `- mycompany

                   |               `- portlet

                   |                   `- HelloWorldPortlet.java (portlet
source)

                   |- webapp  (webapp resources (jsp, css, images) go under
here)

                       `- jsp

                              `- HelloWorldPortletView.jsp (for view mode)


                              `- HelloWorldPortletEdit.jsp (for edit mode)


                       `- META-INF

                              `- HelloWorldPortlet.xml (Tomcat context
deployment descriptor)

                       `- WEB-INF

                               `- portlet.xml (JSR-168 deployment
descriptor)

                               `- web.xml (This will be modified by
maven-pluto-plugin)

 

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:01
Til: pluto-user@portals.apache.org
Emne: Re: SV: Help setting up hello world

 

If you look at that second link I sent:

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

It has an example simple web.xml, portlet.xml, etc. If you are new to Java
or Java web applications, you probably out to read up on that and Maven
prior to getting into the portlet side of things, though.

 

As for where to go after Hello World, I lot of people use Spring Portlet
MVC, in which case you might do something like this in web.xml (I tried to
strip out the unnecessary parts, but not sure how good of a job I did):

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>yourportletname</display-name>

    <description>Description of the portlet</description>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>

            /WEB-INF/context/portlet/nameofyourportlet.xml

        </param-value>

    </context-param>

    <context-param>

        <param-name>webAppRootKey</param-name>

        <param-value>some.parent.package.newofyourportlet</param-value>

    </context-param>

    <listener>

 
<listener-class>org.springframework.web.util.WebAppRootListener</listener-cl
ass>

    </listener>

    <listener>

 
<listener-class>org.springframework.web.context.ContextLoaderListener</liste
ner-class>

    </listener>

    <servlet>

        <servlet-name>ViewRendererServlet</servlet-name>

 
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-
class>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

        <servlet-name>ViewRendererServlet</servlet-name>

        <url-pattern>/WEB-INF/servlet/view</url-pattern>

    </servlet-mapping>

</web-app>

 

And could look at this as an example of spring context, pom.xml,
portlet.xml, etc.:
https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/

 

There are also a Grails Portlet project and a Rails-portlet project, I think
both aimed at JSR-286 implementations like Liferay (I know the latter is at
the moment).

 

If you want to see what is it really doing in the assembly portion, look at
FileAssembler.java. For example I found it here:

http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apach
e/pluto/util/assemble/file/FileAssembler.java

 

Gary

 

 

On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:

 

Thanks Gary. I will look at it.

 

When I use mvn package I get a build error - invalid web.xml.

 

Does anybody know what is needed in the web.xml for maven to concider it
valid?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 17:22
Til: pluto-user@portals.apache.org
Emne: Re: Help setting up hello world

 

Soren,

 

Assuming you are talking about this hello world example?:

http://portals.apache.org/pluto/v20/deploying.html

 

I also just found another example, even though it is geared for uPortal
rather than the example Pluto server. (But uPortal uses Pluto and supports
JSR-168 compliant portlets, so should work.):

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

Some other example portlets are here:

https://source.jasig.org/portlets/

there are also some in here but not all of these work:

https://source.jasig.org/sandbox/

 

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are
still JSR-168), but that shouldn't matter afaik just to get something simple
working.

 

Some miscellaneous tips/notes:

* Pluto's jars should be in the shared/lib area, which requires some change
to the default Tomcat 6 config to have it look for. That is the most
appropriate place for it, afaik.

* Like any war, if you unzip the war, it should unzip its contents into the
current directory (i.e. is isn't unzipping into (webapp directory name)/...
). That is just a war thing, not specific to portlets. This only matters if
you tried to make the war by hand.

* Pluto's assembly API must be used to prep the war. There is a
maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto
assembly looks at the portlet.xml then modifies the web.xml and adds
portlet*.tld file(s).

* Even though Tomcat is much more lenient when it decompresses a war, Pluto
assembly (used by maven-pluto-plugin) uses the standard Java API to unjar
the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and
there should be only one manifest), it will choke (and the error is not that
helpful).

* Just because maven-pluto-plugin preps the war doesn't mean it is a valid
portlet (or even valid web.xml and portlet.xml for a portlet) or that it
will even register in Pluto afaik. You need to make sure that web.xml is
cleaned up and that you didn't try to add the stuff that Pluto assembly puts
into it. (For info on how to clean it up if you need that, see the unplutofy
project).

* In newer versions of pluto (not sure what version, but sometime between
1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So
you can someone tell if a portlet is available and at least valid enough for
Pluto to register it (although it still may not work) if the logs showed
that it registered. It may not register each time though? Registering is
different than just Tomcat deploying the war (it is the line right after
that in the logs usually, I think).

 

Hopefully none of that info is wrong, and please anyone feel free to correct
or clarify those.

 

Wish I could provide more info, but maybe some of that will help.

 

Gary

 

 

On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:

 

Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 

 

 

 

 

<pom.xml>

 

 


Re: SV: SV: SV: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Oops, instead of .tld files in shared/lib I meant pluto-taglib-2.0.1.jar should go in there (after you'd made mods to tomcat config to support shared/lib as part of classpath. And the some of the other pluto jars (api jar(s), ... ?) need to go in there as well.

Long story short- once you make that change to the pom.xml mentioned in last email to include the modified web.xml, as long as you have pluto-taglib-2.0.1.jar and whatever other jars needed for pluto/JSR-286 in tomcat/shared/lib, you don't need to worry about portlet*.tld in the portlet war (in fact the portlet tlds shouldn't be in the war in later versions of Pluto.


On Jun 4, 2010, at 9:58 AM, Gary Weaver wrote:

> Søren,
> 
> It has been a long while since I looked at that plugin since in uPortal, Pluto assembly is called by an ant target, deployPortletApp.
> 
> It looks like you need to change the war plugin config so that it uses the web.xml that maven-pluto-plugin produces:
> 
>       <!-- configure maven-war-plugin to use updated web.xml -->
>       <plugin>
>         <artifactId>maven-war-plugin</artifactId>
>         <configuration>
>           <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
>         </configuration>
>       </plugin>
> 
> (when that plugin executes, it produces that modified web.xml which has to be explicitly included in the war)
> 
> btw- I saw that in an example here: http://wpcertification.blogspot.com/2010/04/maven-script-to-build-flex-portlet.html
> 
> As for portlet.tld (and actually I think that may not be the exact name of it in Pluto 2.x), it looks like it doesn't add that tag library file to the war like happens in uPortal with deployPortletApp.
> 
> I can't think of a reason those tag library (tld) files shouldn't just be put into tomcat/shared/lib so I'm guessing that is where they should go instead in Pluto 2.x.
> 
> In your tomcat dir, do a recursive find for *.tld files and odds are when you installed Pluto, it already put them somewhere. I'm guessing you used this to install Pluto? Again, since I use uPortal, I'm not familiar with it- these instructions look like they are for Pluto 1.1 but perhaps they work for Pluto 2?:
> http://portals.apache.org/pluto/app-servers.html
> 
> And I'm guessing the Pluto 2 bundle comes with the tld also, but again- I didn't check:
> http://portals.apache.org/pluto/v20/getting-started.html
> 
> I'm sorry for the confusion! I'm a little new to Pluto 2.x and mostly just used to uPortal. :P
> 
> Thanks!
> Gary
> 
> 
> On Jun 4, 2010, at 1:48 AM, Søren Blidorf wrote:
> 
>> My war don’t contain the portlet.tld.
>>  
>> As I understand you that is created by Maven from my pom.xml. So I guess something is wrong with my pom.xml.
>>  
>> I have created it as in the example in Pluto/deploying. Would you look at my attached pom.xml?
>>  
>> Soren
>>  
>> -----Oprindelig meddelelse-----
>> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
>> Sendt: 3. juni 2010 21:47
>> Til: pluto-user@portals.apache.org
>> Emne: Re: SV: SV: SV: Help setting up hello world
>>  
>> Some things to check:
>>  
>> 1. Make sure that you did whatever was necessary to have Pluto assembly modify web.xml and have it add portlet.tld to your war (you don't add those things- it does). This is done via the pluto-maven-plugin which you'd need to setup in your pom.xml and make sure it is using the same version of Pluto as is in Tomcat or it won't work. (That is not discussed on the page I sent, because uPortal uses an ant target to do that (deployPortletApp).)
>>  
>> 2. If the deployed war contains the web.xml modification by Pluto and the portlet.tld file, then make sure when it deployed that in tomcat/logs/catalina.out (or in some log in there) it shows that the portlet registered (I think- at least that is what happens in uPortal).
>>  
>> Note that you cannot visit the http://localhost:8080/helloworld/ directly. It can only be viewed within the portal. Unfortunately I can't tell you how to manage portlets within Pluto portal. Hopefully there is documentation about that somewhere. :(
>>  
>> Gary
>>  
>>  
>> On Jun 3, 2010, at 3:32 PM, Søren Blidorf wrote:
>> 
>> 
>> I have now created a page on pluto and added my HelloWorldPortlet.
>>  
>> When I open the page I get: HelloWorldPortlet not ready.
>>  
>> Does anybody know what that means? I get no errors in the log!
>>  
>> Soren
>>  
>> -----Oprindelig meddelelse-----
>> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
>> Sendt: 3. juni 2010 20:20
>> Til: pluto-user@portals.apache.org
>> Emne: Re: SV: SV: Help setting up hello world
>>  
>> Try a simpler example first (the one I sent and in the wiki page I sent) first. After that, if you haven't figured it out, copy all of the source (pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the body of the email saying what is what, and copy and paste how you ran maven and exactly what it output, so people can help.
>>  
>> Thanks!
>> Gary
>>  
>>  
>> On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:
>>  
>> The problem is that there is nothing wrong with my web.xml.
>>  
>> No matter what I try including web.xml from the second link I get the same error.
>>  
>> Could it be that it cannot find it?
>>  
>> My file structure is:
>>  
>> HelloWorldPortlet (top level directory)
>>         |- pom.xml (the pom file)
>>         |- src (Subdir containing main subdirectory)
>>             |- main (Subdir containing java, resources and webapp subdirs)
>>                 |- java (java source code goes under here)
>>                    |       `- com
>>                    |           `- mycompany
>>                    |               `- portlet
>>                    |                   `- HelloWorldPortlet.java (portlet source)
>>                    |- webapp  (webapp resources (jsp, css, images) go under here)
>>                        `- jsp
>>                               `- HelloWorldPortletView.jsp (for view mode)                               
>>                               `- HelloWorldPortletEdit.jsp (for edit mode)                               
>>                        `- META-INF
>>                               `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
>>                        `- WEB-INF
>>                                `- portlet.xml (JSR-168 deployment descriptor)
>>                                `- web.xml (This will be modified by maven-pluto-plugin)
>>  
>>  
>> -----Oprindelig meddelelse-----
>> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
>> Sendt: 3. juni 2010 20:01
>> Til: pluto-user@portals.apache.org
>> Emne: Re: SV: Help setting up hello world
>>  
>> If you look at that second link I sent:
>> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>>  
>> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
>>  
>> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
>>  
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
>> <web-app>
>>     <display-name>yourportletname</display-name>
>>     <description>Description of the portlet</description>
>>     <context-param>
>>         <param-name>contextConfigLocation</param-name>
>>         <param-value>
>>             /WEB-INF/context/portlet/nameofyourportlet.xml
>>         </param-value>
>>     </context-param>
>>     <context-param>
>>         <param-name>webAppRootKey</param-name>
>>         <param-value>some.parent.package.newofyourportlet</param-value>
>>     </context-param>
>>     <listener>
>>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>>     </listener>
>>     <listener>
>>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>>     </listener>
>>     <servlet>
>>         <servlet-name>ViewRendererServlet</servlet-name>
>>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>>         <load-on-startup>1</load-on-startup>
>>     </servlet>
>>     <servlet-mapping>
>>         <servlet-name>ViewRendererServlet</servlet-name>
>>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>>     </servlet-mapping>
>> </web-app>
>>  
>> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
>>  
>> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
>>  
>> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
>> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
>>  
>> Gary
>>  
>>  
>> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
>>  
>> Thanks Gary. I will look at it.
>>  
>> When I use mvn package I get a build error - invalid web.xml.
>>  
>> Does anybody know what is needed in the web.xml for maven to concider it valid?
>>  
>> Soren
>>  
>> -----Oprindelig meddelelse-----
>> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
>> Sendt: 3. juni 2010 17:22
>> Til: pluto-user@portals.apache.org
>> Emne: Re: Help setting up hello world
>>  
>> Soren,
>>  
>> Assuming you are talking about this hello world example?:
>> http://portals.apache.org/pluto/v20/deploying.html
>>  
>> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
>> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>>  
>> Some other example portlets are here:
>> https://source.jasig.org/portlets/
>> there are also some in here but not all of these work:
>> https://source.jasig.org/sandbox/
>>  
>> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>>  
>> Some miscellaneous tips/notes:
>> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
>> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
>> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
>> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
>> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
>> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>>  
>> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>>  
>> Wish I could provide more info, but maybe some of that will help.
>>  
>> Gary
>>  
>>  
>> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>>  
>> Hi.
>>  
>> I am new to portlets and Pluto.
>>  
>> I have installed Pluto on my existing Tomcat and it works fine.
>>  
>> However I am having difficulties setting up a helloworld portlet.
>>  
>> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>>  
>> I have tried different examples on google, but nothing works.
>>  
>> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>>  
>> Soren
>>  
>>  
>>  
>>  
>>  
>> <pom.xml>
> 


Re: SV: SV: SV: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Søren,

It has been a long while since I looked at that plugin since in uPortal, Pluto assembly is called by an ant target, deployPortletApp.

It looks like you need to change the war plugin config so that it uses the web.xml that maven-pluto-plugin produces:

      <!-- configure maven-war-plugin to use updated web.xml -->
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
        </configuration>
      </plugin>

(when that plugin executes, it produces that modified web.xml which has to be explicitly included in the war)

btw- I saw that in an example here: http://wpcertification.blogspot.com/2010/04/maven-script-to-build-flex-portlet.html

As for portlet.tld (and actually I think that may not be the exact name of it in Pluto 2.x), it looks like it doesn't add that tag library file to the war like happens in uPortal with deployPortletApp.

I can't think of a reason those tag library (tld) files shouldn't just be put into tomcat/shared/lib so I'm guessing that is where they should go instead in Pluto 2.x.

In your tomcat dir, do a recursive find for *.tld files and odds are when you installed Pluto, it already put them somewhere. I'm guessing you used this to install Pluto? Again, since I use uPortal, I'm not familiar with it- these instructions look like they are for Pluto 1.1 but perhaps they work for Pluto 2?:
http://portals.apache.org/pluto/app-servers.html

And I'm guessing the Pluto 2 bundle comes with the tld also, but again- I didn't check:
http://portals.apache.org/pluto/v20/getting-started.html

I'm sorry for the confusion! I'm a little new to Pluto 2.x and mostly just used to uPortal. :P

Thanks!
Gary


On Jun 4, 2010, at 1:48 AM, Søren Blidorf wrote:

> My war don’t contain the portlet.tld.
>  
> As I understand you that is created by Maven from my pom.xml. So I guess something is wrong with my pom.xml.
>  
> I have created it as in the example in Pluto/deploying. Would you look at my attached pom.xml?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 21:47
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: SV: SV: Help setting up hello world
>  
> Some things to check:
>  
> 1. Make sure that you did whatever was necessary to have Pluto assembly modify web.xml and have it add portlet.tld to your war (you don't add those things- it does). This is done via the pluto-maven-plugin which you'd need to setup in your pom.xml and make sure it is using the same version of Pluto as is in Tomcat or it won't work. (That is not discussed on the page I sent, because uPortal uses an ant target to do that (deployPortletApp).)
>  
> 2. If the deployed war contains the web.xml modification by Pluto and the portlet.tld file, then make sure when it deployed that in tomcat/logs/catalina.out (or in some log in there) it shows that the portlet registered (I think- at least that is what happens in uPortal).
>  
> Note that you cannot visit the http://localhost:8080/helloworld/ directly. It can only be viewed within the portal. Unfortunately I can't tell you how to manage portlets within Pluto portal. Hopefully there is documentation about that somewhere. :(
>  
> Gary
>  
>  
> On Jun 3, 2010, at 3:32 PM, Søren Blidorf wrote:
> 
> 
> I have now created a page on pluto and added my HelloWorldPortlet.
>  
> When I open the page I get: HelloWorldPortlet not ready.
>  
> Does anybody know what that means? I get no errors in the log!
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:20
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: SV: Help setting up hello world
>  
> Try a simpler example first (the one I sent and in the wiki page I sent) first. After that, if you haven't figured it out, copy all of the source (pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the body of the email saying what is what, and copy and paste how you ran maven and exactly what it output, so people can help.
>  
> Thanks!
> Gary
>  
>  
> On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:
>  
> The problem is that there is nothing wrong with my web.xml.
>  
> No matter what I try including web.xml from the second link I get the same error.
>  
> Could it be that it cannot find it?
>  
> My file structure is:
>  
> HelloWorldPortlet (top level directory)
>         |- pom.xml (the pom file)
>         |- src (Subdir containing main subdirectory)
>             |- main (Subdir containing java, resources and webapp subdirs)
>                 |- java (java source code goes under here)
>                    |       `- com
>                    |           `- mycompany
>                    |               `- portlet
>                    |                   `- HelloWorldPortlet.java (portlet source)
>                    |- webapp  (webapp resources (jsp, css, images) go under here)
>                        `- jsp
>                               `- HelloWorldPortletView.jsp (for view mode)                               
>                               `- HelloWorldPortletEdit.jsp (for edit mode)                               
>                        `- META-INF
>                               `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
>                        `- WEB-INF
>                                `- portlet.xml (JSR-168 deployment descriptor)
>                                `- web.xml (This will be modified by maven-pluto-plugin)
>  
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:01
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: Help setting up hello world
>  
> If you look at that second link I sent:
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
>  
> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <display-name>yourportletname</display-name>
>     <description>Description of the portlet</description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>
>             /WEB-INF/context/portlet/nameofyourportlet.xml
>         </param-value>
>     </context-param>
>     <context-param>
>         <param-name>webAppRootKey</param-name>
>         <param-value>some.parent.package.newofyourportlet</param-value>
>     </context-param>
>     <listener>
>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>     </listener>
>     <listener>
>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
>     <servlet>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>     </servlet-mapping>
> </web-app>
>  
> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
>  
> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
>  
> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
>  
> Gary
>  
>  
> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
>  
> Thanks Gary. I will look at it.
>  
> When I use mvn package I get a build error - invalid web.xml.
>  
> Does anybody know what is needed in the web.xml for maven to concider it valid?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 17:22
> Til: pluto-user@portals.apache.org
> Emne: Re: Help setting up hello world
>  
> Soren,
>  
> Assuming you are talking about this hello world example?:
> http://portals.apache.org/pluto/v20/deploying.html
>  
> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> Some other example portlets are here:
> https://source.jasig.org/portlets/
> there are also some in here but not all of these work:
> https://source.jasig.org/sandbox/
>  
> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>  
> Some miscellaneous tips/notes:
> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>  
> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>  
> Wish I could provide more info, but maybe some of that will help.
>  
> Gary
>  
>  
> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>  
> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>  
>  
>  
>  
>  
> <pom.xml>


SV: SV: SV: SV: Help setting up hello world

Posted by Søren Blidorf <so...@nolas.dk>.
My war don’t contain the portlet.tld.

 

As I understand you that is created by Maven from my pom.xml. So I guess
something is wrong with my pom.xml.

 

I have created it as in the example in Pluto/deploying. Would you look at my
attached pom.xml?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 21:47
Til: pluto-user@portals.apache.org
Emne: Re: SV: SV: SV: Help setting up hello world

 

Some things to check:

 

1. Make sure that you did whatever was necessary to have Pluto assembly
modify web.xml and have it add portlet.tld to your war (you don't add those
things- it does). This is done via the pluto-maven-plugin which you'd need
to setup in your pom.xml and make sure it is using the same version of Pluto
as is in Tomcat or it won't work. (That is not discussed on the page I sent,
because uPortal uses an ant target to do that (deployPortletApp).)

 

2. If the deployed war contains the web.xml modification by Pluto and the
portlet.tld file, then make sure when it deployed that in
tomcat/logs/catalina.out (or in some log in there) it shows that the portlet
registered (I think- at least that is what happens in uPortal).

 

Note that you cannot visit the http://localhost:8080/helloworld/ directly.
It can only be viewed within the portal. Unfortunately I can't tell you how
to manage portlets within Pluto portal. Hopefully there is documentation
about that somewhere. :(

 

Gary

 

 

On Jun 3, 2010, at 3:32 PM, Søren Blidorf wrote:





I have now created a page on pluto and added my HelloWorldPortlet.

 

When I open the page I get: HelloWorldPortlet not ready.

 

Does anybody know what that means? I get no errors in the log!

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:20
Til: pluto-user@portals.apache.org
Emne: Re: SV: SV: Help setting up hello world

 

Try a simpler example first (the one I sent and in the wiki page I sent)
first. After that, if you haven't figured it out, copy all of the source
(pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the
body of the email saying what is what, and copy and paste how you ran maven
and exactly what it output, so people can help.

 

Thanks!

Gary

 

 

On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:

 

The problem is that there is nothing wrong with my web.xml.

 

No matter what I try including web.xml from the second link I get the same
error.

 

Could it be that it cannot find it?

 

My file structure is:

 

HelloWorldPortlet (top level directory)

        |- pom.xml (the pom file)

        |- src (Subdir containing main subdirectory)

            |- main (Subdir containing java, resources and webapp subdirs)

                |- java (java source code goes under here)

                   |       `- com

                   |           `- mycompany

                   |               `- portlet

                   |                   `- HelloWorldPortlet.java (portlet
source)

                   |- webapp  (webapp resources (jsp, css, images) go under
here)

                       `- jsp

                              `- HelloWorldPortletView.jsp (for view mode)


                              `- HelloWorldPortletEdit.jsp (for edit mode)


                       `- META-INF

                              `- HelloWorldPortlet.xml (Tomcat context
deployment descriptor)

                       `- WEB-INF

                               `- portlet.xml (JSR-168 deployment
descriptor)

                               `- web.xml (This will be modified by
maven-pluto-plugin)

 

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:01
Til: pluto-user@portals.apache.org
Emne: Re: SV: Help setting up hello world

 

If you look at that second link I sent:

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

It has an example simple web.xml, portlet.xml, etc. If you are new to Java
or Java web applications, you probably out to read up on that and Maven
prior to getting into the portlet side of things, though.

 

As for where to go after Hello World, I lot of people use Spring Portlet
MVC, in which case you might do something like this in web.xml (I tried to
strip out the unnecessary parts, but not sure how good of a job I did):

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>yourportletname</display-name>

    <description>Description of the portlet</description>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>

            /WEB-INF/context/portlet/nameofyourportlet.xml

        </param-value>

    </context-param>

    <context-param>

        <param-name>webAppRootKey</param-name>

        <param-value>some.parent.package.newofyourportlet</param-value>

    </context-param>

    <listener>

 
<listener-class>org.springframework.web.util.WebAppRootListener</listener-cl
ass>

    </listener>

    <listener>

 
<listener-class>org.springframework.web.context.ContextLoaderListener</liste
ner-class>

    </listener>

    <servlet>

        <servlet-name>ViewRendererServlet</servlet-name>

 
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-
class>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

        <servlet-name>ViewRendererServlet</servlet-name>

        <url-pattern>/WEB-INF/servlet/view</url-pattern>

    </servlet-mapping>

</web-app>

 

And could look at this as an example of spring context, pom.xml,
portlet.xml, etc.:
https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/

 

There are also a Grails Portlet project and a Rails-portlet project, I think
both aimed at JSR-286 implementations like Liferay (I know the latter is at
the moment).

 

If you want to see what is it really doing in the assembly portion, look at
FileAssembler.java. For example I found it here:

http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apach
e/pluto/util/assemble/file/FileAssembler.java

 

Gary

 

 

On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:

 

Thanks Gary. I will look at it.

 

When I use mvn package I get a build error - invalid web.xml.

 

Does anybody know what is needed in the web.xml for maven to concider it
valid?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 17:22
Til: pluto-user@portals.apache.org
Emne: Re: Help setting up hello world

 

Soren,

 

Assuming you are talking about this hello world example?:

http://portals.apache.org/pluto/v20/deploying.html

 

I also just found another example, even though it is geared for uPortal
rather than the example Pluto server. (But uPortal uses Pluto and supports
JSR-168 compliant portlets, so should work.):

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

Some other example portlets are here:

https://source.jasig.org/portlets/

there are also some in here but not all of these work:

https://source.jasig.org/sandbox/

 

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are
still JSR-168), but that shouldn't matter afaik just to get something simple
working.

 

Some miscellaneous tips/notes:

* Pluto's jars should be in the shared/lib area, which requires some change
to the default Tomcat 6 config to have it look for. That is the most
appropriate place for it, afaik.

* Like any war, if you unzip the war, it should unzip its contents into the
current directory (i.e. is isn't unzipping into (webapp directory name)/...
). That is just a war thing, not specific to portlets. This only matters if
you tried to make the war by hand.

* Pluto's assembly API must be used to prep the war. There is a
maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto
assembly looks at the portlet.xml then modifies the web.xml and adds
portlet*.tld file(s).

* Even though Tomcat is much more lenient when it decompresses a war, Pluto
assembly (used by maven-pluto-plugin) uses the standard Java API to unjar
the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and
there should be only one manifest), it will choke (and the error is not that
helpful).

* Just because maven-pluto-plugin preps the war doesn't mean it is a valid
portlet (or even valid web.xml and portlet.xml for a portlet) or that it
will even register in Pluto afaik. You need to make sure that web.xml is
cleaned up and that you didn't try to add the stuff that Pluto assembly puts
into it. (For info on how to clean it up if you need that, see the unplutofy
project).

* In newer versions of pluto (not sure what version, but sometime between
1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So
you can someone tell if a portlet is available and at least valid enough for
Pluto to register it (although it still may not work) if the logs showed
that it registered. It may not register each time though? Registering is
different than just Tomcat deploying the war (it is the line right after
that in the logs usually, I think).

 

Hopefully none of that info is wrong, and please anyone feel free to correct
or clarify those.

 

Wish I could provide more info, but maybe some of that will help.

 

Gary

 

 

On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:

 

Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 

 

 

 

 


Re: SV: SV: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Some things to check:

1. Make sure that you did whatever was necessary to have Pluto assembly modify web.xml and have it add portlet.tld to your war (you don't add those things- it does). This is done via the pluto-maven-plugin which you'd need to setup in your pom.xml and make sure it is using the same version of Pluto as is in Tomcat or it won't work. (That is not discussed on the page I sent, because uPortal uses an ant target to do that (deployPortletApp).)

2. If the deployed war contains the web.xml modification by Pluto and the portlet.tld file, then make sure when it deployed that in tomcat/logs/catalina.out (or in some log in there) it shows that the portlet registered (I think- at least that is what happens in uPortal).

Note that you cannot visit the http://localhost:8080/helloworld/ directly. It can only be viewed within the portal. Unfortunately I can't tell you how to manage portlets within Pluto portal. Hopefully there is documentation about that somewhere. :(

Gary


On Jun 3, 2010, at 3:32 PM, Søren Blidorf wrote:

> I have now created a page on pluto and added my HelloWorldPortlet.
>  
> When I open the page I get: HelloWorldPortlet not ready.
>  
> Does anybody know what that means? I get no errors in the log!
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:20
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: SV: Help setting up hello world
>  
> Try a simpler example first (the one I sent and in the wiki page I sent) first. After that, if you haven't figured it out, copy all of the source (pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the body of the email saying what is what, and copy and paste how you ran maven and exactly what it output, so people can help.
>  
> Thanks!
> Gary
>  
>  
> On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:
> 
> 
> The problem is that there is nothing wrong with my web.xml.
>  
> No matter what I try including web.xml from the second link I get the same error.
>  
> Could it be that it cannot find it?
>  
> My file structure is:
>  
> HelloWorldPortlet (top level directory)
>         |- pom.xml (the pom file)
>         |- src (Subdir containing main subdirectory)
>             |- main (Subdir containing java, resources and webapp subdirs)
>                 |- java (java source code goes under here)
>                    |       `- com
>                    |           `- mycompany
>                    |               `- portlet
>                    |                   `- HelloWorldPortlet.java (portlet source)
>                    |- webapp  (webapp resources (jsp, css, images) go under here)
>                        `- jsp
>                               `- HelloWorldPortletView.jsp (for view mode)                               
>                               `- HelloWorldPortletEdit.jsp (for edit mode)                               
>                        `- META-INF
>                               `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
>                        `- WEB-INF
>                                `- portlet.xml (JSR-168 deployment descriptor)
>                                `- web.xml (This will be modified by maven-pluto-plugin)
>  
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:01
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: Help setting up hello world
>  
> If you look at that second link I sent:
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
>  
> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <display-name>yourportletname</display-name>
>     <description>Description of the portlet</description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>
>             /WEB-INF/context/portlet/nameofyourportlet.xml
>         </param-value>
>     </context-param>
>     <context-param>
>         <param-name>webAppRootKey</param-name>
>         <param-value>some.parent.package.newofyourportlet</param-value>
>     </context-param>
>     <listener>
>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>     </listener>
>     <listener>
>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
>     <servlet>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>     </servlet-mapping>
> </web-app>
>  
> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
>  
> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
>  
> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
>  
> Gary
>  
>  
> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
>  
> Thanks Gary. I will look at it.
>  
> When I use mvn package I get a build error - invalid web.xml.
>  
> Does anybody know what is needed in the web.xml for maven to concider it valid?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 17:22
> Til: pluto-user@portals.apache.org
> Emne: Re: Help setting up hello world
>  
> Soren,
>  
> Assuming you are talking about this hello world example?:
> http://portals.apache.org/pluto/v20/deploying.html
>  
> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> Some other example portlets are here:
> https://source.jasig.org/portlets/
> there are also some in here but not all of these work:
> https://source.jasig.org/sandbox/
>  
> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>  
> Some miscellaneous tips/notes:
> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>  
> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>  
> Wish I could provide more info, but maybe some of that will help.
>  
> Gary
>  
>  
> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>  
> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>  
>  
>  
>  


SV: SV: SV: Help setting up hello world

Posted by Søren Blidorf <so...@nolas.dk>.
I have now created a page on pluto and added my HelloWorldPortlet.

 

When I open the page I get: HelloWorldPortlet not ready.

 

Does anybody know what that means? I get no errors in the log!

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:20
Til: pluto-user@portals.apache.org
Emne: Re: SV: SV: Help setting up hello world

 

Try a simpler example first (the one I sent and in the wiki page I sent)
first. After that, if you haven't figured it out, copy all of the source
(pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the
body of the email saying what is what, and copy and paste how you ran maven
and exactly what it output, so people can help.

 

Thanks!

Gary

 

 

On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:





The problem is that there is nothing wrong with my web.xml.

 

No matter what I try including web.xml from the second link I get the same
error.

 

Could it be that it cannot find it?

 

My file structure is:

 

HelloWorldPortlet (top level directory)

        |- pom.xml (the pom file)

        |- src (Subdir containing main subdirectory)

            |- main (Subdir containing java, resources and webapp subdirs)

                |- java (java source code goes under here)

                   |       `- com

                   |           `- mycompany

                   |               `- portlet

                   |                   `- HelloWorldPortlet.java (portlet
source)

                   |- webapp  (webapp resources (jsp, css, images) go under
here)

                       `- jsp

                              `- HelloWorldPortletView.jsp (for view mode)


                              `- HelloWorldPortletEdit.jsp (for edit mode)


                       `- META-INF

                              `- HelloWorldPortlet.xml (Tomcat context
deployment descriptor)

                       `- WEB-INF

                               `- portlet.xml (JSR-168 deployment
descriptor)

                               `- web.xml (This will be modified by
maven-pluto-plugin)

 

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:01
Til: pluto-user@portals.apache.org
Emne: Re: SV: Help setting up hello world

 

If you look at that second link I sent:

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

It has an example simple web.xml, portlet.xml, etc. If you are new to Java
or Java web applications, you probably out to read up on that and Maven
prior to getting into the portlet side of things, though.

 

As for where to go after Hello World, I lot of people use Spring Portlet
MVC, in which case you might do something like this in web.xml (I tried to
strip out the unnecessary parts, but not sure how good of a job I did):

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>yourportletname</display-name>

    <description>Description of the portlet</description>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>

            /WEB-INF/context/portlet/nameofyourportlet.xml

        </param-value>

    </context-param>

    <context-param>

        <param-name>webAppRootKey</param-name>

        <param-value>some.parent.package.newofyourportlet</param-value>

    </context-param>

    <listener>

 
<listener-class>org.springframework.web.util.WebAppRootListener</listener-cl
ass>

    </listener>

    <listener>

 
<listener-class>org.springframework.web.context.ContextLoaderListener</liste
ner-class>

    </listener>

    <servlet>

        <servlet-name>ViewRendererServlet</servlet-name>

 
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-
class>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

        <servlet-name>ViewRendererServlet</servlet-name>

        <url-pattern>/WEB-INF/servlet/view</url-pattern>

    </servlet-mapping>

</web-app>

 

And could look at this as an example of spring context, pom.xml,
portlet.xml, etc.:
https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/

 

There are also a Grails Portlet project and a Rails-portlet project, I think
both aimed at JSR-286 implementations like Liferay (I know the latter is at
the moment).

 

If you want to see what is it really doing in the assembly portion, look at
FileAssembler.java. For example I found it here:

http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apach
e/pluto/util/assemble/file/FileAssembler.java

 

Gary

 

 

On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:

 

Thanks Gary. I will look at it.

 

When I use mvn package I get a build error - invalid web.xml.

 

Does anybody know what is needed in the web.xml for maven to concider it
valid?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 17:22
Til: pluto-user@portals.apache.org
Emne: Re: Help setting up hello world

 

Soren,

 

Assuming you are talking about this hello world example?:

http://portals.apache.org/pluto/v20/deploying.html

 

I also just found another example, even though it is geared for uPortal
rather than the example Pluto server. (But uPortal uses Pluto and supports
JSR-168 compliant portlets, so should work.):

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

Some other example portlets are here:

https://source.jasig.org/portlets/

there are also some in here but not all of these work:

https://source.jasig.org/sandbox/

 

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are
still JSR-168), but that shouldn't matter afaik just to get something simple
working.

 

Some miscellaneous tips/notes:

* Pluto's jars should be in the shared/lib area, which requires some change
to the default Tomcat 6 config to have it look for. That is the most
appropriate place for it, afaik.

* Like any war, if you unzip the war, it should unzip its contents into the
current directory (i.e. is isn't unzipping into (webapp directory name)/...
). That is just a war thing, not specific to portlets. This only matters if
you tried to make the war by hand.

* Pluto's assembly API must be used to prep the war. There is a
maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto
assembly looks at the portlet.xml then modifies the web.xml and adds
portlet*.tld file(s).

* Even though Tomcat is much more lenient when it decompresses a war, Pluto
assembly (used by maven-pluto-plugin) uses the standard Java API to unjar
the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and
there should be only one manifest), it will choke (and the error is not that
helpful).

* Just because maven-pluto-plugin preps the war doesn't mean it is a valid
portlet (or even valid web.xml and portlet.xml for a portlet) or that it
will even register in Pluto afaik. You need to make sure that web.xml is
cleaned up and that you didn't try to add the stuff that Pluto assembly puts
into it. (For info on how to clean it up if you need that, see the unplutofy
project).

* In newer versions of pluto (not sure what version, but sometime between
1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So
you can someone tell if a portlet is available and at least valid enough for
Pluto to register it (although it still may not work) if the logs showed
that it registered. It may not register each time though? Registering is
different than just Tomcat deploying the war (it is the line right after
that in the logs usually, I think).

 

Hopefully none of that info is wrong, and please anyone feel free to correct
or clarify those.

 

Wish I could provide more info, but maybe some of that will help.

 

Gary

 

 

On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:

 

Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 

 

 

 


Re: SV: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Try a simpler example first (the one I sent and in the wiki page I sent) first. After that, if you haven't figured it out, copy all of the source (pom.xml, HelloWorldPortlet.java, the 2 jsp files, the 3 xml files) into the body of the email saying what is what, and copy and paste how you ran maven and exactly what it output, so people can help.

Thanks!
Gary


On Jun 3, 2010, at 2:12 PM, Søren Blidorf wrote:

> The problem is that there is nothing wrong with my web.xml.
>  
> No matter what I try including web.xml from the second link I get the same error.
>  
> Could it be that it cannot find it?
>  
> My file structure is:
>  
> HelloWorldPortlet (top level directory)
>         |- pom.xml (the pom file)
>         |- src (Subdir containing main subdirectory)
>             |- main (Subdir containing java, resources and webapp subdirs)
>                 |- java (java source code goes under here)
>                    |       `- com
>                    |           `- mycompany
>                    |               `- portlet
>                    |                   `- HelloWorldPortlet.java (portlet source)
>                    |- webapp  (webapp resources (jsp, css, images) go under here)
>                        `- jsp
>                               `- HelloWorldPortletView.jsp (for view mode)                               
>                               `- HelloWorldPortletEdit.jsp (for edit mode)                               
>                        `- META-INF
>                               `- HelloWorldPortlet.xml (Tomcat context deployment descriptor)
>                        `- WEB-INF
>                                `- portlet.xml (JSR-168 deployment descriptor)
>                                `- web.xml (This will be modified by maven-pluto-plugin)
>  
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 20:01
> Til: pluto-user@portals.apache.org
> Emne: Re: SV: Help setting up hello world
>  
> If you look at that second link I sent:
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.
>  
> As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
> <web-app>
>     <display-name>yourportletname</display-name>
>     <description>Description of the portlet</description>
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>
>             /WEB-INF/context/portlet/nameofyourportlet.xml
>         </param-value>
>     </context-param>
>     <context-param>
>         <param-name>webAppRootKey</param-name>
>         <param-value>some.parent.package.newofyourportlet</param-value>
>     </context-param>
>     <listener>
>         <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
>     </listener>
>     <listener>
>         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
>     <servlet>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
>         <load-on-startup>1</load-on-startup>
>     </servlet>
>     <servlet-mapping>
>         <servlet-name>ViewRendererServlet</servlet-name>
>         <url-pattern>/WEB-INF/servlet/view</url-pattern>
>     </servlet-mapping>
> </web-app>
>  
> And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/
>  
> There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).
>  
> If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
> http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java
>  
> Gary
>  
>  
> On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:
> 
> 
> Thanks Gary. I will look at it.
>  
> When I use mvn package I get a build error - invalid web.xml.
>  
> Does anybody know what is needed in the web.xml for maven to concider it valid?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 17:22
> Til: pluto-user@portals.apache.org
> Emne: Re: Help setting up hello world
>  
> Soren,
>  
> Assuming you are talking about this hello world example?:
> http://portals.apache.org/pluto/v20/deploying.html
>  
> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> Some other example portlets are here:
> https://source.jasig.org/portlets/
> there are also some in here but not all of these work:
> https://source.jasig.org/sandbox/
>  
> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>  
> Some miscellaneous tips/notes:
> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>  
> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>  
> Wish I could provide more info, but maybe some of that will help.
>  
> Gary
>  
>  
> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
>  
> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>  
>  
>  


SV: SV: Help setting up hello world

Posted by Søren Blidorf <so...@nolas.dk>.
The problem is that there is nothing wrong with my web.xml.

 

No matter what I try including web.xml from the second link I get the same
error.

 

Could it be that it cannot find it?

 

My file structure is:

 

HelloWorldPortlet (top level directory)

        |- pom.xml (the pom file)

        |- src (Subdir containing main subdirectory)

            |- main (Subdir containing java, resources and webapp subdirs)

                |- java (java source code goes under here)

                   |       `- com

                   |           `- mycompany

                   |               `- portlet

                   |                   `- HelloWorldPortlet.java (portlet
source)

                   |- webapp  (webapp resources (jsp, css, images) go under
here)

                       `- jsp 

                              `- HelloWorldPortletView.jsp (for view mode)


                              `- HelloWorldPortletEdit.jsp (for edit mode)


                       `- META-INF

                              `- HelloWorldPortlet.xml (Tomcat context
deployment descriptor)

                       `- WEB-INF

                               `- portlet.xml (JSR-168 deployment
descriptor)

                               `- web.xml (This will be modified by
maven-pluto-plugin)

 

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 20:01
Til: pluto-user@portals.apache.org
Emne: Re: SV: Help setting up hello world

 

If you look at that second link I sent:

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

It has an example simple web.xml, portlet.xml, etc. If you are new to Java
or Java web applications, you probably out to read up on that and Maven
prior to getting into the portlet side of things, though.

 

As for where to go after Hello World, I lot of people use Spring Portlet
MVC, in which case you might do something like this in web.xml (I tried to
strip out the unnecessary parts, but not sure how good of a job I did):

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <display-name>yourportletname</display-name>

    <description>Description of the portlet</description>

    <context-param>

        <param-name>contextConfigLocation</param-name>

        <param-value>

            /WEB-INF/context/portlet/nameofyourportlet.xml

        </param-value>

    </context-param>

    <context-param>

        <param-name>webAppRootKey</param-name>

        <param-value>some.parent.package.newofyourportlet</param-value>

    </context-param>

    <listener>

 
<listener-class>org.springframework.web.util.WebAppRootListener</listener-cl
ass>

    </listener>

    <listener>

 
<listener-class>org.springframework.web.context.ContextLoaderListener</liste
ner-class>

    </listener>

    <servlet>

        <servlet-name>ViewRendererServlet</servlet-name>

 
<servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-
class>

        <load-on-startup>1</load-on-startup>

    </servlet>

    <servlet-mapping>

        <servlet-name>ViewRendererServlet</servlet-name>

        <url-pattern>/WEB-INF/servlet/view</url-pattern>

    </servlet-mapping>

</web-app>

 

And could look at this as an example of spring context, pom.xml,
portlet.xml, etc.:
https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/

 

There are also a Grails Portlet project and a Rails-portlet project, I think
both aimed at JSR-286 implementations like Liferay (I know the latter is at
the moment).

 

If you want to see what is it really doing in the assembly portion, look at
FileAssembler.java. For example I found it here:

http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apach
e/pluto/util/assemble/file/FileAssembler.java

 

Gary

 

 

On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:





Thanks Gary. I will look at it.

 

When I use mvn package I get a build error - invalid web.xml.

 

Does anybody know what is needed in the web.xml for maven to concider it
valid?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 17:22
Til: pluto-user@portals.apache.org
Emne: Re: Help setting up hello world

 

Soren,

 

Assuming you are talking about this hello world example?:

http://portals.apache.org/pluto/v20/deploying.html

 

I also just found another example, even though it is geared for uPortal
rather than the example Pluto server. (But uPortal uses Pluto and supports
JSR-168 compliant portlets, so should work.):

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

Some other example portlets are here:

https://source.jasig.org/portlets/

there are also some in here but not all of these work:

https://source.jasig.org/sandbox/

 

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are
still JSR-168), but that shouldn't matter afaik just to get something simple
working.

 

Some miscellaneous tips/notes:

* Pluto's jars should be in the shared/lib area, which requires some change
to the default Tomcat 6 config to have it look for. That is the most
appropriate place for it, afaik.

* Like any war, if you unzip the war, it should unzip its contents into the
current directory (i.e. is isn't unzipping into (webapp directory name)/...
). That is just a war thing, not specific to portlets. This only matters if
you tried to make the war by hand.

* Pluto's assembly API must be used to prep the war. There is a
maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto
assembly looks at the portlet.xml then modifies the web.xml and adds
portlet*.tld file(s).

* Even though Tomcat is much more lenient when it decompresses a war, Pluto
assembly (used by maven-pluto-plugin) uses the standard Java API to unjar
the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and
there should be only one manifest), it will choke (and the error is not that
helpful).

* Just because maven-pluto-plugin preps the war doesn't mean it is a valid
portlet (or even valid web.xml and portlet.xml for a portlet) or that it
will even register in Pluto afaik. You need to make sure that web.xml is
cleaned up and that you didn't try to add the stuff that Pluto assembly puts
into it. (For info on how to clean it up if you need that, see the unplutofy
project).

* In newer versions of pluto (not sure what version, but sometime between
1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So
you can someone tell if a portlet is available and at least valid enough for
Pluto to register it (although it still may not work) if the logs showed
that it registered. It may not register each time though? Registering is
different than just Tomcat deploying the war (it is the line right after
that in the logs usually, I think).

 

Hopefully none of that info is wrong, and please anyone feel free to correct
or clarify those.

 

Wish I could provide more info, but maybe some of that will help.

 

Gary

 

 

On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:

 

Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 

 

 


Re: SV: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
If you look at that second link I sent:
https://wiki.jasig.org/display/PLT/Hello+World+Portlet

It has an example simple web.xml, portlet.xml, etc. If you are new to Java or Java web applications, you probably out to read up on that and Maven prior to getting into the portlet side of things, though.

As for where to go after Hello World, I lot of people use Spring Portlet MVC, in which case you might do something like this in web.xml (I tried to strip out the unnecessary parts, but not sure how good of a job I did):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>yourportletname</display-name>
    <description>Description of the portlet</description>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/context/portlet/nameofyourportlet.xml
        </param-value>
    </context-param>
    <context-param>
        <param-name>webAppRootKey</param-name>
        <param-value>some.parent.package.newofyourportlet</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.util.WebAppRootListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>ViewRendererServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>ViewRendererServlet</servlet-name>
        <url-pattern>/WEB-INF/servlet/view</url-pattern>
    </servlet-mapping>
</web-app>

And could look at this as an example of spring context, pom.xml, portlet.xml, etc.: https://source.jasig.org/sandbox/MailPortlet/tags/rel-2.0.0-alpha-7/

There are also a Grails Portlet project and a Rails-portlet project, I think both aimed at JSR-286 implementations like Liferay (I know the latter is at the moment).

If you want to see what is it really doing in the assembly portion, look at FileAssembler.java. For example I found it here:
http://github.com/apache/pluto/blob/trunk/pluto-util/src/main/java/org/apache/pluto/util/assemble/file/FileAssembler.java

Gary


On Jun 3, 2010, at 1:33 PM, Søren Blidorf wrote:

> Thanks Gary. I will look at it.
>  
> When I use mvn package I get a build error - invalid web.xml.
>  
> Does anybody know what is needed in the web.xml for maven to concider it valid?
>  
> Soren
>  
> -----Oprindelig meddelelse-----
> Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
> Sendt: 3. juni 2010 17:22
> Til: pluto-user@portals.apache.org
> Emne: Re: Help setting up hello world
>  
> Soren,
>  
> Assuming you are talking about this hello world example?:
> http://portals.apache.org/pluto/v20/deploying.html
>  
> I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
> https://wiki.jasig.org/display/PLT/Hello+World+Portlet
>  
> Some other example portlets are here:
> https://source.jasig.org/portlets/
> there are also some in here but not all of these work:
> https://source.jasig.org/sandbox/
>  
> As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.
>  
> Some miscellaneous tips/notes:
> * Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
> * Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
> * Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
> * Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
> * Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
> * In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).
>  
> Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.
>  
> Wish I could provide more info, but maybe some of that will help.
>  
> Gary
>  
>  
> On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:
> 
> 
> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>  
>  


SV: Help setting up hello world

Posted by Søren Blidorf <so...@nolas.dk>.
Thanks Gary. I will look at it.

 

When I use mvn package I get a build error - invalid web.xml.

 

Does anybody know what is needed in the web.xml for maven to concider it
valid?

 

Soren

 

-----Oprindelig meddelelse-----
Fra: Gary Weaver [mailto:gary.weaver@duke.edu] 
Sendt: 3. juni 2010 17:22
Til: pluto-user@portals.apache.org
Emne: Re: Help setting up hello world

 

Soren,

 

Assuming you are talking about this hello world example?:

http://portals.apache.org/pluto/v20/deploying.html

 

I also just found another example, even though it is geared for uPortal
rather than the example Pluto server. (But uPortal uses Pluto and supports
JSR-168 compliant portlets, so should work.):

https://wiki.jasig.org/display/PLT/Hello+World+Portlet

 

Some other example portlets are here:

https://source.jasig.org/portlets/

there are also some in here but not all of these work:

https://source.jasig.org/sandbox/

 

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are
still JSR-168), but that shouldn't matter afaik just to get something simple
working.

 

Some miscellaneous tips/notes:

* Pluto's jars should be in the shared/lib area, which requires some change
to the default Tomcat 6 config to have it look for. That is the most
appropriate place for it, afaik.

* Like any war, if you unzip the war, it should unzip its contents into the
current directory (i.e. is isn't unzipping into (webapp directory name)/...
). That is just a war thing, not specific to portlets. This only matters if
you tried to make the war by hand.

* Pluto's assembly API must be used to prep the war. There is a
maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto
assembly looks at the portlet.xml then modifies the web.xml and adds
portlet*.tld file(s).

* Even though Tomcat is much more lenient when it decompresses a war, Pluto
assembly (used by maven-pluto-plugin) uses the standard Java API to unjar
the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and
there should be only one manifest), it will choke (and the error is not that
helpful).

* Just because maven-pluto-plugin preps the war doesn't mean it is a valid
portlet (or even valid web.xml and portlet.xml for a portlet) or that it
will even register in Pluto afaik. You need to make sure that web.xml is
cleaned up and that you didn't try to add the stuff that Pluto assembly puts
into it. (For info on how to clean it up if you need that, see the unplutofy
project).

* In newer versions of pluto (not sure what version, but sometime between
1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So
you can someone tell if a portlet is available and at least valid enough for
Pluto to register it (although it still may not work) if the logs showed
that it registered. It may not register each time though? Registering is
different than just Tomcat deploying the war (it is the line right after
that in the logs usually, I think).

 

Hopefully none of that info is wrong, and please anyone feel free to correct
or clarify those.

 

Wish I could provide more info, but maybe some of that will help.

 

Gary

 

 

On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:





Hi.

 

I am new to portlets and Pluto.

 

I have installed Pluto on my existing Tomcat and it works fine.

 

However I am having difficulties setting up a helloworld portlet.

 

I have created the portlet.xml and the helloworld.java. Compiled and deploy
but nothing happens.

 

I have tried different examples on google, but nothing works.

 

Does anybody have a helloworld.war file of a describsion for dummies on how
to get a helloworld to work.

 

Soren

 

 


Re: Help setting up hello world

Posted by Gary Weaver <ga...@duke.edu>.
Soren,

Assuming you are talking about this hello world example?:
http://portals.apache.org/pluto/v20/deploying.html

I also just found another example, even though it is geared for uPortal rather than the example Pluto server. (But uPortal uses Pluto and supports JSR-168 compliant portlets, so should work.):
https://wiki.jasig.org/display/PLT/Hello+World+Portlet

Some other example portlets are here:
https://source.jasig.org/portlets/
there are also some in here but not all of these work:
https://source.jasig.org/sandbox/

As of 2010/06/03 I'm not sure how any of those if any are JSR-286 (most are still JSR-168), but that shouldn't matter afaik just to get something simple working.

Some miscellaneous tips/notes:
* Pluto's jars should be in the shared/lib area, which requires some change to the default Tomcat 6 config to have it look for. That is the most appropriate place for it, afaik.
* Like any war, if you unzip the war, it should unzip its contents into the current directory (i.e. is isn't unzipping into (webapp directory name)/... ). That is just a war thing, not specific to portlets. This only matters if you tried to make the war by hand.
* Pluto's assembly API must be used to prep the war. There is a maven-pluto-plugin that can help with this (it uses Pluto assembly). Pluto assembly looks at the portlet.xml then modifies the web.xml and adds portlet*.tld file(s).
* Even though Tomcat is much more lenient when it decompresses a war, Pluto assembly (used by maven-pluto-plugin) uses the standard Java API to unjar the war, and if the META-INF/MANIFEST.MF file isn't the first entry (and there should be only one manifest), it will choke (and the error is not that helpful).
* Just because maven-pluto-plugin preps the war doesn't mean it is a valid portlet (or even valid web.xml and portlet.xml for a portlet) or that it will even register in Pluto afaik. You need to make sure that web.xml is cleaned up and that you didn't try to add the stuff that Pluto assembly puts into it. (For info on how to clean it up if you need that, see the unplutofy project).
* In newer versions of pluto (not sure what version, but sometime between 1.0.0-RC2 and 1.1.7), portlets register themselves with pluto (I think). So you can someone tell if a portlet is available and at least valid enough for Pluto to register it (although it still may not work) if the logs showed that it registered. It may not register each time though? Registering is different than just Tomcat deploying the war (it is the line right after that in the logs usually, I think).

Hopefully none of that info is wrong, and please anyone feel free to correct or clarify those.

Wish I could provide more info, but maybe some of that will help.

Gary


On Jun 3, 2010, at 5:58 AM, Søren Blidorf wrote:

> Hi.
>  
> I am new to portlets and Pluto.
>  
> I have installed Pluto on my existing Tomcat and it works fine.
>  
> However I am having difficulties setting up a helloworld portlet.
>  
> I have created the portlet.xml and the helloworld.java. Compiled and deploy but nothing happens.
>  
> I have tried different examples on google, but nothing works.
>  
> Does anybody have a helloworld.war file of a describsion for dummies on how to get a helloworld to work.
>  
> Soren
>