Skip to main content

Using NetBeans to Help Develop New JSR-168 and JSR-286 Portlets

Posted by garysweaver on August 19, 2008 at 12:59 PM PDT

Looking for information on how to quickly develop new JSR-168 and JSR-286 compliant portlets in an IDE an article called Developing Portlets with NetBeans Portal Pack 2.0.

Those instructions appear to mostly be geared for those looking to develop JSR-286 compliant portlets, so if that's your goal, those instructions may work for you.

However, I had a hard time getting through them for the purpose of using NetBeans 6.1 to quickly generate JSR-168 compliant portlets.

I really wanted to get it working as close to the original instructions as possible, so at first I attempted to add a "OpenPortal Portlet Container 1.0" Server in NetBeans. However I ran into a few problems with that. In the end, it was easiest for me to install portlet-container 1.0_02 (download) in Tomcat 5.5 using these instructions, then adding that Tomcat 5.5 instance as a server in NetBeans 6.1 via Tools -> Servers -> Add Server, and then mostly following the rest of the instructions in Developing Portlets with NetBeans Portal Pack 2.0 to create the portlet, with the exception of having to specify Tomcat 5.5 as the server.

When complete, I was a little surprised (I guess because I didn't understand the inner-workings well-enough) to find that the war I "deployed" to Tomcat wasn't actually in Tomcat's webapps directory. However, with a little searching, I found the war under my NetBeans project dir.

It would have also been nice to have it create a Maven 2 project, but it's still a great start if you just want to create a new portlet quickly! Note also that there are tools to do this in Eclipse. I couldn't find a way to do it in IDea though.

Related Topics >>


The other solution to the issue above mentioned by Cris J Holdorph was to just remove the resource-bundle element from portlet.xml generated by the portal pack. That might be a better solution than having to define properties, if you'd rather not use them. Also note, that Eric Dalquist thinks that the reason it worked without issue in uPortal 3.0.1 was because pluto 1.1.5 *might* have a bug related to this. If you're interested in that, you can track it:

uPortal 3.0.1 can deploy, publish, and display a HelloWorld portlet created using the NetBeans Portal Pack 2.0 without modifications.

However, uPortal GA will fail to render with the following error if the following properties are not set in Source Packages -> (portlet package) ->

javax.portlet.title=Hello World Portlet
javax.portlet.short-title=Hello World

then rebuild, and deploy the new war to uPortal via:

cd (uportal quickstart)/uPortal_rel-2-5-3-1-GA/
ant deployPortletApp -DportletApp=(path to your home directory)/NetBeansProjects/HelloWorld/dist/HelloWorld.war

The error that you get if you don't set these properties in the is:

[java] SEVERE: Servlet.service() for servlet MyPortlet threw exception
[java] java.util.MissingResourceException: Can't find resource for bundle$ResourceBundleImpl, key javax.portlet.title
[java] at java.util.ResourceBundle.getObject(
[java] at java.util.ResourceBundle.getString(
[java] at
[java] at
[java] at
[java] at
[java] at
[java] at org.apache.pluto.core.impl.PortletConfigImpl.getResourceBundle(
[java] at javax.portlet.GenericPortlet.getTitle(
[java] at javax.portlet.GenericPortlet.render(
[java] at org.apache.pluto.core.PortletServlet.dispatch(
[java] at org.apache.pluto.core.PortletServlet.doGet(
[java] at javax.servlet.http.HttpServlet.service(
[java] at javax.servlet.http.HttpServlet.service(