Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
resource bundles and null pointer exception
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
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
Hi Alexandre,
did you solve your problem? I'm facing the same and would appreciate your help and experience.
Greetings,
Carsten
did you solve your problem? I'm facing the same and would appreciate your help and experience.
Greetings,
Carsten
I have the same problem ...
someone know how to solve this problem!??
someone know how to solve this problem!??
Hi, me too.
I never found or got an answer to this issue, so I ended up just adding my stuff to the StrutsResoruceBundle.
This involved:
Didn't solve the original problem, but was the only way I could get the title I wanted to show up.
- Alex
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
I have the same problem ...