You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Beto <gi...@gmail.com> on 2010/07/13 22:32:29 UTC
MissingResourceException
I'm following the user guide - 3.4.1. Message Resolution.
Putting the HomePage's properties file I receive that exception:
[QUOTE]
java.util.MissingResourceException: Message "title" not found in
bundle "park.web.page.HomePage" for locale "pt_BR"
at org.apache.click.util.MessagesMap.get(MessagesMap.java:176)
at org.apache.click.util.MessagesMap.get(MessagesMap.java:69)
at org.apache.click.Page.getMessage(Page.java:800)
at park.web.page.HomePage.<init>(HomePage.java:29)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at org.apache.click.ClickServlet.newPageInstance(ClickServlet.java:1285)
at org.apache.click.ClickServlet.initPage(ClickServlet.java:1131)
at org.apache.click.ClickServlet.createPage(ClickServlet.java:983)
at org.apache.click.ClickServlet.handleRequest(ClickServlet.java:363)
at org.apache.click.ClickServlet.doGet(ClickServlet.java:276)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:530)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:427)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:494)
at org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:182)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:933)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:362)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:867)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
at org.eclipse.jetty.server.Server.handle(Server.java:334)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:559)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:992)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:541)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:203)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:406)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:462)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
at java.lang.Thread.run(Thread.java:636)
[/QUOTE]
HomePage:
public HomePage() {
getModel().put("title", getMessage("title"));
getModel().put("heading", getMessage("heading"));
}
HomePage.properties:
title=Main Page
heading=Main
Thanks,
Gilberto
Re: MissingResourceException
Posted by Beto <gi...@gmail.com>.
On Wed, Jul 14, 2010 at 9:04 AM, Bob Schellink <sa...@gmail.com> wrote:
> On 14/07/2010 21:25, Beto wrote:
>>
>> After fixing that, I'm getting another exception(the same one) because
>> I'm mixing local and global [3] properties file in border-template.htm
>> file. Click is trying to find a global key in the local properties
>> file:
>> [QUOTE]
>> java.util.MissingResourceException: Message "webapp.name" not found in
>> bundle "park.web.page.HomePage" for locale "pt_BR"
>> at org.apache.click.util.MessagesMap.get(MessagesMap.java:176)
>> [/QUOTE]
>>
>> Any advice here?
>
>
> This scenario is supported by Click's message lookup strategy[1]. Click looks up the message in the
> parent bundle and if not found checks in the local bundle before throwing an exception. So it seems
> the click-page.properties is not in the WAR classes folder?
>
> Kind regards
>
> Bob
>
> [1]: http://click.apache.org/docs/user-guide/html/ch02s11.html
>
Thanks, it works now!
Re: MissingResourceException
Posted by Bob Schellink <sa...@gmail.com>.
On 14/07/2010 21:25, Beto wrote:
>
> After fixing that, I'm getting another exception(the same one) because
> I'm mixing local and global [3] properties file in border-template.htm
> file. Click is trying to find a global key in the local properties
> file:
> [QUOTE]
> java.util.MissingResourceException: Message "webapp.name" not found in
> bundle "park.web.page.HomePage" for locale "pt_BR"
> at org.apache.click.util.MessagesMap.get(MessagesMap.java:176)
> [/QUOTE]
>
> Any advice here?
This scenario is supported by Click's message lookup strategy[1]. Click looks up the message in the
parent bundle and if not found checks in the local bundle before throwing an exception. So it seems
the click-page.properties is not in the WAR classes folder?
Kind regards
Bob
[1]: http://click.apache.org/docs/user-guide/html/ch02s11.html
Re: MissingResourceException
Posted by Beto <gi...@gmail.com>.
On Tue, Jul 13, 2010 at 7:49 PM, Bob Schellink <sa...@gmail.com> wrote:
> On 14/07/2010 06:32, Beto wrote:
>> I'm following the user guide - 3.4.1. Message Resolution.
>> Putting the HomePage's properties file I receive that exception:
>> [QUOTE]
>> java.util.MissingResourceException: Message "title" not found in
>> bundle "park.web.page.HomePage" for locale "pt_BR"
>
>> HomePage:
>> public HomePage() {
>> getModel().put("title", getMessage("title"));
>> getModel().put("heading", getMessage("heading"));
>>
>> }
>>
>> HomePage.properties:
>
>
> To confirm, is your properties and classes under the same package?
>
> park.web.page.HomePage
> park.web.page.HomePage.properties
>
Yes, they are.[1]
> Make sure the park.web.page.HomePage.properties file is available in your WAR as well.
That was the problem, it wasn't!
But I just found the solution. I don't know how it works with ANT but
in MAVEN it just copy resources found in src/main/resources
directory[2]. Files other than *.java aren't copy when they are inline
with their java source file.
Solution:
[QUOTE]
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
[/QUOTE]
After fixing that, I'm getting another exception(the same one) because
I'm mixing local and global [3] properties file in border-template.htm
file. Click is trying to find a global key in the local properties
file:
[QUOTE]
java.util.MissingResourceException: Message "webapp.name" not found in
bundle "park.web.page.HomePage" for locale "pt_BR"
at org.apache.click.util.MessagesMap.get(MessagesMap.java:176)
[/QUOTE]
Any advice here?
Thanks,
Gilberto
[1] http://code.google.com/p/construtor/source/browse/#svn/trunk/park-jpa/web/src/main/java/park/web/page
[2] http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
[3] http://code.google.com/p/construtor/source/browse/#svn/trunk/park-jpa/web/src/main/resources
Re: MissingResourceException
Posted by Bob Schellink <sa...@gmail.com>.
On 14/07/2010 06:32, Beto wrote:
> I'm following the user guide - 3.4.1. Message Resolution.
> Putting the HomePage's properties file I receive that exception:
> [QUOTE]
> java.util.MissingResourceException: Message "title" not found in
> bundle "park.web.page.HomePage" for locale "pt_BR"
> HomePage:
> public HomePage() {
> getModel().put("title", getMessage("title"));
> getModel().put("heading", getMessage("heading"));
>
> }
>
> HomePage.properties:
To confirm, is your properties and classes under the same package?
park.web.page.HomePage
park.web.page.HomePage.properties
Make sure the park.web.page.HomePage.properties file is available in your WAR as well.
regards
Bob