?
Solved

displayed session number in tomcat web application manager..question

Posted on 2004-11-12
11
Medium Priority
?
229 Views
Last Modified: 2013-12-03
Hi,

If I start my servlet  I see a new session in  the tomcat web application manager. But After logging out and calling session.invalidate() the number of created session is still the same???

please ..help!!!
0
Comment
Question by:aimueller
  • 3
  • 3
  • 2
8 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 12566012
the session still will exist...  it will just be empty, and will be destroyed when it times out (or tomcat decides it is dead)
0
 

Author Comment

by:aimueller
ID: 12568221
actually I have a problem with db connection pool: My servlet lost the db connection after 1 or 2 minutes, the configuration file is:
         <Resource name="jdbc/test" scope="Shareable" type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/test">
            <parameter>
              <name>driverClassName</name>
              <value>oracle.jdbc.driver.OracleDriver</value>
            </parameter>
            <parameter>
              <name>url</name>
              <value>jdbc:oracle:thin:@1.1.1.0:1521:test</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>test</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>test</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>4</value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>10000</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>40</value>
            </parameter>
          </ResourceParams>

what is wrong in the config file..please!!

0
 
LVL 35

Expert Comment

by:TimYates
ID: 12574037
>  My servlet lost the db connection after 1 or 2 minutes,

You keep the connection open all that time?

You should open it when you need it, then close it again to return it to the pool
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:aimueller
ID: 12574174
in my code:
- the main servlet resolves the datasource in the init()
- the main servlet opens - every access - the db connection in the doPost()  and gives it to the beans
- finally the main servlet do close the db connection

the beans do some calculations that takes max. 1 min.

May be the config file that I post it is not trivial??
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 12574555
Remember that connections are not managed by the run-time as your objects (garbage-collection). An open connection should be closed :-)

>> finally the main servlet do close the db connection

What if there are exceptions in between? Is the connection closed in a try block or a finally block (it should be in the finally block).
0
 

Author Comment

by:aimueller
ID: 12574778
yeh.. the main servlet do close the connection in the finally block.
since every bean need a db connection, the db connection should be open in the main servlet :-(

0
 
LVL 30

Accepted Solution

by:
Mayank S earned 100 total points
ID: 12577149
Why can't the beans open it and close it themselves? You should have a Data Access Layer which does the job of opening/ closing connections and shooting queries. This layer should be called by the EJBs.
0
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 100 total points
ID: 12582346
Or if you don't use EJBs, you should still open and close the connection in the beans...
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
With more and more companies allowing their employees to work remotely, it begs the question: What are some of the security risks involved with remote employees and what actions should we take to secure them?
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question