displayed session number in tomcat web application manager..question

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!!!
aimuellerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimYatesCommented:
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
aimuellerAuthor Commented:
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
TimYatesCommented:
>  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
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

aimuellerAuthor Commented:
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
Mayank SAssociate Director - Product EngineeringCommented:
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
aimuellerAuthor Commented:
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
Mayank SAssociate Director - Product EngineeringCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TimYatesCommented:
Or if you don't use EJBs, you should still open and close the connection in the beans...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.