Re: close pooled conection-by value or by reference

2005-07-23 Thread Philip Cote
connection.isClosed() should return a boolean telling you whether or not
the connection was released.

On Sat, 2005-07-23 at 14:18 -0700, Tony Smith wrote:
> I think this is a classic java question: Pass by
> reference or by value. I have a DatabaseManager class
> which takes care of get conection from connection pool
> and release the connectoin. I am not sure about the
> release part. Here is my code:
> 
> class MyMainClass
> 
> public static final void main(String[] args){
> 
> Connection connection =
> DatabaseManager.getConnection();
> 
> //jdbc work.
> 
>DatabaseManager.closeConnection(connection);
> ...
> }
> 
> 
> public class DatabaseManager {
>  
> public static Connection getConnection(){
> Connection connection =
> getConectionFromDataSource();
> 
>return connection;
> }
> 
> public static void closeConnection(Connection
> conn){
>   if (conn != null){
>   try{
>   conn.close();
>   }catch(SQLException sqle){
>   sqle.printStackTrace();
>   }
>   }
>   conn = null;
> }}
> 
> 
> I am not sure if the connection is released
> 
> 
> Thanks,
> 
> 
> 
> 
>   
> 
> Start your day with Yahoo! - make it your home page 
> http://www.yahoo.com/r/hs 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



SV: close pooled conection-by value or by reference

2005-07-23 Thread Øyvind Johansen
This isnt really related to Tomcat, but I really don't care:

You could make the connection static in the class DatabaseManager, so that
your application only uses one connection against DB. This could (?) cause
problems with Threading and several users accessing at once (I guess...).
Really not sure about this though...

However, to be 100% sure that the connection is closed and the Connection
object is destroyed by the garbage-collector, you should add connection =
null in the class MyMainClass as well, otherwise this class would hold a
copy of this object until your program terminates...

You should consider using a layered approach to programming. 
Create a class, DataIO (reading and writing) that has abstract methods for
retrieving data and updating them etc.
Create classes for your data, which act as dataholders. I.e. create a class
MyMainClassData that holds the data retrieved in MyMainClass by the
database. Then create abstract methods for retrieving and manipulating the
data in this object. 

Finally you implement these methods in yet another class, DatabaseDataIO
that implements your interface against the database. 

The solution would look something like this:

MyMainClass:
public static final void main(String[] args) {
   New MyMainClass().doTheStuff(neededArgs);
}

Public void doTheStuff() {
DatabaseDataIO ddio = new DatbaseDataIO();
MyMainClassData data = ddio.getData();

... manipulate data

Ddio.saveData(data);
}

DataIO:
Public abstract MyMainClassData getData();
Public abstract void saveData(MyMainClassData data);

DatabaseDataIO:
Extend and Implement the methods of DataIO

MyMainClassData:
Private fields for every data needed. 
Get and set methods for manipulating the data


In this case you could, of course, still use DataBaseManager, but with or
without it, when you find yourself creating the Main-class, you don't have
to worry about whether or not the connection is being closed. You can trust
that the DatabaseDataIO class does this for you. 

Hope my late Saturday night writing is understandable.

Öyvind Johansen
ETC ElectricTimeCar

-Opprinnelig melding-
Fra: Tony Smith [mailto:[EMAIL PROTECTED] 
Sendt: 23. juli 2005 23:19
Til: Tomcat Users List
Emne: close pooled conection-by value or by reference

I think this is a classic java question: Pass by
reference or by value. I have a DatabaseManager class
which takes care of get conection from connection pool
and release the connectoin. I am not sure about the
release part. Here is my code:

class MyMainClass

public static final void main(String[] args){

Connection connection =
DatabaseManager.getConnection();

//jdbc work.

   DatabaseManager.closeConnection(connection);
...
}


public class DatabaseManager {
 
public static Connection getConnection(){
Connection connection =
getConectionFromDataSource();

   return connection;
}

public static void closeConnection(Connection
conn){
if (conn != null){
try{
conn.close();
}catch(SQLException sqle){
sqle.printStackTrace();
}
}
conn = null;
}}


I am not sure if the connection is released


Thanks,






Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



close pooled conection-by value or by reference

2005-07-23 Thread Tony Smith
I think this is a classic java question: Pass by
reference or by value. I have a DatabaseManager class
which takes care of get conection from connection pool
and release the connectoin. I am not sure about the
release part. Here is my code:

class MyMainClass

public static final void main(String[] args){

Connection connection =
DatabaseManager.getConnection();

//jdbc work.

   DatabaseManager.closeConnection(connection);
...
}


public class DatabaseManager {
 
public static Connection getConnection(){
Connection connection =
getConectionFromDataSource();

   return connection;
}

public static void closeConnection(Connection
conn){
if (conn != null){
try{
conn.close();
}catch(SQLException sqle){
sqle.printStackTrace();
}
}
conn = null;
}}


I am not sure if the connection is released


Thanks,






Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Configure "email catcher" for dev and stage environments?

2005-07-23 Thread Dirk.Weigenand


pgp7nsQwD7a9t.pgp
Description: PGP signature


Web Application Question

2005-07-23 Thread Joe Riopel
Hello,

I'm running Tomcat 5.5.7, and right now I have one application ( the
default application ). I just created a new dir (
$CATALINA_HOME/webapps/cms ) for a new application. The home page (
index.jsp ), for the application, is just a simple jsp file with
static content.

Once I added a WEB-INF/web.xml file, with just filter & filter-mapping
tags, and my welcome-file list, and browse to the application I get a
404 error. Now, if I remove the web.xml file from the WEB-INF/web.xml
directory, I see the correct index.jsp.

I'm looking in the $CATALINA_HOME/logs/catalina.out file and see
nothing. I have watched the file, using "tail -f" during start up, and
don't see any message about a misconfiguration in my web-xml file.

Am I missing a step in the process of creating a  new web application?
Any help would be appreciated.

Thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Multiple Hosts using dyndns

2005-07-23 Thread Daron
My problem was an incorrect directory name, sorry. On your quesiton I can
ping different host names and get a response each time showing the same IP
address.
Regards,
Daron.

-Original Message-
From: Hassan Schroeder [mailto:[EMAIL PROTECTED] 
Sent: Saturday, 23 July 2005 11:25 PM
To: Tomcat Users List
Subject: Re: Multiple Hosts using dyndns


Daron wrote:

> I trying to set up Tomcat 5.5 to respond to multiple host names that I 
> have configured using dyndns. I am not sure which facility I should be 
> using.

Sorry, don't know anything about dyndns -- does your *PC* respond to the
multiple host names? i.e., can you 'ping' each of them and get a response?
If so...

> Since my PC which is running tomcat only has one IP address I belive I 
> need to configure hosts, not virtual hosts.

..you want to configure your multiple host names as Tomcat virtual hosts --
see the Host element documentation.

That's going to be the same regardless of how the name resolution is being
done (dyndns, DNS, NIS, /etc/hosts file, etc.), AFAIK.

HTH,
-- 
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

   dream.  code.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.4/57 - Release Date: 22/07/2005
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Multiple Hosts using dyndns

2005-07-23 Thread Hassan Schroeder

Daron wrote:


I trying to set up Tomcat 5.5 to respond to multiple host names that I have
configured using dyndns. I am not sure which facility I should be using.


Sorry, don't know anything about dyndns -- does your *PC* respond
to the multiple host names? i.e., can you 'ping' each of them and
get a response? If so...


Since my PC which is running tomcat only has one IP address I belive I need
to configure hosts, not virtual hosts.


..you want to configure your multiple host names as Tomcat virtual
hosts -- see the Host element documentation.

That's going to be the same regardless of how the name resolution
is being done (dyndns, DNS, NIS, /etc/hosts file, etc.), AFAIK.

HTH,
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

  dream.  code.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Reloading web context in a cluster

2005-07-23 Thread Davide Romanini

Peter Rossbach ha scritto:
b)   before you change your lib at one node please shutdown the 
context with manager app or ant tasks.
c)   Release change at runtime with cluster is heavy and can not made 
with the same nodes.
 OK, when no class changed that used inside session replication, 
it can be work!

d)   Don't change all nodes at the same time.
 Change one and
 after restart context - see that all session comes in.
 Then made change the others.
e)   Build cluster domains and not running all nodes inside one cluster.
 Tomcat cluster replicated all sessions between every node 
and this is very memory intensive.


  



We are not using (for now) clustering features of Tomcat: we only have 6
instances of Tomcat running without knowing of the others, we have no
session replication.

 

OK, but the word "cluster" means to mean me that replication is 
active... :-)




Yes, I didn't explained well... sorry :-)


So the only solution to update my classes seems to be:

- unload the Axis context for each of the six machines
- update my jar file into WEB-INF/lib
- reload the Axis context for each of the six machines

 



Have you at the reloading="true" to your context.xml? At default tomcat 
not look for class and jar updates!




Mmmh, I think my context is reloadable, not sure... If it's not the only 
way to update my jars is to restart Tomcat??


Bye,
Davide Romanini


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.323 / Virus Database: 267.9.2/55 - Release Date: 21/07/05


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Multiple Hosts using dyndns

2005-07-23 Thread Daron
Hi,
 
I trying to set up Tomcat 5.5 to respond to multiple host names that I have
configured using dyndns. I am not sure which facility I should be using.
Since my PC which is running tomcat only has one IP address I belive I need
to configure hosts, not virtual hosts. Am I correct? Also I am having
trouble finding information that seems completely related to what I am
trying to do. Can anyone recommend a site that addresses my issue?
 
Regards,
Daron Ryan.


Re: Can't get ssl redirection to work properly

2005-07-23 Thread beetle

Dear sir,
Thankyou very much for update ,regards,Gregory
- Original Message - 
From: "Terence M. Bandoian" <[EMAIL PROTECTED]>

To: 
Sent: Saturday, July 23, 2005 7:19 AM
Subject: Re: Can't get ssl redirection to work properly



Hi,

You might try including a URL pattern containing only "/" in addition to
the "/*" pattern.

-Terence M. Bandoian



Hi again.. I don´t know if this mail reached the mailinglist som I
just reply to myself to get the attention again ;).
Is this kind of behaviour by tomcat normal with the redirection?. Does
behave in this way even if you just have an application.war file
deployed on a standalone tomcat?

Best regards
Stefan Nilsson.
On 7/15/05, Stefan Nilsson <[EMAIL PROTECTED]> wrote:



I am running Jboss 4.0.1 with the tomcat 5.0 and I have an
application.ear called pds running on it. To access the application
you simple write "http://adress:8080/pds";

Now I wanted to enable ssl on the webapp.war in the application so I
changed the server.xml and web.xml and created a keystore and
everything. I redirect from "8080" to "8443" and everything works as
long as do like this.
https://adress:8443/pds - works!!

http://adress:8080/pds/login.jsp - works! get redirected to
https://adress:8443/pds/x

http://adress:8080/pds - doesn´t work - I time out and get a no page
found error.

I really need the the old url "http://adress:8080/pds"; to be
redirected to "https://adress:8443/pds "

Any suggestions??
Best regards
Stefan Nisson

Below follows some relevant sections from my server.xml and web.xml:

=== server.xml ==

  

  


=== web.xml =

  Security for Julius PDS
  
  Julius web Security
  Redirect all to SSL
  /*
  
  
  Protection should be CONFIDENTIAL
  CONFIDENTIAL
  
  





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Can't get ssl redirection to work properly

2005-07-23 Thread Terence M. Bandoian
Hi,

You might try including a URL pattern containing only "/" in addition to
the "/*" pattern.

-Terence M. Bandoian


>> Hi again.. I don´t know if this mail reached the mailinglist som I
>> just reply to myself to get the attention again ;).
>> Is this kind of behaviour by tomcat normal with the redirection?. Does
>> behave in this way even if you just have an application.war file
>> deployed on a standalone tomcat?
>>
>> Best regards
>> Stefan Nilsson.
>> On 7/15/05, Stefan Nilsson <[EMAIL PROTECTED]> wrote:
>>  
>>
>>> I am running Jboss 4.0.1 with the tomcat 5.0 and I have an
>>> application.ear called pds running on it. To access the application
>>> you simple write "http://adress:8080/pds";
>>>
>>> Now I wanted to enable ssl on the webapp.war in the application so I
>>> changed the server.xml and web.xml and created a keystore and
>>> everything. I redirect from "8080" to "8443" and everything works as
>>> long as do like this.
>>> https://adress:8443/pds - works!!
>>>
>>> http://adress:8080/pds/login.jsp - works! get redirected to
>>> https://adress:8443/pds/x
>>>
>>> http://adress:8080/pds - doesn´t work - I time out and get a no page
>>> found error.
>>>
>>> I really need the the old url "http://adress:8080/pds"; to be
>>> redirected to "https://adress:8443/pds "
>>>
>>> Any suggestions??
>>> Best regards
>>> Stefan Nisson
>>>
>>> Below follows some relevant sections from my server.xml and web.xml:
>>>
>>> === server.xml ==
>>>
>>>   >>   port = "8080"
>>>   address = "${jboss.bind.address}"
>>>   maxThreads = "150"
>>>   minSpareThreads = "25"
>>>   maxSpareThreads = "75"
>>>   enableLookups = "false"
>>>   redirectPort = "8443"
>>>   acceptCount = "100"
>>>   connectionTimeout = "2"
>>>   disableUploadTimeout = "true"/>
>>>
>>>   >>   port = "8443"
>>>   address = "${jboss.bind.address}"
>>>   maxThreads = "100"
>>>   minSpareThreads = "5"
>>>   maxSpareThreads = "15"
>>>   scheme = "https"
>>>   secure = "true"
>>>   clientAuth = "false"
>>>   keystoreFile = "./keystore"
>>>   keystorePass = "secret"
>>>   sslProtocol = "TLS"/>
>>>
>>>
>>> === web.xml =
>>> 
>>>   Security for Julius PDS
>>>   
>>>   Julius web Security
>>>   Redirect all to SSL
>>>   /*
>>>   
>>>   
>>>   Protection should be CONFIDENTIAL
>>>   CONFIDENTIAL
>>>   
>>>   
>>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs ant build problem

2005-07-23 Thread David Shapiro
Hello,

I am trying to run cvs, but it is failing.  

checkout.depends:
  [cvs] cvs [checkout aborted]: connect to
cvs.apache.org(209.237.227.194):2401 failed: Connection timed out

If you try and ping this site it is not reachable.  Is this not available
anymore?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]