You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kandi Potter <Ka...@PWGSC.GC.CA> on 2003/04/09 17:01:37 UTC

RE: Cannot find message resources underkeyorg.apache.struts.action.MESSAGE

I have not of experience with struts, but I installed struts 1.1b3 so I could try out the message-resources as well.    I had a lot of trouble with my vm crashing on the struts <bean:resource> and <bean:message> tags, but I suspect that could have been caused by some incompatibility with the new tags and JBuilder 4.0.    

One thing I did notice was that even though you didn't specify the _en suffix in the property name file in struts-config.xml it still used it to access the properties file.    I assume it uses the default locale.   I have 2 properties files from 2 locales (properties_en.properties and properties_fr.properties).  Also I set Locale  to "true" in web.xml under the Action Servlet configuration.


-----Original Message-----
From: James Mitchell [mailto:jmitchell@apache.org]
Sent: Wednesday, April 09, 2003 9:15 AM
To: Struts Users Mailing List
Subject: RE: Cannot find message resources
underkeyorg.apache.struts.action.MESSAGE


That looks right.  It still doesn't work?

On Wed, 2003-04-09 at 07:31, Dani wrote:
> 
> Uff!. Sorry, I didn't understand your answers (because of my terrible
> English). I've made some changes, and it doesn't work.
> 
> I have struts 1.1.
> 
> My web.xml is :
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
> 
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> 
> <web-app><servlet>
>   <servlet-name>action</servlet-name>
>   <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>   <!--                                         I HAVE COMMENTED THESE LINES
> ***
>   <init-param>
>    <param-name>application</param-name>
>    <param-value>GspMensajes</param-value>
>   </init-param>
>   -->
>   <init-param>
>    <param-name>config</param-name>
>    <param-value>/WEB-INF/struts-config.xml</param-value>
>   </init-param>
>   <init-param>
>    <param-name>debug</param-name>
>    <param-value>2</param-value>
>   </init-param>
>   <init-param>
>    <param-name>detail</param-name>
>    <param-value>2</param-value>
>   </init-param>
>   <init-param>
>    <param-name>validate</param-name>
>    <param-value>true</param-value>
>   </init-param>
>   <init-param>
>    <param-name>nocache</param-name>
>    <param-value>true</param-value>
>   </init-param>
>   <load-on-startup>2</load-on-startup> ...... (etc,etc)
> 
> 
> The file struts-config.xml has these lines:
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> 
> <!DOCTYPE struts-config PUBLIC
>           "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> *** I'VE HAVE CHANGED THIS LINE TO struts-config_1.1
>           "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> 
> <struts-config>
>  <action-mappings>
> <message-resources parameter="GspMensajes"/>
>                                 **** NOW THIS IS THE PATH OF MY RESOURCE:
> TOMCAT\webapps\gsp\WEB-INF\classes\GspMensajes.properties
> 
>   </action-mappings>
> 
> </struts-config>
> 
> Is this corret??
> 
> 
> ----- Original Message -----
> From: James Mitchell <jm...@apache.org>
> To: Struts Users Mailing List <st...@jakarta.apache.org>
> Sent: Wednesday, April 09, 2003 1:18 PM
> Subject: Re: Cannot find message resources under
> keyorg.apache.struts.action.MESSAGE
> 
> 
> > On Wed, 2003-04-09 at 06:55, Alessio wrote:
> > > You set the resource in web.xml file?
> >
> > Not in 1.1.  You declare it in the struts-config.xml (or whatever you've
> > named it).  See the docs, dtd, or any one of many example apps for
> > details on how to configure it.
> >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > --
> > James Mitchell
> > Software Developer/Struts Evangelist
> > http://www.open-tools.org
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Cannot find message resources underkeyorg.apache.struts.action.MESSAGE

Posted by James Mitchell <jm...@apache.org>.
On Wed, 2003-04-09 at 11:01, Kandi Potter wrote:
> I have not of experience with struts, but I installed struts 1.1b3 so 
> I could try out the message-resources as well.    I had a lot of
>  trouble with my vm crashing on the struts <bean:resource> and
>  <bean:message> tags, but I suspect that could have been caused by
>  some incompatibility with the new tags and JBuilder 4.0.    
> 
> One thing I did notice was that even though you didn't specify the _en 
> suffix in the property name file in struts-config.xml it still used it
> to access the properties file.    I assume it uses the default locale.
> I have 2 properties files from 2 locales (properties_en.properties and
> properties_fr.properties).  Also I set Locale  to "true" in web.xml
> under the Action Servlet configuration.

You should have a struts "default" bundle.  You should have (using your
example) a "properties.properties", then "properties_en.properties" for
messages specific to English users and "properties_fr.properties" for
messages specific to Frech speaking users.

This allows you to deploy your application on any server in the world
(where the default locale on the actual server may not be "_en")

So, if you want the "default" language for your application to be
English, then rename "properties_en.properties" to
"properties.properties" and it will work fine everywhere.


> 
> 
> -----Original Message-----
> From: James Mitchell [mailto:jmitchell@apache.org]
> Sent: Wednesday, April 09, 2003 9:15 AM
> To: Struts Users Mailing List
> Subject: RE: Cannot find message resources
> underkeyorg.apache.struts.action.MESSAGE
> 
> 
> That looks right.  It still doesn't work?
> 
> On Wed, 2003-04-09 at 07:31, Dani wrote:
> > 
> > Uff!. Sorry, I didn't understand your answers (because of my terrible
> > English). I've made some changes, and it doesn't work.
> > 
> > I have struts 1.1.
> > 
> > My web.xml is :
> > 
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > 
> > <!DOCTYPE web-app
> >   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
> >   "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
> > 
> > <web-app><servlet>
> >   <servlet-name>action</servlet-name>
> >   <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
> >   <!--                                         I HAVE COMMENTED THESE LINES
> > ***
> >   <init-param>
> >    <param-name>application</param-name>
> >    <param-value>GspMensajes</param-value>
> >   </init-param>
> >   -->
> >   <init-param>
> >    <param-name>config</param-name>
> >    <param-value>/WEB-INF/struts-config.xml</param-value>
> >   </init-param>
> >   <init-param>
> >    <param-name>debug</param-name>
> >    <param-value>2</param-value>
> >   </init-param>
> >   <init-param>
> >    <param-name>detail</param-name>
> >    <param-value>2</param-value>
> >   </init-param>
> >   <init-param>
> >    <param-name>validate</param-name>
> >    <param-value>true</param-value>
> >   </init-param>
> >   <init-param>
> >    <param-name>nocache</param-name>
> >    <param-value>true</param-value>
> >   </init-param>
> >   <load-on-startup>2</load-on-startup> ...... (etc,etc)
> > 
> > 
> > The file struts-config.xml has these lines:
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > 
> > <!DOCTYPE struts-config PUBLIC
> >           "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
> > *** I'VE HAVE CHANGED THIS LINE TO struts-config_1.1
> >           "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> > 
> > <struts-config>
> >  <action-mappings>
> > <message-resources parameter="GspMensajes"/>
> >                                 **** NOW THIS IS THE PATH OF MY RESOURCE:
> > TOMCAT\webapps\gsp\WEB-INF\classes\GspMensajes.properties
> > 
> >   </action-mappings>
> > 
> > </struts-config>
> > 
> > Is this corret??
> > 
> > 
> > ----- Original Message -----
> > From: James Mitchell <jm...@apache.org>
> > To: Struts Users Mailing List <st...@jakarta.apache.org>
> > Sent: Wednesday, April 09, 2003 1:18 PM
> > Subject: Re: Cannot find message resources under
> > keyorg.apache.struts.action.MESSAGE
> > 
> > 
> > > On Wed, 2003-04-09 at 06:55, Alessio wrote:
> > > > You set the resource in web.xml file?
> > >
> > > Not in 1.1.  You declare it in the struts-config.xml (or whatever you've
> > > named it).  See the docs, dtd, or any one of many example apps for
> > > details on how to configure it.
> > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > > --
> > > James Mitchell
> > > Software Developer/Struts Evangelist
> > > http://www.open-tools.org
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> > >
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> -- 
> James Mitchell
> Software Developer/Struts Evangelist
> http://www.open-tools.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Design Question Regarding Connection Pooling

Posted by Vic Cekvenich <vc...@basebeans.com>.
Oh god.
DataSource has little to do with Struts.
Containers and app servers provide connection pooling.
PostgreSQL is great! and it's JDBC 3.0 compliant, and provides a 
PooledDataSource as do most other JDBC drivers and DB's out there 
(mySQL, Oracle, MSSQL, etc.)
So a good practice is to create a connection pool in Tomcat, etc.
Working example server.xml for tomcat (also same place has example for 
Orion and Resin & working example of J2EE security:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/doco/server.xml.tomcat4
Just modify it.

Connections in action? Maybe connection in DAO.
Ex:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/war/org/apache/scaffoldingLib/base/DAOIBaseHelper.java
See how I have a static grab on to a data source?
JNDI done once, application wide.


Conn.close()? I don't.
It is a good idea to use one of many DAO implementations out there. I 
use iBatis.com db layer(becasue it is SQL based), others use Hibreante, 
OJB, etc. Pick one.
One should not be coding applications at that low JDBC level anymore.
For one DAO's provide caching, and transctions and .... they just easy 
to talk to db.
Let the DAO worry about all the low level stuff, like connection 
release, transactions, flushing the data cache when CRUD, etc.


hth,
Vic Cekvenich
Project Recovery Specialist
vcekvenich@baseBeans.com
800-314-3295
<a href =”baseBeans.net”>Struts Training</a>






Keith Watanabe wrote:
> Hello,
> 
> I have a question regarding how to handle connection pooling in Struts.  
> Currently, I'm experiencing the error:
> 
> "DBCP could not obtain an idle db connection, pool exhausted"
> 
> I realize that it's mostly coming from me not doing a conn.close().  For 
> me though, that's the issue: where would I insert this statement?
> 
> The current way I'm handling things is that I'm using Tomcat/Commons for 
> handling the connection pooling and then obtaining the connection in my 
> extended Action class using jndi.  In this class, I create a 
> BusinessFactory which sets the connection object so that my created 
> Business objects all have this object.  In turn, the business objects 
> possess a DataFactory which is used to generate Data objects that handle 
> the sql.  Each one of these classes will contain a connection object 
> when created through the DataFactory class.
> 
> Now, what I'm wondering is whether or not this was a wise choice in 
> terms of the ordering of where I'm obtaining and setting the connection 
> pool.  Should the Action class be using jndi to obtain the pool or 
> should it be obtained at a lower level like at the DataFactory or 
> BusinessFactory level?
> 
> Next, if it's suggested to keep this connection call in the Action 
> class, is there something like DESTROY method which gets called when the 
> object goes out of scope so I can put the conn.close() statement?
> 
> Finally, if I do put this conn.close() statement in some place and solve 
> this issue of the db pool being exhausted, can/should I go one step 
> further and cache this connection in the user's session?  Would I gain 
> any performance/resource benefits out of this?  Or is this redundant 
> because the connection pooling is already enabled in the Tomcat/Commons 
> setup?
> 
> Current configuration of system:
> 
> Struts 1.1rc1
> Tomcat 4.18
> Postgres 7.3
> 
> Many thanks!
> 
> -Keith Watanabe



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org