resource bundles and null pointer exception

32911, modified 18 Years ago. New Member Posts: 8 Join Date: 6/20/07 Recent Posts
I have a Liferay 4.2.2 professional installation running on tomcat 5.5.23. I have written my own portlet and deployed it successfully by adding it under WEB-INF/classes/com/myorg/ and editing WEB-INF/portlet-ext.xml, WEB-INF/liferay-portlet-ext.xml and WEB-INF/liferay-display.xml.

My problem happens when I try to modfiy the code from using the StrutsResourceBundle to using my own. I did the following:

1) created a MyResources.properties file and placed it under WEB-INF/classes/com/myorg.
2) Edited the portal-ext definition file so that the resource-bundle element is:
<resource-bundle>com.myorg.MyResources</resource-bundle>

After these changes running liferay causes a NullPointerexception with the following stack-trace:

at com.liferay.portlet.PortletConfigImpl.getResourceBundle(PortletConfigImpl.java:148)
at javax.portlet.GenericPortlet.getTitle(GenericPortlet.java:188)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:162)
at com.liferay.portlet.CachePortlet._invoke(CachePortlet.java:365)
at com.liferay.portlet.CachePortlet.render(CachePortlet.java:182)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:953)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
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 com.liferay.filters.strip.StripFilter.doFilter(StripFilter.java:260)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.liferay.filters.compression.CompressionFilter.doFilter(CompressionFilter.java:124)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

As I said, defining the resource bundle to be com.liferay.portlet.StrutsResourceBundle works just fine, my change doesn't.

I would appreciate any pointers as to what I am doing wrong.

- Alex
34926, modified 18 Years ago. New Member Posts: 6 Join Date: 8/25/07 Recent Posts
Hi Alexandre,

did you solve your problem? I'm facing the same and would appreciate your help and experience.

Greetings,

Carsten
148152, modified 18 Years ago. New Member Posts: 7 Join Date: 9/13/07 Recent Posts
I have the same problem ...

someone know how to solve this problem!??
thumbnail
16781, modified 18 Years ago. Expert Posts: 261 Join Date: 4/10/06 Recent Posts
Hi, me too.
32911, modified 18 Years ago. New Member Posts: 8 Join Date: 6/20/07 Recent Posts
I never found or got an answer to this issue, so I ended up just adding my stuff to the StrutsResoruceBundle.

This involved:
  • In the portlet-ext.xml configuration for the portlet, declare it to use the com.liferay.portlet. StrutsResourceBundle
  • Added a Language-ext.properties file to WEB-INF/classes/content with the property javax.portlet.title.XXX (where XXX is my portlet name) set to the desired value, for example, "javax.portlet.title.E01=My Title"


Didn't solve the original problem, but was the only way I could get the title I wanted to show up.

- Alex
thumbnail
33221, modified 18 Years ago. Junior Member Posts: 41 Join Date: 5/30/07 Recent Posts
I have the same problem ...