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.wea...@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.wea...@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

 

 

 

Reply via email to