[Bug 53900] New: hi

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53900

  Priority: P2
Bug ID: 53900
  Assignee: dev@tomcat.apache.org
   Summary: hi
  Severity: normal
Classification: Unclassified
OS: Windows XP
  Reporter: ily.sncs...@gmail.com
  Hardware: PC
Status: NEW
   Version: nightly
 Component: Application Taglib
   Product: Taglibs

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[GUMP@vmgump]: Project tomcat-taglibs-standard (in module tomcat-taglibs) failed

2012-09-19 Thread Gump
To whom it may engage...

This is an automated request, but not an unsolicited one. For 
more information please visit http://gump.apache.org/nagged.html, 
and/or contact the folk at gene...@gump.apache.org.

Project tomcat-taglibs-standard has an issue affecting its community 
integration.
This issue affects 2 projects,
 and has been outstanding for 83 runs.
The current state of this project is 'Failed', with reason 'Build Failed'.
For reference only, the following projects are affected by this:
- tomcat-taglibs-standard :  Standard Taglib
- tomcat-taglibs-standard-install :  JSP Taglibs


Full details are available at:

http://vmgump.apache.org/gump/public/tomcat-taglibs/tomcat-taglibs-standard/index.html

That said, some information snippets are provided here.

The following annotations (debug/informational/warning/error messages) were 
provided:
 -INFO- Optional dependency httpunit failed with reason build failed
 -DEBUG- (Apache Gump generated) Apache Maven Settings in: 
/srv/gump/public/workspace/tomcat-taglibs/standard/gump_mvn_settings.xml
 -INFO- Failed with reason build failed
 -DEBUG- Maven POM in: 
/srv/gump/public/workspace/tomcat-taglibs/standard/pom.xml
 -INFO- Failed to extract fallback artifacts from Gump Repository



The following work was performed:
http://vmgump.apache.org/gump/public/tomcat-taglibs/tomcat-taglibs-standard/gump_work/build_tomcat-taglibs_tomcat-taglibs-standard.html
Work Name: build_tomcat-taglibs_tomcat-taglibs-standard (Type: Build)
Work ended in a state of : Failed
Elapsed: 21 secs
Command Line: /opt/maven2/bin/mvn --batch-mode -DskipTests=true --settings 
/srv/gump/public/workspace/tomcat-taglibs/standard/gump_mvn_settings.xml 
install 
[Working Directory: /srv/gump/public/workspace/tomcat-taglibs/standard]
M2_HOME: /opt/maven2
-
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[debug] execute contextualize
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 
/srv/gump/public/workspace/tomcat-taglibs/standard/spec/src/test/resources
[INFO] Copying 3 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] Tests are skipped.
[INFO] [bundle:bundle {execution: default-bundle}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing 
/srv/gump/public/workspace/tomcat-taglibs/standard/spec/target/taglibs-standard-spec-1.2-SNAPSHOT.jar
 to 
/srv/gump/public/workspace/mvnlocalrepo/shared/org/apache/taglibs/taglibs-standard-spec/1.2-SNAPSHOT/taglibs-standard-spec-1.2-SNAPSHOT.jar
[INFO] [bundle:install {execution: default-install}]
[INFO] Parsing 
file:/srv/gump/public/workspace/mvnlocalrepo/shared/repository.xml
[INFO] Installing 
org/apache/taglibs/taglibs-standard-spec/1.2-SNAPSHOT/taglibs-standard-spec-1.2-SNAPSHOT.jar
[INFO] Writing OBR metadata
[INFO] 
[INFO] Building JSTL Implementation
[INFO]task-segment: [install]
[INFO] 
[INFO] [remote-resources:process {execution: default}]
[INFO] snapshot org.apache.taglibs:taglibs-standard-spec:1.2-SNAPSHOT: checking 
for updates from apache.snapshots
[debug] execute contextualize
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 14 resources
[INFO] Copying 3 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 96 source files to 
/srv/gump/public/workspace/tomcat-taglibs/standard/impl/target/classes
[INFO] -
[ERROR] COMPILATION ERROR : 
[INFO] -
[ERROR] 
/srv/gump/public/workspace/tomcat-taglibs/standard/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java:[38,7]
 error: DataSourceWrapper is not abstract and does not override abstract method 
getParentLogger() in CommonDataSource
[INFO] 1 error
[INFO] -
[INFO] 
[ERROR] BUILD FAILURE
[INFO] 
[INFO] Compilation failure
/srv/gump/public/workspace/tomcat-taglibs/standard/impl/src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java:[38,7]
 error: DataSourceWrapper is not abstract and does not override abstract method 
getParentLogger() in CommonDataSource

[INFO] 
[INFO] For more information, run Maven with the -e switch
[INFO] ---

[Bug 53897] Customized EL resolver to improve the performance of EL resolving

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53897

Sheldon Shao  changed:

   What|Removed |Added

 OS||All

--- Comment #4 from Sheldon Shao  ---
Related with https://issues.apache.org/bugzilla/show_bug.cgi?id=53896

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1387486 - /tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java

2012-09-19 Thread kfujino
Author: kfujino
Date: Wed Sep 19 08:42:33 2012
New Revision: 1387486

URL: http://svn.apache.org/viewvc?rev=1387486&view=rev
Log:
The "running" flag is moved out of "if" block. 

Modified:

tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java

Modified: 
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1387486&r1=1387485&r2=1387486&view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
 (original)
+++ 
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
 Wed Sep 19 08:42:33 2012
@@ -64,8 +64,8 @@ public class TcpPingInterceptor extends 
 @Override
 public synchronized void start(int svc) throws ChannelException {
 super.start(svc);
+running = true;
 if ( thread == null && useThread) {
-running = true;
 thread = new PingThread();
 thread.setDaemon(true);
 thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
@@ -86,8 +86,8 @@ public class TcpPingInterceptor extends 
 
 @Override
 public void stop(int svc) throws ChannelException {
+running = false;
 if ( thread != null ) {
-running = false;
 thread.interrupt();
 thread = null;
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1387487 - /tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java

2012-09-19 Thread kfujino
Author: kfujino
Date: Wed Sep 19 08:45:28 2012
New Revision: 1387487

URL: http://svn.apache.org/viewvc?rev=1387487&view=rev
Log:
The "running" flag is moved out of "if" block. 

Modified:

tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1387487&r1=1387486&r2=1387487&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
 Wed Sep 19 08:45:28 2012
@@ -64,8 +64,8 @@ public class TcpPingInterceptor extends 
 @Override
 public synchronized void start(int svc) throws ChannelException {
 super.start(svc);
+running = true;
 if ( thread == null && useThread) {
-running = true;
 thread = new PingThread();
 thread.setDaemon(true);
 thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
@@ -86,8 +86,8 @@ public class TcpPingInterceptor extends 
 
 @Override
 public void stop(int svc) throws ChannelException {
+running = false;
 if ( thread != null ) {
-running = false;
 thread.interrupt();
 thread = null;
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1387489 - /tomcat/tc6.0.x/trunk/STATUS.txt

2012-09-19 Thread kfujino
Author: kfujino
Date: Wed Sep 19 08:49:32 2012
New Revision: 1387489

URL: http://svn.apache.org/viewvc?rev=1387489&view=rev
Log:
Additional patch.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1387489&r1=1387488&r2=1387489&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Wed Sep 19 08:49:32 2012
@@ -159,6 +159,7 @@ PATCHES PROPOSED TO BACKPORT:
 * Fix a behavior of TcpPingInterceptor#useThread.
   If set to false, ping thread is never started. 
   http://svn.apache.org/viewvc?view=revision&revision=1387073
+  http://svn.apache.org/viewvc?view=revision&revision=1387487
   +1: kfujino
   -1:
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1387073 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java webapps/docs/changelog.xml webapps/docs/config/cluster-interceptor.xml

2012-09-19 Thread Keiichi Fujino
2012/9/18 Konstantin Kolinko :
> 2012/9/18  :
>> Author: kfujino
>> Date: Tue Sep 18 09:45:17 2012
>> New Revision: 1387073
>>
>> URL: http://svn.apache.org/viewvc?rev=1387073&view=rev
>> Log:
>> Fix a behavior of TcpPingInterceptor#useThread.
>> If set to false, ping thread is never started.
>>
>> Modified:
>> 
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>> tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
>> tomcat/tc7.0.x/trunk/webapps/docs/config/cluster-interceptor.xml
>>
>> Modified: 
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java?rev=1387073&r1=1387072&r2=1387073&view=diff
>> ==
>> --- 
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>>  (original)
>> +++ 
>> tomcat/tc7.0.x/trunk/java/org/apache/catalina/tribes/group/interceptors/TcpPingInterceptor.java
>>  Tue Sep 18 09:45:17 2012
>> @@ -64,8 +64,8 @@ public class TcpPingInterceptor extends
>>  @Override
>>  public synchronized void start(int svc) throws ChannelException {
>>  super.start(svc);
>> -running = true;
>> -if ( thread == null ) {
>> +if ( thread == null && useThread) {
>> +running = true;
>>  thread = new PingThread();
>>  thread.setDaemon(true);
>>  
>> thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
>> @@ -86,9 +86,11 @@ public class TcpPingInterceptor extends
>>
>>  @Override
>>  public void stop(int svc) throws ChannelException {
>> -running = false;
>> -if ( thread != null ) thread.interrupt();
>> -thread = null;
>> +if ( thread != null ) {
>> +running = false;
>> +thread.interrupt();
>> +thread = null;
>> +}
>>  super.stop(svc);
>>  }
>
> The above changes the meaning of the "running" flag.
>
> IMHO, the flag is supposed to say whether TcpPingInterceptor itself is
> running or not. It does not matter whether you started a thread or
> not.  So I would move it out of the "if" block.
>
>

Done.

Thanks for the review.


> Best regards,
> Konstantin Kolinko
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>



-- 
Keiichi.Fujino

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53900] hi

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53900

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Mark Thomas  ---
SPAM - user disabled.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53897] Customized EL resolver to improve the performance of EL resolving

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53897

--- Comment #5 from Jarek Gawor  ---
This is essentially a duplicate of
https://issues.apache.org/bugzilla/show_bug.cgi?id=53896. From my reading of
the JSP 2.2 spec (section 2.9), it implies that the ELResolver used by JSP
application should be an CompositeELResolver (which the JasperELResolver.java
in 53896 is).

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53903] New: Embedded Tomcat7 does not process Servlet API3.0 Annotations (WebListener)

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53903

  Priority: P2
Bug ID: 53903
  Assignee: dev@tomcat.apache.org
   Summary: Embedded Tomcat7 does not process Servlet API3.0
Annotations (WebListener)
  Severity: normal
Classification: Unclassified
  Reporter: manuelha...@gmail.com
  Hardware: PC
Status: NEW
   Version: 7.0.29
 Component: Catalina
   Product: Tomcat 7

When starting an embeeded tomcat with an webapp with
- web.xml with servlet api3 version
- a ServletContextListener implementation with @WebListener Annotation

then the ServletContextlistener is ignored (it wont be registered).

The same Listener works if added manually to web.xml with a -Tag

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53896] Optimized Jasper ELResolver

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53896

Mark Thomas  changed:

   What|Removed |Added

   Severity|normal  |enhancement

--- Comment #2 from Mark Thomas  ---
Correct priority

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Resources - The need for refactoring

2012-09-19 Thread Mark Thomas
On 14/09/2012 19:12, Mark Thomas wrote:
> On 09/09/2012 19:34, Mark Thomas wrote:
>> This is issue a) in Konstantin's comments in TOMCAT-NEXT.txt
>>
>> My expectation is that the need for refactoring in some form or another
>> is clear. Currently Tomcat has the following features:
>> - aliases
>> - resource JARs
>> - VirtualDirContext / VirtualLoader
>>
>> and in Servlet 3.1 there will be overlays. [1]
>>
>> Each of these features (except overlays which isn't implemented yet)
>> does almost the same thing each in slightly different ways. The code is
>> already quite messy and adding overlay support is going to be really
>> difficult without some refactoring. The various bugs we have seen in the
>> Virtual[Context|Loader] implementation hasn't been great and I am
>> concerned that an overlay implementation built on the existing code will
>> be fragile.
>>
>> A refactored, coherent resources implementation will make implementing
>> overlays a lot simpler. The new resources implementation I just
>> committed already supports overlays - it just needs plumbing in to
>> whatever API the Servlet EG defines.
>>
>> I view this issue not as what the refactoring should look like but that
>> there is a need for a refactoring of some form before any further
>> features are added for resource handling.
> 
> I haven't seen any arguments against this point. If none are forthcoming
> in the next few days, I am going to assume that there is no argument
> that refactoring of the resource handling is required for Tomcat 8.0.x
> (although there may well be different views on what that refactoring
> should look like).

There haven't been any views expressed that a refactoring is
unnecessary. I am therefore going to consider this issue closed with the
agreed position that refactoring - in some form - is required of the
resources implementation for Tomcat 8 onwards.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Resources - Is DirContext the right basis for the API?

2012-09-19 Thread Mark Thomas
On 09/09/2012 19:50, Mark Thomas wrote:
> This is part of issue b) in Konstantin's comments in TOMCAT-NEXT.txt
> 
> Konstantin has accurately summed up the issues with basing the API on
> DirContext as:
>  - Unnecessary objects, e.g. NamingException instead of null.
> 
>  - Too many methods. Name vs. String. list() vs. listBindings().
> 
>  - Limited API. As a workaround, there are non-standard methods that
>are implemented on BaseDirContext instead, e.g. getRealPath(),
>doListBindings(..).
> 
> I do not believe that the resources implementation should be based
> around DirContext. It adds a lot of unnecessary clutter and complexity
> to something that is already fairly complex. A comparison of the
> DirContext based implementation objects with the new implementation
> demonstrates - in my view - how much simpler this could be.

This is the next issue I'd like to resolve.

Does anyone have any views one way or the other as to whether or not any
refactoring of the Resources implementation should continue to be based
around the JNDI DirContext interface?

My own view remains that DirContext adds complexity and clutter to code
that needs simplicity and clarity.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 53905] New: Connection pool not reusing connections.

2012-09-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=53905

  Priority: P2
Bug ID: 53905
  Assignee: dev@tomcat.apache.org
   Summary: Connection pool not reusing connections.
  Severity: normal
Classification: Unclassified
  Reporter: scott.wat...@hybris.com
  Hardware: PC
Status: NEW
   Version: unspecified
 Component: jdbc-pool
   Product: Tomcat Modules

I am trying the new jdbc connection pool with tomcat 6.0.35 and I am noticing
some strange behavior.

The info about what I am doing is below.

When the pool starts up I see 5 connections as I would expect, then after about
60 seconds 2 connections get dropped as there has been no activity.  Up to this
point everything seems to be working properly.


My test program will do a http get over a fixed number of times for x number of
sessions

So I call all.bat like this

c:\temp> all.bat 2 200 

which will create two session that will do a wget 200 times each of a random
number.


Now I run my test, this is just 2 clients calling the same url over and over
again in a loop. ( I would expect to see only 2 connections required but on the
first run I see a total of 8 connections.  When the test completes in about 20
seconds I run the test again and I see the pool grow to a total of 17
connections.

Also, once I am done my tests I don't see idle connections being released from
the pool either. I have waited over an hour and I don't see the connections
being disconnected.

SQL> /

SYSDATE SID USERNAME   LOGON_TIME  
IDLE
 -- --
 
19-SEP-2012 15:59:06 32 DBA_ 19-SEP-2012
15:45:12 0:0:39
19-SEP-2012 15:59:06 34 DBA_ 19-SEP-2012
15:58:31 0:0:34
19-SEP-2012 15:59:06 54 DBA_ 19-SEP-2012
15:58:55 0:0:11
19-SEP-2012 15:59:06 55 DBA_ 19-SEP-2012
15:58:54 0:0:4
19-SEP-2012 15:59:06 58 DBA_ 19-SEP-2012
15:58:54 0:0:11
19-SEP-2012 15:59:06 69 DBA_ 19-SEP-2012
15:58:57 0:0:8
19-SEP-2012 15:59:06 71 DBA_ 19-SEP-2012
15:59:01 0:0:5
19-SEP-2012 15:59:06 79 DBA_ 19-SEP-2012
15:58:29 0:0:36
19-SEP-2012 15:59:06 81 DBA_ 19-SEP-2012
15:45:12 0:0:49
19-SEP-2012 15:59:06 87 DBA_ 19-SEP-2012
15:59:02 0:0:4
19-SEP-2012 15:59:06 92 DBA_ 19-SEP-2012
15:58:27 0:0:37
19-SEP-2012 15:59:06 94 DBA_ 19-SEP-2012
15:58:29 0:0:37
19-SEP-2012 15:59:06108 DBA_ 19-SEP-2012
15:58:59 0:0:5
19-SEP-2012 15:59:06117 DBA_ 19-SEP-2012
15:58:56 0:0:10
19-SEP-2012 15:59:06119 DBA_ 19-SEP-2012
15:45:12 0:0:37
19-SEP-2012 15:59:06132 DBA_ 19-SEP-2012
15:58:53 0:0:12
19-SEP-2012 15:59:06133 DBA_ 19-SEP-2012
15:58:56 0:0:10

17 rows selected.




all.bat
~~~
echo off
set size=%2

for /L %%x in (1, 1, %1) do (call :sub %%x )
GOTO :eof

:sub
start cmd /k c:\temp\run.bat %1 %size%
GOTO :eof

:eof



run.bat


echo off
set FILE=%1
set SIZE=%2


for /L %%x in (1, 1, %SIZE% ) do (call :sub %%x )
GOTO :eof

:sub
echo Run %1
wget -q --output-document=sess%FILE%.txt http://localhost:8080/test/db
GOTO :eof


:eof

context.xml










TestServlet.java


import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

import java.io.*;

import javax.servlet.http.*;
import javax.servlet.*;

public class TestServlet extends HttpServlet {

private DataSource dataSource;
private Connection connection;
private Statement statement;

public void init() throws ServletException {
try {
// Get DataSource
Context initContext  = new InitialContext();
Context envContext  =
(Context)initContext.lookup("java:/comp/env");
dataSource = (DataSource)envContext.lookup("jdbc/testdb");


} catch (NamingException e) {
e.printStackTrace();
}
}

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {

PrintWriter out = resp.getWriter(); 
ResultSet resultSet = null;