Internal Servlet Error

2013-05-13 Thread Jeny V
Hi ,

I'm having some real issues , running programs in Tomcat on my machine.

 I just copied a jakarta folder named jakarta-tomcat-3.3.1a on to my D: drive 
(Path : D:\Program Files\jakarta-tomcat-3.3.1a) .

 I can run simple jsp programs with no database connection. But whenever I try 
to execute programs with database connections, following error encounters:

Error: 500

Internal Servlet Error:

javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] The specified 
DSN contains an architecture mismatch between the Driver and Application at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
 at students.ques9.patients_1._jspService(patients_1.java:97) at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java) at 
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574) at 
org.apache.tomcat.core.Handler.invoke(Handler.java:322) at 
org.apache.tomcat.core.Handler.service(Handler.java:235) at 
org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917) 
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833) at 
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
 at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494) at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
 at java.lang.Thread.run(Thread.java:722) Root cause: java.sql.SQLException: 
[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture 
mismatch between the Driver and Application at 
sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6956) at 
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7113) at 
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3072) at 
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323) at 
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174) at 
java.sql.DriverManager.getConnection(DriverManager.java:579) at 
java.sql.DriverManager.getConnection(DriverManager.java:243) at 
students.ques9.patients_1._jspService(patients_1.java:64) at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at
javax.servlet.http.HttpServlet.service(HttpServlet.java) at 
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574) at 
org.apache.tomcat.core.Handler.invoke(Handler.java:322) at 
org.apache.tomcat.core.Handler.service(Handler.java:235) at 
org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at 
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917) 
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833) at 
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
 at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494) 
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
 at java.lang.Thread.run(Thread.java:722)
Please do reply or help me with this problem as I tried so many times to fix 
the problem by trying various solutions.

My Laptop details :
Windows Edition : Windows 7
System Type : 64-bit Operating System

JDK version : jdk1.7.0_07
Jakarta Version : 3.3.1a

Looking forward for your early response.

Thanks in advance
Jeny


Re: Internal Servlet Error

2013-05-13 Thread André Warnier

Jeny V wrote:

Hi ,

I'm having some real issues , running programs in Tomcat on my machine.

 I just copied a jakarta folder named jakarta-tomcat-3.3.1a on to my D: drive 
(Path : D:\Program Files\jakarta-tomcat-3.3.1a) .


Do you not read the answers you have already been given ?
The current version of Tomcat is 7. See http://tomcat.apache.org.
You are trying to use a Tomcat version 3, which is more than 10 years old. Nobody can help 
you with that version.


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



Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Chirag Dewan
Hi,

I am embedding  Apache Tomcat 7.0.30 in my application. I am using the Tomcat 
class,and my application requires dynamic addition and removal of 
connectors(HTTP).

Now while removing the connectors,the application gets undeployed but the port 
remains occupied and the connector continue to listen on the port. I am using 
customized HTTP connector.


  Here is a snippet from my source code:

for removing connector:

if( connector != null )
        {
            connector.decUsage();
            if( connector.getUsage() == 0 )
            {
                connector.stop();
                this.tomcat.getService().removeConnector( connector );
            }
        }

for adding connector:

this.tomcat.getService().addConnector( connector );


I know the port is not getting free. Because when I try to deploy to the same 
port again,it gives me an address already in use exception.
I have surfed for this issue a lot,but to no avail. Any help would be greatly 
appreciated.

Thanks

Re: Internal Servlet Error

2013-05-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Jeny,

On 5/13/13 2:52 AM, Jeny V wrote:
 I'm having some real issues , running programs in Tomcat on my 
 machine.
 
 I just copied a jakarta folder named jakarta-tomcat-3.3.1a on to
 my D: drive (Path : D:\Program Files\jakarta-tomcat-3.3.1a) .

I'm going to go ahead and echo the few responses you're already gotten
so far and tell you that you really need to discard that version of
Tomcat. I don't care if you have an application that works on it
(obviously in some other environment) and are afraid to upgrade. That
version is so old, we don't even have the documentation online anymore
for how many unfixed security vulnerabilities may or may not be
present in that version.

The Java Servlet Specification is nominally backward-compatible, so
you should be able to download the latest version of Tomcat, configure
it properly, and run your webapp without too many problems.

 I can run simple jsp programs with no database connection. But 
 whenever I try to execute programs with database connections,
 following error encounters:
 
 Error: 500
 
 
 Internal Servlet Error:
 
 javax.servlet.ServletException: [Microsoft][ODBC Driver Manager]
 The specified DSN contains an architecture mismatch between the
 Driver and Application at [...]

The error is obvious from this message, but if you don't recognize the
important words (architecture mismatch) then you could be lost.

The problem is that you are using a 32-bit ODBC driver on a 64-bit JVM
(or maybe a 64-bit ODBC driver on a 32-bit JVM: you didn't specify
what kind of JVM you were using, though I suspect you have a 64-bit
JVM and a hideously old driver that you've been lugging-around with
your Tomcat 3 install). You need to take one of the following actions:

1. Install a 32-bit JVM and use that. This will solve the architecture
mismatch by switching the JVM. This may have an impact on your webapp
(mostly a smaller maximum heap size) so you may not want to do this.

2. Install a 32-bit version of your ODBC driver and use that. This
will solve the architecture mismatch by switching the driver. You may
not be able to find a compatible 64-bit driver so you may not be able
to do this.

3. Discard your ODBC driver entirely and use a pure-Java JDBC driver.
Pretty much every database has one of these things available one way
or another. This avoids the architecture mismatch entirely and it will
likely result in better performance and stability of your web
application. I highly recommend that you take this course of action.

What database are you using?

 Please do reply or help me with this problem as I tried so many 
 times to fix the problem by trying various solutions.

In the future, it would be best to let everyone know what solutions
you have tried and what the results were (other than just it didn't
work).

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRkRG6AAoJEBzwKT+lPKRYaaoQAJyFeYHGRmZomqFan7W2jdHv
u7TZwFKlLAfkMfJaQQibprnuLZpW4flC5gdM0Rbj14EtfDauEMCSfe++oo6YlvqQ
F0Mih9ReRt7wSxVLNG58hUqcM6Hg3evEtwWoq9yd5I9YHYdl8Cz0X035/tdUHOUz
2RKBqQbFKr3A8m1k6Q6IYjsRKvPFDwyu0ekRYMrvSdtFZkiYPvzzwW1FpXdQ0Rwh
mHmVPrZzoIjiVXLWzT+kfFfrdrK6yBopieYZvOufEei88ZRvaI6u5LrXEpN6GEhX
DNkFoDWjPYXuKdQS+JBdwFX16DIKl7nIqI5nZ2sZthjPVqK64+r26R5tp+WEX5rp
ADkKyb6iGnwpAxy6l4LBGdanpDug0hC2beeOUtmcQkujJoychlvvF5L69VGpeEU1
JSQR0bQJGJIF9rP/PyAjBLzAUSI9sqh8IUZ+Bm+JrpAgiAWNSmKzeCW2te5r/GcF
Nt5ZpKBqMC2UHPNMRxKjIfuGc0gTApX467tVQ5zaouNbWO/lSOMrhZCgF8SD/OcF
fiQGrfeCDirHKIR6sczu3r07fGShTNCA47svAFV3/K31ou5dZT6SM3IvVqo2ZXog
whHWIXLxGl9SZrJToAJYcjlR2nRSb/yKygiE9Z2csgt34fUj9vQmWFo93ueph+j1
p8A0RhUfe4Kx6KzJ5lmP
=LZlk
-END PGP SIGNATURE-

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



Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Chirag,

On 5/13/13 11:34 AM, Chirag Dewan wrote:
 I am embedding  Apache Tomcat 7.0.30 in my application. I am using
 the Tomcat class,and my application requires dynamic addition and
 removal of connectors(HTTP).
 
 Now while removing the connectors,the application gets undeployed
 but the port remains occupied and the connector continue to listen
 on the port. I am using customized HTTP connector.
 
 
 Here is a snippet from my source code:
 
 for removing connector:
 
 if( connector != null ) { connector.decUsage(); if(
 connector.getUsage() == 0 ) { connector.stop(); 
 this.tomcat.getService().removeConnector( connector ); } }
 
 for adding connector:
 
 this.tomcat.getService().addConnector( connector );
 
 
 I know the port is not getting free. Because when I try to deploy
 to the same port again,it gives me an address already in use
 exception. I have surfed for this issue a lot,but to no avail. Any
 help would be greatly appreciated.

Can you take a thread dump and find which code look like it's doing
connection-related things?

How do you observe that the connector is still bound to the port?
netstat? What does it show? What happens if you make a request?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k
iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u
x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L
XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL
XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP
qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G
fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k
2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw
2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0
mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD
0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc
Ev3xtRom84ly50SQcxKf
=zDpF
-END PGP SIGNATURE-

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



Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Chirag Dewan
How do you observe that the connector is still bound to the port?

Yes. I used netstat to observe that. Plus when I try to add another context to 
the same port,I get Address already in use exception.

 What does it show? 

I can see my java process running on that port.

What happens if you make a request?

 As I said,I am sure that the deployed context is removed. I get a timeout on a 
request.

When I start my Tomcat Server(tomcat.start()),I understand it adds a default 
connector to the service on port 8080,so after adding my connector on port 
1090,i can see my java process listening on port 1090 and 8080.

I really dont understand what wrong I might be doing.


Thanks








 From: Christopher Schultz ch...@christopherschultz.net
To: Tomcat Users List users@tomcat.apache.org 
Sent: Monday, 13 May 2013 9:47 PM
Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
 

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Chirag,

On 5/13/13 11:34 AM, Chirag Dewan wrote:
 I am embedding  Apache Tomcat 7.0.30 in my application. I am using
 the Tomcat class,and my application requires dynamic addition and
 removal of connectors(HTTP).
 
 Now while removing the connectors,the application gets undeployed
 but the port remains occupied and the connector continue to listen
 on the port. I am using customized HTTP connector.
 
 
 Here is a snippet from my source code:
 
 for removing connector:
 
 if( connector != null ) { connector.decUsage(); if(
 connector.getUsage() == 0 ) { connector.stop(); 
 this.tomcat.getService().removeConnector( connector ); } }
 
 for adding connector:
 
 this.tomcat.getService().addConnector( connector );
 
 
 I know the port is not getting free. Because when I try to deploy
 to the same port again,it gives me an address already in use
 exception. I have surfed for this issue a lot,but to no avail. Any
 help would be greatly appreciated.

Can you take a thread dump and find which code look like it's doing
connection-related things?

How do you observe that the connector is still bound to the port?
netstat? What does it show? What happens if you make a request?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k
iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u
x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L
XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL
XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP
qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G
fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k
2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw
2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0
mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD
0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc
Ev3xtRom84ly50SQcxKf
=zDpF
-END PGP SIGNATURE-

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

Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread André Warnier

Chirag Dewan wrote:

How do you observe that the connector is still bound to the port?


Yes. I used netstat to observe that. Plus when I try to add another context to the same 
port,I get Address already in use exception.

What does it show? 


I can see my java process running on that port.


What happens if you make a request?


 As I said,I am sure that the deployed context is removed. I get a timeout on a 
request.


If the context was removed, but the Connector was still there, should you not get a 404 
Not Found, rather than a timeout ?




When I start my Tomcat Server(tomcat.start()),I understand it adds a default 
connector to the service on port 8080,so after adding my connector on port 
1090,i can see my java process listening on port 1090 and 8080.

I really dont understand what wrong I might be doing.


Thanks








 From: Christopher Schultz ch...@christopherschultz.net
To: Tomcat Users List users@tomcat.apache.org 
Sent: Monday, 13 May 2013 9:47 PM

Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
 


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Chirag,

On 5/13/13 11:34 AM, Chirag Dewan wrote:

I am embedding  Apache Tomcat 7.0.30 in my application. I am using
the Tomcat class,and my application requires dynamic addition and
removal of connectors(HTTP).

Now while removing the connectors,the application gets undeployed
but the port remains occupied and the connector continue to listen
on the port. I am using customized HTTP connector.


Here is a snippet from my source code:

for removing connector:

if( connector != null ) { connector.decUsage(); if(
connector.getUsage() == 0 ) { connector.stop(); 
this.tomcat.getService().removeConnector( connector ); } }


for adding connector:

this.tomcat.getService().addConnector( connector );


I know the port is not getting free. Because when I try to deploy
to the same port again,it gives me an address already in use
exception. I have surfed for this issue a lot,but to no avail. Any
help would be greatly appreciated.


Can you take a thread dump and find which code look like it's doing
connection-related things?

How do you observe that the connector is still bound to the port?
netstat? What does it show? What happens if you make a request?

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k
iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u
x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L
XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL
XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP
qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G
fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k
2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw
2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0
mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD
0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc
Ev3xtRom84ly50SQcxKf
=zDpF
-END PGP SIGNATURE-

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



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



Async Context not timing out

2013-05-13 Thread Rahul Kumar
Hi All,

I need some help with the async context timeout in servlet 3.0 running on
tomcat 7.0.40.

I have set the asynccontext timeout value, but the timeout behaviour is
highly inconsistent. Sometimes the timeouts work, but most of the times
they don't. I am attaching the source code and the output in plain text
format.

I have tried this on Tomcat 7.0.20, 7.0.37, 7.0.40. Nothing seems to
help. Am i doing something wrong?

Please help. Apologize if I am wasting your time! But I need to fix it.

Thanks for your help!

-Rahul

-- 
*Meet AdIQuity at:*
*Ad:Tech, Singapore *on 13th-14th June 2013

*The information contained in this communication is intended solely for the 
use of the individual or entity to whom it is addressed and others 
authorized to receive it. This communication may contain confidential or 
legally privileged information. If you are not the intended recipient, any 
disclosure, copying, distribution or action taken relying on the contents 
is prohibited and may be unlawful. If you have received this communication 
in error, or if you or your employer does not consent to email messages of 
this kind, please notify to sender immediately by responding to this email 
and then delete it from your system. No liability is accepted for any harm 
that may be caused to your systems or data by this message.*
@WebServlet(name = TestServlet, urlPatterns = {/test},asyncSupported = true)
public class TestServlet extends HttpServlet{

private static final long serialVersionUID = 1L;

private static PriorityBlockingQueueRunnable pq = new 
PriorityBlockingQueueRunnable(1000);

private static ThreadPoolExecutor threadPoolExecutor = new 
ThreadPoolExecutor(1,1,10, TimeUnit.SECONDS,pq);

public void service(final ServletRequest servletRequest, final 
ServletResponse response)
throws ServletException, IOException {
TestListener listener = new TestListener();
final AsyncContext asyncContext = 
servletRequest.startAsync(servletRequest, response);
asyncContext.addListener(listener);
asyncContext.setTimeout(100);
Handler handler = new Handler(asyncContext);
threadPoolExecutor.execute(handler);
}
}

### Handler class###


public class Handler implements Runnable {

private AsyncContext asyncContext;

public Handler(AsyncContext asyncContext){
this.asyncContext = asyncContext;
}
public void run(){
try {
long currtime = System.currentTimeMillis();
Thread.sleep(500);
System.out.println(slept for  + (System.currentTimeMillis() - 
currtime));
} catch (InterruptedException e) {
System.out.println(Error in thread );
}

try{
if(asyncContext != null){
System.out.println(Completing async context  +  timeout is  
+ asyncContext.getTimeout());
asyncContext.complete();
}
}catch (Exception e){
System.out.println(Exception in completing async context );
}
}
}

 Listener class 

public class TestListener implements AsyncListener {
public void onComplete(AsyncEvent event) throws IOException {
System.out.println(Event completed);
}

public void onError(AsyncEvent event) throws IOException {
event.getAsyncContext().complete();
}

public void onStartAsync(AsyncEvent event) throws IOException {
// TODO Auto-generated method stub
}



public void onTimeout(AsyncEvent event){
System.out.println(Timeout );
event.getAsyncContext().complete();
}
}


Execution 

[ops@root combinedlogs]$ time curl http://localhost:9001/mockresponse/test;

real0m0.506s
user0m0.001s
sys 0m0.003s
[ops@root combinedlogs]$ time curl http://localhost:9001/mockresponse/test;

real0m0.159s
user0m0.001s
sys 0m0.003s


Catalina logs

slept for 500
Completing async context  timeout is 100
Event completed

Timeout 
Event completed
slept for 500
Exception in completing async context
-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

RE: Internal Servlet Error

2013-05-13 Thread Propes, Barry L
Yeah, it's clear from what's typed below his DB driver is way out of whack with 
this ancient version of Tomcat.

It probably got updated along the way by network sorts while the Tomcat version 
stayed put.

Go to current, and with current Tomcat, also get a current JDK - I imagine the 
one you have is ancient as well.

 

-Original Message-
From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
Sent: Monday, May 13, 2013 11:16 AM
To: Tomcat Users List
Subject: Re: Internal Servlet Error

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Jeny,

On 5/13/13 2:52 AM, Jeny V wrote:
 I'm having some real issues , running programs in Tomcat on my 
 machine.
 
 I just copied a jakarta folder named jakarta-tomcat-3.3.1a on to my 
 D: drive (Path : D:\Program Files\jakarta-tomcat-3.3.1a) .

I'm going to go ahead and echo the few responses you're already gotten so far 
and tell you that you really need to discard that version of Tomcat. I don't 
care if you have an application that works on it (obviously in some other 
environment) and are afraid to upgrade. That version is so old, we don't even 
have the documentation online anymore for how many unfixed security 
vulnerabilities may or may not be present in that version.

The Java Servlet Specification is nominally backward-compatible, so you should 
be able to download the latest version of Tomcat, configure it properly, and 
run your webapp without too many problems.

 I can run simple jsp programs with no database connection. But 
 whenever I try to execute programs with database connections, 
 following error encounters:
 
 Error: 500
 
 
 Internal Servlet Error:
 
 javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] The 
 specified DSN contains an architecture mismatch between the Driver and 
 Application at [...]

The error is obvious from this message, but if you don't recognize the 
important words (architecture mismatch) then you could be lost.

The problem is that you are using a 32-bit ODBC driver on a 64-bit JVM (or 
maybe a 64-bit ODBC driver on a 32-bit JVM: you didn't specify what kind of JVM 
you were using, though I suspect you have a 64-bit JVM and a hideously old 
driver that you've been lugging-around with your Tomcat 3 install). You need to 
take one of the following actions:

1. Install a 32-bit JVM and use that. This will solve the architecture mismatch 
by switching the JVM. This may have an impact on your webapp (mostly a smaller 
maximum heap size) so you may not want to do this.

2. Install a 32-bit version of your ODBC driver and use that. This will solve 
the architecture mismatch by switching the driver. You may not be able to find 
a compatible 64-bit driver so you may not be able to do this.

3. Discard your ODBC driver entirely and use a pure-Java JDBC driver.
Pretty much every database has one of these things available one way or 
another. This avoids the architecture mismatch entirely and it will likely 
result in better performance and stability of your web application. I highly 
recommend that you take this course of action.

What database are you using?

 Please do reply or help me with this problem as I tried so many times 
 to fix the problem by trying various solutions.

In the future, it would be best to let everyone know what solutions you have 
tried and what the results were (other than just it didn't work).

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRkRG6AAoJEBzwKT+lPKRYaaoQAJyFeYHGRmZomqFan7W2jdHv
u7TZwFKlLAfkMfJaQQibprnuLZpW4flC5gdM0Rbj14EtfDauEMCSfe++oo6YlvqQ
F0Mih9ReRt7wSxVLNG58hUqcM6Hg3evEtwWoq9yd5I9YHYdl8Cz0X035/tdUHOUz
2RKBqQbFKr3A8m1k6Q6IYjsRKvPFDwyu0ekRYMrvSdtFZkiYPvzzwW1FpXdQ0Rwh
mHmVPrZzoIjiVXLWzT+kfFfrdrK6yBopieYZvOufEei88ZRvaI6u5LrXEpN6GEhX
DNkFoDWjPYXuKdQS+JBdwFX16DIKl7nIqI5nZ2sZthjPVqK64+r26R5tp+WEX5rp
ADkKyb6iGnwpAxy6l4LBGdanpDug0hC2beeOUtmcQkujJoychlvvF5L69VGpeEU1
JSQR0bQJGJIF9rP/PyAjBLzAUSI9sqh8IUZ+Bm+JrpAgiAWNSmKzeCW2te5r/GcF
Nt5ZpKBqMC2UHPNMRxKjIfuGc0gTApX467tVQ5zaouNbWO/lSOMrhZCgF8SD/OcF
fiQGrfeCDirHKIR6sczu3r07fGShTNCA47svAFV3/K31ou5dZT6SM3IvVqo2ZXog
whHWIXLxGl9SZrJToAJYcjlR2nRSb/yKygiE9Z2csgt34fUj9vQmWFo93ueph+j1
p8A0RhUfe4Kx6KzJ5lmP
=LZlk
-END PGP SIGNATURE-

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


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



Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Chirag Dewan
 If the context was removed, but the Connector was still there, should you not 
 get a 404 
Not Found, rather than a timeout ?


If I am calling the removeConnector,shouldn't it cleanup the context and the 
free the port?
I mean is my context blocking the connector even after I removed it? i should 
get a 404. Yes.



Sorry I forget to mention,it worked fine with Tomcat 6 Embedded version. I am 
trying to upgrade it to Tomcat 7.0.30 and I am following the same process as in 
Tomcat 6.

Thanks




 From: André Warnier a...@ice-sa.com
To: Tomcat Users List users@tomcat.apache.org 
Sent: Monday, 13 May 2013 10:13 PM
Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
 

Chirag Dewan wrote:
 How do you observe that the connector is still bound to the port?
 
 Yes. I used netstat to observe that. Plus when I try to add another context 
 to the same port,I get Address already in use exception.
 
 What does it show? 
 
 I can see my java process running on that port.
 
 What happens if you make a request?
 
  As I said,I am sure that the deployed context is removed. I get a timeout on 
a request.

If the context was removed, but the Connector was still there, should you not 
get a 404 
Not Found, rather than a timeout ?

 
 When I start my Tomcat Server(tomcat.start()),I understand it adds a default 
 connector to the service on port 8080,so after adding my connector on port 
 1090,i can see my java process listening on port 1090 and 8080.
 
 I really dont understand what wrong I might be doing.
 
 
 Thanks
 
 
 
 
 
 
 
 
  From: Christopher Schultz ch...@christopherschultz.net
 To: Tomcat Users List users@tomcat.apache.org 
 Sent: Monday, 13 May 2013 9:47 PM
 Subject: Re: Port still busy after removing connector in Embedded Tomcat 
 7.0.30
  
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256
 
 Chirag,
 
 On 5/13/13 11:34 AM, Chirag Dewan wrote:
 I am embedding  Apache Tomcat 7.0.30 in my application. I am using
 the Tomcat class,and my application requires dynamic addition and
 removal of connectors(HTTP).

 Now while removing the connectors,the application gets undeployed
 but the port remains occupied and the connector continue to listen
 on the port. I am using customized HTTP connector.


 Here is a snippet from my source code:

 for removing connector:

 if( connector != null ) { connector.decUsage(); if(
 connector.getUsage() == 0 ) { connector.stop(); 
 this.tomcat.getService().removeConnector( connector ); } }

 for adding connector:

 this.tomcat.getService().addConnector( connector );


 I know the port is not getting free. Because when I try to deploy
 to the same port again,it gives me an address already in use
 exception. I have surfed for this issue a lot,but to no avail. Any
 help would be greatly appreciated.
 
 Can you take a thread dump and find which code look like it's doing
 connection-related things?
 
 How do you observe that the connector is still bound to the port?
 netstat? What does it show? What happens if you make a request?
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
 
 iQIcBAEBCAAGBQJRkRIbAAoJEBzwKT+lPKRYH4kP/2WiZK75ifzqSXojAw1ckw6k
 iH5NvnWNNFeibFvqtj0tN2Nun+mb3atqs4ySwQahN/FAtz8klhdfGLTlccMxzh4u
 x1yvMKLEh1Xr3qTxeot/y98zER/gubdgNsM4lr5MkkFVtaprK7/emz1OCwcuZe0L
 XApJRuSNF+GxtH9lSKEw4Tn4kzc5Asv2gMQOQmLAmBi3fKI9MsoRS9V5TPU88dhL
 XBk+rkcUdvL2KWKbP9yrt2Geu9NqBzqADCA4FJUESS9sm8A/VECzyUZ+4uW/jqiP
 qpn4GSAtpaH9CyHzynZF5qyA8Fx+BllhyIFwZfUl5DMqk+t4gw3LdPay8Rkpfg7G
 fdLHXrLez/Pcj2nvOp60OLeC4DD13AJON9KyYXmnUuk29aV/lrOes9nmUbIVDh8k
 2LXh9cYErtD55bCgmTLPT0bLBpC9v1aUGEjFzeLjfJX9hEkvpUrN5OWvKHYg5Vaw
 2qc+bV31qitjrUfZYU58S5UX1txATx6Ig76y/pt49XfiQFc6/GG25Ju5UCJOpat0
 mOV4qTck+Exy+YuGvME7V/IcLAbymm9vGIB4bQD9dLq36Kx0cL5lE/DOYANd2PJD
 0nBO/co4uRvKW54NDnHVzzpAU7IUXBoQ+SmU4IQMv1+TP6auHO8ekwDW7+59ZgCc
 Ev3xtRom84ly50SQcxKf
 =zDpF
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


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

Delayed WAR expansion, timeout on context startup?

2013-05-13 Thread Stefan Mayr

Hi,

we've upgraded our linux systems and experience some serious slowdowns 
from our antivirus solutions. Expanding large WAR files (e.g. Alfresco) 
is blocked by the virus scanner for minutes (!). Now we get tomcats 
failing to deploy contexts on startup. Everything was fine when the 
deployment/WAR expansion is/was faster (av off or just older linux 
plattform).
Are there any parameters to adjust deployment timeouts for these 
contexts with large WAR files?


I know we need to get the av scanner fixed. But at the moment we just 
need a temporary workaround for the longer expansions times.


Thanks,

  Stefan

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



RE: Delayed WAR expansion, timeout on context startup?

2013-05-13 Thread Caldarale, Charles R
 From: Stefan Mayr [mailto:ste...@mayr-stefan.de] 
 Subject: Delayed WAR expansion, timeout on context startup?

 Are there any parameters to adjust deployment timeouts for these 
 contexts with large WAR files?

Want to give us a hint about what Tomcat version, JVM level, and platform 
you're running on?  It's rather difficult to answer _any_ question without the 
basics.

In the meantime, look here:

http://wiki.apache.org/tomcat/HowTo/FasterStartUp


 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: Async Context not timing out

2013-05-13 Thread Mark Thomas
On 13/05/2013 18:01, Rahul Kumar wrote:
 Hi All,
 
 I need some help with the async context timeout in servlet 3.0 running
 on tomcat 7.0.40. 
 
 I have set the asynccontext timeout value, but the timeout behaviour is
 highly inconsistent. Sometimes the timeouts work, but most of the times
 they don't. I am attaching the source code and the output in plain text
 format.
 
 I have tried this on Tomcat 7.0.20, 7.0.37, 7.0.40. Nothing seems to help. Am 
 i doing something wrong?

Yes and no. You are making assumptions about how frequently timeouts are
checked. Tomcat only checks them every second for APR/native and BIO.
NIO always checks every second by default and may check more frequently
when under low load.

Mark

 
 Please help. Apologize if I am wasting your time! But I need to fix it. 
 
 Thanks for your help!
 
 -Rahul
 
 /Meet AdIQuity at:/
 *Ad:Tech, Singapore *on 13th-14th June 2013
 
 /The information contained in this communication is intended solely for
 the use of the individual or entity to whom it is addressed and others
 authorized to receive it. This communication may contain confidential or
 legally privileged information. If you are not the intended recipient,
 any disclosure, copying, distribution or action taken relying on the
 contents is prohibited and may be unlawful. If you have received this
 communication in error, or if you or your employer does not consent to
 email messages of this kind, please notify to sender immediately by
 responding to this email and then delete it from your system. No
 liability is accepted for any harm that may be caused to your systems or
 data by this message./
 
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


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



Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Chirag,

On 5/13/13 1:03 PM, Chirag Dewan wrote:
 If the context was removed, but the Connector was still there, 
 should you not get a 404 Not Found, rather than a timeout ?
 
 
 If I am calling the removeConnector, shouldn't it cleanup the
 context and the free the port?

In theory, yes, but ...

How long are you waiting? Can you give us the specifics of your
connector configuration? I wonder if the connector is remaining open
for something like a keepalive timeout (I don't know if it *should*
stay open for a keepalive timeout, but it seems plausible).

 I mean is my context blocking the connector even after I removed
 it? i should get a 404. Yes.

But you aren't getting a 404: you are getting a request timeout which
seems a bit odd. Perhaps the connector is partially shut-down, but not
completely.

How about that stack trace?

 Sorry I forget to mention,it worked fine with Tomcat 6 Embedded 
 version. I am trying to upgrade it to Tomcat 7.0.30 and I am 
 following the same process as in Tomcat 6.

Tomcat 7 is different than Tomcat 6... did you read the embedded
documentation to see if anything changed? In general, connector states
should be the same, but changing major versions is likely to require
you to change your embedded code somewhat.

Tomcat's unit tests (available in the source distribution of Tomcat)
extensively use embedded techniques and are a good source of
information for how to properly use Tomcat in an embedded way.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRkVPqAAoJEBzwKT+lPKRY8UEQALqicEQax+K9xYGb3XdzvOgE
a5emxV6fHog9ZSUqHVDnxtSIaxOQ3uUjHiwmc2gtTAnn5NiTN3IES+3YkHLnI6Vl
La0fdpNOshuqhz37DAAY9/nPI4fgWOwAMBuAHCrl53BerbHTGaKHUwF0e42/otIa
jWxQlVTXD2V06WyuoF9CJupKbcENGrTS7dsDegqmRzbbrGjLHc1Ot/l+AK8uEdjw
cjWcI9Od9BkLKMkD+C0aHfT8s5fdUWr3f62K13T8uBrmNbghvK1NKsntpA84VqSy
EUuNUcIbJglgLGz+XOc2UlTKZs01y2tRIwoPZQiv3ap15lf1El5KuB3b+NMzj4UT
al9fK2sITcQW/6AAdoafChpttW65OvM6kwl3nTZBhOimkW/hw8Qrf7rFh1uUvpY7
Q7rhiCYiyEtVaBPKxPkY4D3272F4OHviZev1ltYyfHHHgFs1+DricOmEhVDF/hd2
6W6FRaxNpdSbS4U2bW9JziISb+5hKH+GyJkSJRJGHagQOXwfNRm89PhKA2mfE3XP
Ihtv7eIRBiw6jCWvCYbeXFW5Fvx75AtU1xMlFs2c5HLsryV1h4PCZRtvf/LXYs5G
Nl/osLQius4IpHkEdc88CVByYtRlEB8PereQZe/zKXSZt61ahYGQjDf4rDhAt1qa
y2eqzNhJ97OrYMz+KPW/
=feVR
-END PGP SIGNATURE-

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



RE: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Caldarale, Charles R
 From: Christopher Schultz [mailto:ch...@christopherschultz.net] 
 Subject: Re: Port still busy after removing connector in Embedded Tomcat 
 7.0.30

  If I am calling the removeConnector, shouldn't it cleanup the
  context and the free the port?

 In theory, yes, but ...

 How long are you waiting? Can you give us the specifics of your
 connector configuration? I wonder if the connector is remaining open
 for something like a keepalive timeout (I don't know if it *should*
 stay open for a keepalive timeout, but it seems plausible).

It would be interesting to see the actual netstat report here; I wonder if the 
socket is in a FIN_WAIT or CLOSE_WAIT state.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Mark Thomas
On 13/05/2013 16:34, Chirag Dewan wrote:
 Hi,
 
 I am embedding  Apache Tomcat 7.0.30 in my application. I am using the Tomcat 
 class,and my application requires dynamic addition and removal of 
 connectors(HTTP).
 
 Now while removing the connectors,the application gets undeployed but the 
 port remains occupied and the connector continue to listen on the port. I am 
 using customized HTTP connector.
 
 
   Here is a snippet from my source code:
 
 for removing connector:
 
 if( connector != null )
 {
 connector.decUsage();
 if( connector.getUsage() == 0 )
 {
 connector.stop();
 this.tomcat.getService().removeConnector( connector );
 }
 }
 
 for adding connector:
 
 this.tomcat.getService().addConnector( connector );
 
 
 I know the port is not getting free. Because when I try to deploy to the same 
 port again,it gives me an address already in use exception.
 I have surfed for this issue a lot,but to no avail. Any help would be greatly 
 appreciated.

You need to destroy the connector to close the port.

Mark


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



RE: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Caldarale, Charles R
 From: Caldarale, Charles R 
 Subject: RE: Port still busy after removing connector in Embedded Tomcat 
 7.0.30

  How long are you waiting? Can you give us the specifics of your
  connector configuration? I wonder if the connector is remaining open
  for something like a keepalive timeout (I don't know if it *should*
  stay open for a keepalive timeout, but it seems plausible).

 It would be interesting to see the actual netstat report here; I wonder 
 if the socket is in a FIN_WAIT or CLOSE_WAIT state.

But that probably shouldn't happen for a ServerSocket.

Does forcing a GC fix the problem?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


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



Re: Port still busy after removing connector in Embedded Tomcat 7.0.30

2013-05-13 Thread Chirag Dewan


 You need to destroy the connector to close the port.

Mark,

That seems to work. :)

Now the port is free. But is it the right approach? Is this something we need 
to do in Tomcat 7 specifically? 


Thanks.



 From: Mark Thomas ma...@apache.org
To: Tomcat Users List users@tomcat.apache.org 
Sent: Tuesday, 14 May 2013 2:41 AM
Subject: Re: Port still busy after removing connector in Embedded Tomcat 7.0.30
 

On 13/05/2013 16:34, Chirag Dewan wrote:
 Hi,
 
 I am embedding  Apache Tomcat 7.0.30 in my application. I am using the Tomcat 
 class,and my application requires dynamic addition and removal of 
 connectors(HTTP).
 
 Now while removing the connectors,the application gets undeployed but the 
 port remains occupied and the connector continue to listen on the port. I am 
 using customized HTTP connector.
 
 
   Here is a snippet from my source code:
 
 for removing connector:
 
 if( connector != null )
         {
             connector.decUsage();
             if( connector.getUsage() == 0 )
             {
                 connector.stop();
                 this.tomcat.getService().removeConnector( connector );
             }
         }
 
 for adding connector:
 
 this.tomcat.getService().addConnector( connector );
 
 
 I know the port is not getting free. Because when I try to deploy to the same 
 port again,it gives me an address already in use exception.
 I have surfed for this issue a lot,but to no avail. Any help would be greatly 
 appreciated.

You need to destroy the connector to close the port.

Mark


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

TomCat Request Processing

2013-05-13 Thread yogesh hingmire
I am curious to know how Tomcat's connectors handle the request processing
internally, especially between the Http11Protocol which i believe acts as a
connector and with every connector there may be a request processor which
is the Http11Processor.

I think there is a pool of Http11Processor classes created by the
connector, was wondering how the interaction between Http11Protocol  and
Http11Processor flows when a request comes in at the connector.

Thank You