Re: is the Tomcat-7 WsRemoteEndpointImplBase send methods threadsafe, or should we be synchronizing until the Future.get() returns?

2013-10-22 Thread Mark Thomas
On 22/10/2013 00:28, Bob DeRemer wrote:
 I'm trying to understand how Tomcat's outbound message processing
 works with respect to making multiple (concurrent) calls against a
 single RemoteEndpoint.Async using sendText/sendObject.  Based on the
 ExecutionExceptions we got (see below), it seems that we should
 probably synchronize sends until the Future.get() returns, but I
 want to check with the community to be sure.  I tried searching the
 javadocs of RemoteEndpoint.Async and associated interfaces, but could
 not find anything describing the threadsafe nature (existing or not).
 It appears that the spec lets the implementation determine how to
 handle stuff under the covers.  This is fine, but we just need to
 understand what that means to multi-threaded code that wants to send
 messages.

There was some discussion [1] in the EG on this point and the conclusion
was that the previous message had to complete before the next message
was sent. If you batching is used (which Tomcat supports) the semantics
for complete change but the previous message still has to complete
before the next is sent.

I've looked through the specification and I don't see this made clear
anywhere. My experience of the J2EE EG's is that in cases like these
following the intention of the EG based on the mailing list archive is
the way to go.

 Looking at the Tomcat code, it looks like WsRemoteEndpointImplBase
 uses a static SendHandler (i.e. TextMessageSendHandler).

That is a static definition of a class, not a static instance. A new
instance is created for each message.

 I noticed a
 little further down in the stack the logic does synchronize around a
 messagePartQueue, but this seems to be for handling parts of a single
 message.

Correct. That is to ensure correct state management when different
threads are sending different parts of the message.

 Otherwise, it looks like it doesn't expect another message
 to be sent until it's finished writing out.

Correct. It should throw an exception if you try.

 ExecutionException: In some recent testing of our client/server
 Endpoint(s) (using a locally built instance of Tomcat 7.0.48), we got
 ExecutionExceptions when sending messages concurrently without any
 delay.  The errors started with a few Null Ptr(s), then were all
 wsRemoteEndpoint.inProgress (Message will not be sent because the
 WebSocket session is currently sending another message)
 
 Is my understanding correct, or am I missing something?  Thanks in
 advance for any clarification.

HTH,

Mark

[1]
https://java.net/projects/websocket-spec/lists/jsr356-experts/archive/2013-02/message/1

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



Reg: Connection pool statistics

2013-10-22 Thread Anu Prab
Hi,

Is it possible to get the statistics of a connection pool programmatically,
say when was it created? The maximum time taken by a query which used the
connection from this connection pool? Statistics like these...

-Anu


RE: is the Tomcat-7 WsRemoteEndpointImplBase send methods threadsafe, or should we be synchronizing until the Future.get() returns?

2013-10-22 Thread Bob DeRemer


 -Original Message-
 From: Niki Dokovski [mailto:nick...@gmail.com]
 Sent: Tuesday, October 22, 2013 1:11 AM
 To: Tomcat Users List
 Subject: Re: is the Tomcat-7 WsRemoteEndpointImplBase send methods
 threadsafe, or should we be synchronizing until the Future.get() returns?
 
 On Tue, Oct 22, 2013 at 3:29 AM, David Bullock 
 david.bull...@machaira.com.au wrote:
 
  Hi Bob,
 
   I tried searching the javadocs of RemoteEndpoint.Async and
   associated
  interfaces, but could not find anything describing the threadsafe
  nature (existing or not).  It appears that the spec lets the
  implementation determine how to handle stuff under the covers.  This
  is fine, but we just need to understand what that means to
  multi-threaded code that wants to send messages.
 
 
 JSR 356 Specification Section 5.1 Threading Consideration discusses the topic.
 In particular;
 [WSC-5.1-2] - the implementation must not invoke an endpoint instance with
 more than one thread per peer at a time.
 [WSC-5.1-4] - a websocket endpoint instance is never called by more than one
 container thread at a time per peer.
 
 cheers
 

Thank you, Niki, for the spec clarification
bob

 
 
  I'd have thought that where an interface doesn't declare that it is
  threadsafe, one cannot assume that it will be.  Further, if a
  RemoteEndpoint represents 'the peer of a web socket conversation',
  then a RemoteEndpoint, like a conversation, can surely support only a
  single 'conversation state'?
 
  IMHO, the correct choice is for each thread to have its own
  RemoteEndpoint.  If the protocol being used happens to multiplex
  multiple conversations to/from different endpoints over the same
  TCP/UDP socket (for example), then the plumbing will do the
  appropriate synchronization at that point - there would be no
  advantage (and possibly some big disadvantages) for you to do your own
  synchronization.  Critically, a RemoteEndpoint does not necessarily
  represent a 'heavyweight' object like a Socket, and you should not be
  at pains to manage your own pool of them, nor necessarily (unless it
  made sense for application logic) to have a queue of messages which is
  dispatched from a single thread.
 
  However, I do think that many JSR's which ought to know better are
  very lame about thread-safety guarantees for application authors, and
  that more needs to be said in API documentation about patterns for
  concurrent usage.  I encourage you to lobby your particular JSR of use
  to include this information in future releases of the specification.
  I did my bit recently at https://java.net/jira/browse/SERVLET_SPEC-81
 
  cheers,
  David Bullock
 
  -
  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



Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread ANALIA DE PEDRO SANTAMARIA
Hello,

I would like to know if is it possible to restrict the use of JDK classes
in Tomcat according to a list given in another file. ¿Is it possible by
creating a new Add-on? If it is possible, where can I find documentation
about creating Add-ons? I have looked up and I haven't found any
information about it (I only have found AddOns in Tomcat 3.3 but there is
nothing about creating new ones).

Another idea to do that is by modifying the source code. Could anybody tell
me where I should search to do that?

Thank you very much.

Analía de Pedro


Re: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread Aurélien Terrestris
You can run Tomcat with its Security Manager, then you can setup which
jar has which rights

have a look here :

http://tomcat.apache.org/tomcat-7.0-doc/security-manager-howto.html

2013/10/22 ANALIA DE PEDRO SANTAMARIA 100074...@alumnos.uc3m.es:
 Hello,

 I would like to know if is it possible to restrict the use of JDK classes
 in Tomcat according to a list given in another file. ¿Is it possible by
 creating a new Add-on? If it is possible, where can I find documentation
 about creating Add-ons? I have looked up and I haven't found any
 information about it (I only have found AddOns in Tomcat 3.3 but there is
 nothing about creating new ones).

 Another idea to do that is by modifying the source code. Could anybody tell
 me where I should search to do that?

 Thank you very much.

 Analía de Pedro

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



Re: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread chris derham
 2013/10/22 ANALIA DE PEDRO SANTAMARIA 100074...@alumnos.uc3m.es:
 Hello,

 I would like to know if is it possible to restrict the use of JDK classes
 in Tomcat according to a list given in another file. ¿Is it possible by
 creating a new Add-on? If it is possible, where can I find documentation
 about creating Add-ons? I have looked up and I haven't found any
 information about it (I only have found AddOns in Tomcat 3.3 but there is
 nothing about creating new ones).

This sounds like a home work question. My spanish is bad, but alumnos
is surely student in spanish. Hence the OP has had the cheek to send
from the student account of his university. Do the mailing list rules
state home work questions are in or out of scope?

Chris

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



RE: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread Caldarale, Charles R
 From: cjder...@gmail.com [mailto:cjder...@gmail.com]
 On Behalf Of chris derham
 Subject: Re: Restrict the use of JDK classes Tomcat 7 or 6

 Do the mailing list rules state home work questions are in or out of scope?

To quote from How To Ask Questions The Smart Way 
(http://www.catb.org/~esr/faqs/smart-questions.html), which is linked to from 
the Tomcat mailing lists page:

Don't post homework questions

 - 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: Connection pool statistics

2013-10-22 Thread Jeffrey Janner
 -Original Message-
 From: Anu Prab [mailto:anupr...@gmail.com]
 Sent: Tuesday, October 22, 2013 4:36 AM
 To: Tomcat Users List
 Subject: Reg: Connection pool statistics
 
 Hi,
 
 Is it possible to get the statistics of a connection pool
 programmatically, say when was it created? The maximum time taken by a
 query which used the connection from this connection pool? Statistics
 like these...
 
 -Anu

Check the documentation and/or JavaDocs for the library you are using for the 
connection pool.  It is totally dependent on the software you've decided to use 
for creating/managing the pool.  For example, I'm pretty sure that there is a 
management class for Oracle's Universal Connection Pool (UCP).


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



Re: Connection pool statistics

2013-10-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Jeffrey,

On 10/22/13 9:47 AM, Jeffrey Janner wrote:
 -Original Message- From: Anu Prab
 [mailto:anupr...@gmail.com] Sent: Tuesday, October 22, 2013 4:36
 AM To: Tomcat Users List Subject: Reg: Connection pool
 statistics
 
 Hi,
 
 Is it possible to get the statistics of a connection pool 
 programmatically, say when was it created? The maximum time taken
 by a query which used the connection from this connection pool?
 Statistics like these...
 
 -Anu
 
 Check the documentation and/or JavaDocs for the library you are
 using for the connection pool.  It is totally dependent on the
 software you've decided to use for creating/managing the pool.  For
 example, I'm pretty sure that there is a management class for
 Oracle's Universal Connection Pool (UCP).

...or hook-up a JMX browser to Tomcat and see what you can find...

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

iQIcBAEBCAAGBQJSZpvVAAoJEBzwKT+lPKRYg/gP/j2cpAyOEDZ+eQc+yN9j4DhP
HZ9ro/0ZEa+SkzuvrfnPbmfq0vIo8OtoyZuAgmQ2GGeaYrwtsRBuqyoNBQHdV+VH
dMQC6ySb620Swf0L33Vnvszis2NCh5QIPft1Lyf/hJV/dQcl0n00Od8/ze1/+oHN
jJSwCcQOQjiuZZAqQgL+aU5hG6KkLe4r0+RtCYdhJ0CUWO0KiX0geceAM+8syeO0
G0xe8rbC+aRz13lAJwnrTd9nw8DFIxw4rhCmDMP37tAuJ0iydCfwC0Lplms3rJAE
qy4ZzUyqXv5huOQ0HGpMrJzEJgUaptZbDPmZ8ikjs2xLZPfkOSvThsQwFgC2Oowq
hXkWw3KESWFXrrljuBXVioyxl9e28404YW6Hc6zXSmRoJG8x3dbAH8GSIBL4UNJy
N9pafr4y3n/SlVFTvsc1Q9y3g6lm/Q0H/mhFCuUU2U38V1QwC8z6ukOF1gnVXAjs
+3RxEgz7gOprEq/1MH1Iey5p8nP6z5Ga76C3YUFlQcS5M67pGpAXOggxzVQ7hrdS
izB5llzZ+wTiu0NVEibHeAEBUkhyrlr1pe6UH9H0X1y4vK6Q7HkwJEP4mNcJU7s9
bAMnZ8LU1t/m8LbXmZUepnJ1TMnt1t8jCTNGDA/7Wulzm6hO9hr4FWw/8xY2tIuk
Hrf6Jt9mf37ff4dXSBk0
=Yb3Q
-END PGP SIGNATURE-

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



Re: Tomcat 6.x crashes on tcnative-1.dll

2013-10-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Teng,

On 10/22/13 3:02 AM, Teng Khoo wrote:
 I am running tomcat 6.0.30

More than 2 years out-of-date. Just sayin'.

 with tcnative-1.dll (1.1.27) on Windows 2008 (64bit). Tomcat
 crashes 1-2 times in a week. Below is the core dump. Does anyone
 have any idea?

tcnative 1.1.29 was just released which fixes a number of crashes
recently identified. Could you try upgrading to 1.1.29 to see if your
server stabalizes a bit?

 # # A fatal error has been detected by the Java Runtime
 Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc005) at
 pc=0x0001800057b2, pid=1704, tid=376 # # JRE version:
 6.0_27-b07 # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.2-b06
 mixed mode windows-amd64 compressed oops) # Problematic frame: # C
 [tcnative-1.dll+0x57b2] # # If you would like to submit a bug
 report, please visit: #
 http://java.sun.com/webapps/bugreport/crash.jsp # The crash
 happened outside the Java Virtual Machine in native code. # See
 problematic frame for where to report the bug. #

Is there anything more to the crash report? Usually there is a report
of which native function crashed (but maybe not available on win64
builds).

Can you tell us if you are using APR (probably yes). Are you using
OpenSSL via APR? Any other usage patterns you can let us know about?

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

iQIcBAEBCAAGBQJSZpzQAAoJEBzwKT+lPKRY/nsP/RVnRK4hj0X2f6n9x6Spj3TM
SNmodbRFdBXrlbKornD4rxClpyA1eX60kDni9qeToIPH44fXAOA0O1I+4zGSgCGk
bzgyUCU08YNp8hAEd+zZ9SzXkeQzzr1DZlqsBJ4RmxsWs3Ed8F0tnCOzfK2V68dF
R0/5BOPiSMErEyFzximcxquH2AwosVKJPvkW5Cd94YW/6B8ZRcrsrj3gsaPDQuPl
7Zb6/ai4GPE4f+3rUIFlE2B8y4NWZnPISdGH3U6CVsaj0dMoBX+KKJ7l7yfixriQ
/SysOQFlAJWiG/Oucn/Nb4yUOjTvWuGyqnTeTwa4+RqoDpPwSF40k+VQQwyDsbO1
x8vDOoZEuf8PY7ssGBeGQCtC/QWCbL3Z7q9luD7qiTtuLrQH7Zq8Ci3CsJ32cNNq
xNkn5laTkMGHHNGH59RApHPbBbDNO+jJC3fmk0pMHKJvzUoH7SOudHPpaLz1gOAR
5ogAdcjkceYHEcF6BPffMrMzSz1VEz0elhrRiHz8LFR2EuDxwUut2QdlYJ9VmrD3
Cg4A/y69irf10RuoU0k4BT68VexqWiyTZ/kb00Fs8heXw2VEx4PgW3eHcUqvm9XL
bqtWiC2wZq8R40U9To2L4OAnbGgznXDgTJ2EWt62zoOWrGTHsTyU7CTBiF1pat2W
zh/mwhz2/KRHzvtdlP79
=94Cw
-END PGP SIGNATURE-

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



Re: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread André Warnier

Caldarale, Charles R wrote:

From: cjder...@gmail.com [mailto:cjder...@gmail.com]
On Behalf Of chris derham
Subject: Re: Restrict the use of JDK classes Tomcat 7 or 6



Do the mailing list rules state home work questions are in or out of scope?


To quote from How To Ask Questions The Smart Way 
(http://www.catb.org/~esr/faqs/smart-questions.html), which is linked to from the Tomcat 
mailing lists page:

Don't post homework questions



Now come on guys.  UCM3 is the Universidad Carlos III of Madrid, Spain.
So we have an OP here who attends a Spanish university, is learning Java, has a genuine 
Spanish name, yet phrases questions correctly and politely in English, on a forum which 
the OP found and which is at least related to the subject.
You do not have to solve her homework.  But a bit of slack, a pointer or two from real 
Java experts ?
And the fact that I am currently in Valencia, a mere 3 hours from Madrid, has absolutely 
nothing to do with any of this.



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



Re: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread ANALIA DE PEDRO SANTAMARIA
I'm sorry about the misunderstanding. My question isn't a homework
question. I'm working in my Final Project and I have some doubts about
Tomcat, that I need to solve in order to develop it properly. I had
searched a lot before I wrote to the mailing list. I'm sorry if you have
understood that I'm a lazy person who wants you to solve my work.

However, my work is related to the university (the reason why I have wrote
with my student account), so I understand it if you can't answer my
questions.

Thank you.


2013/10/22 André Warnier a...@ice-sa.com

 Caldarale, Charles R wrote:

 From: cjder...@gmail.com [mailto:cjder...@gmail.com]
 On Behalf Of chris derham
 Subject: Re: Restrict the use of JDK classes Tomcat 7 or 6


  Do the mailing list rules state home work questions are in or out of
 scope?


 To quote from How To Ask Questions The Smart Way (
 http://www.catb.org/~esr/**faqs/smart-questions.htmlhttp://www.catb.org/~esr/faqs/smart-questions.html),
 which is linked to from the Tomcat mailing lists page:

 Don't post homework questions


  Now come on guys.  UCM3 is the Universidad Carlos III of Madrid, Spain.
 So we have an OP here who attends a Spanish university, is learning Java,
 has a genuine Spanish name, yet phrases questions correctly and politely in
 English, on a forum which the OP found and which is at least related to the
 subject.
 You do not have to solve her homework.  But a bit of slack, a pointer or
 two from real Java experts ?
 And the fact that I am currently in Valencia, a mere 3 hours from Madrid,
 has absolutely nothing to do with any of this.



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




RE: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread Caldarale, Charles R
 From: ANALIA DE PEDRO SANTAMARIA [mailto:100074...@alumnos.uc3m.es] 
 Subject: Re: Restrict the use of JDK classes Tomcat 7 or 6

 I understand it if you can't answer my questions.

Your question was already answered by Aurélien: use a SecurityManager.

http://tomcat.apache.org/tomcat-7.0-doc/security-manager-howto.html

 - 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: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread Isuru Perera
Hi,


On Tue, Oct 22, 2013 at 11:11 PM, ANALIA DE PEDRO SANTAMARIA 
100074...@alumnos.uc3m.es wrote:

 I'm sorry about the misunderstanding. My question isn't a homework
 question. I'm working in my Final Project and I have some doubts about
 Tomcat, that I need to solve in order to develop it properly. I had
 searched a lot before I wrote to the mailing list. I'm sorry if you have
 understood that I'm a lazy person who wants you to solve my work.

I think it's okay to ask questions on the mailing lists and you already got
an answer in less than 15 mins! :)


 However, my work is related to the university (the reason why I have wrote
 with my student account), so I understand it if you can't answer my
 questions.

 Thank you.


 2013/10/22 André Warnier a...@ice-sa.com

  Caldarale, Charles R wrote:
 
  From: cjder...@gmail.com [mailto:cjder...@gmail.com]
  On Behalf Of chris derham
  Subject: Re: Restrict the use of JDK classes Tomcat 7 or 6
 
 
   Do the mailing list rules state home work questions are in or out of
  scope?
 
 
  To quote from How To Ask Questions The Smart Way (
  http://www.catb.org/~esr/**faqs/smart-questions.html
 http://www.catb.org/~esr/faqs/smart-questions.html),
  which is linked to from the Tomcat mailing lists page:
 
  Don't post homework questions
 
 
   Now come on guys.  UCM3 is the Universidad Carlos III of Madrid, Spain.
  So we have an OP here who attends a Spanish university, is learning Java,
  has a genuine Spanish name, yet phrases questions correctly and politely
 in
  English, on a forum which the OP found and which is at least related to
 the
  subject.
  You do not have to solve her homework.  But a bit of slack, a pointer or
  two from real Java experts ?
  And the fact that I am currently in Valencia, a mere 3 hours from Madrid,
  has absolutely nothing to do with any of this.
 
 
 
  --**--**-
  To unsubscribe, e-mail: users-unsubscribe@tomcat.**apache.org
 users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 




-- 
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha


RE: Connection pool statistics

2013-10-22 Thread Jeffrey Janner
Chris --

 -Original Message-
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Sent: Tuesday, October 22, 2013 10:38 AM
 To: Tomcat Users List
 Subject: Re: Connection pool statistics
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256
 
 Jeffrey,
 
 On 10/22/13 9:47 AM, Jeffrey Janner wrote:
  -Original Message- From: Anu Prab
 [mailto:anupr...@gmail.com]
  Sent: Tuesday, October 22, 2013 4:36 AM To: Tomcat Users List
  Subject: Reg: Connection pool statistics
 
  Hi,
 
  Is it possible to get the statistics of a connection pool
  programmatically, say when was it created? The maximum time taken by
  a query which used the connection from this connection pool?
  Statistics like these...
 
  -Anu
 
  Check the documentation and/or JavaDocs for the library you are using
  for the connection pool.  It is totally dependent on the software
  you've decided to use for creating/managing the pool.  For example,
  I'm pretty sure that there is a management class for Oracle's
  Universal Connection Pool (UCP).
 
 ...or hook-up a JMX browser to Tomcat and see what you can find...
 
 - -chris

Yes, but the OP asked specifically for a way to do it programmatically, so I 
didn't think he was look for the standard Use jconsole or jvisualvm answer.  
And even if you can find out what is advertised, you'll still need to look 
into the docs to determine what those values mean in a lot of cases.
Jeff


Embedding Tomcat

2013-10-22 Thread Pïd stèr
Hello,

To scratch an itch I've been working on an alternative means to embed
Tomcat:

 https://github.com/pidster-dot-org/embed-apache-tomcat

There's a core utility for embedding Tomcat[1] and a JUnit Rule[2] for
testing that uses it, e.g.

1.
https://github.com/pidster-dot-org/embed-apache-tomcat/blob/master/embed-apache-tomcat-core/src/test/java/org/pidster/tomcat/embed/TomcatSimpleTest.java

2.
https://github.com/pidster-dot-org/embed-apache-tomcat/blob/master/embed-apache-tomcat-test/src/test/java/org/pidster/tomcat/embed/junit/TomcatServerRuleTest.java

I've snuck it into Maven Central here:

 http://search.maven.org/#search%7Cga%7C1%7Corg.pidster

I'd be interested to hear feedback from the list.


p


Re: Restrict the use of JDK classes Tomcat 7 or 6

2013-10-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Analia,

On 10/22/13 1:41 PM, ANALIA DE PEDRO SANTAMARIA wrote:
 I'm sorry about the misunderstanding. My question isn't a homework 
 question. I'm working in my Final Project and I have some doubts
 about Tomcat, that I need to solve in order to develop it
 properly.

Perhaps I didn't understand the original question: what are you trying
to avoid? Do you want to prevent a web application from loading a
different version of java.lang.String, or are you trying to protect
something else?

I think the initial resistance to answering your original question was
because it was so open-ended. Perhaps if you add some more details
(e.g. what is happening, why it is unexpected, what you want to happen
instead) we might be able to help.

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

iQIcBAEBCAAGBQJSZwFxAAoJEBzwKT+lPKRYeFYP/2/k5A3OB8CbbHHivXh/HvR5
KQUvE8Ez9dqACKSnTs94k0lYY7x+1EwVtUuyi5huTfh7Yo3vV54qOCpLzdmGDGSP
NZABnifDcjSB5HxdiadNoAN36cSsE08Poc7sh3m9Mg752mfDRaYtLS4JSWydhXGC
MI/Th2Hc4/1jJo418hm7YH6RiWvUX8EKWG/e4UE0HhHzN1V9Q2kq2j1TQ7ixBFgN
MJBGHFWOewTEd+9/iPkycF5hkPR7by7RjJBWx3eY3IXD+RTmt/7cn4gRxZoQtUa+
+/nPMGdDNfX+LN5zd/qQo7qjJv7TVdnhJVyh2FwWbZYt6fJowj9xaApAvT2qFLCb
ZJ+UrD2zhDao5J3blM/KsEklWdk72ShpiIBjBM9PC5og/obGTEfzOfbm5NSpw+8p
s//UKZ+xOyqmiKTKN5rXxBByPDJiR0ZWHIxBbkFwX20jzpFm3acu4m11dva8F9Zh
vRZ62JSRVrFckRS+286FU6TMPp2WBk3sjbMsI3EFpYtiAvg+TehPjEUkOmuz5dxR
J77s6vfFus4salL2OcFNNZ9SQsHEgCmqJhXwMS0OQdV2XWRuQMrEI5ruiSYnzQT2
CNmihUVeEiDJKk1g4umwhU8Gq5dq/QHk3vv/C1bq8uQ/Y3e5BnGOy+C8zeusltji
ip2Ps0GVfiViTLavhPQ+
=Vv6G
-END PGP SIGNATURE-

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



Re: Connection pool statistics

2013-10-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Jeffrey,

On 10/22/13 5:40 PM, Jeffrey Janner wrote:
 Chris --
 
 -Original Message- From: Christopher Schultz
 [mailto:ch...@christopherschultz.net] Sent: Tuesday, October 22,
 2013 10:38 AM To: Tomcat Users List Subject: Re: Connection pool
 statistics
 
 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
 
 Jeffrey,
 
 On 10/22/13 9:47 AM, Jeffrey Janner wrote:
 -Original Message- From: Anu Prab
 [mailto:anupr...@gmail.com]
 Sent: Tuesday, October 22, 2013 4:36 AM To: Tomcat Users
 List Subject: Reg: Connection pool statistics
 
 Hi,
 
 Is it possible to get the statistics of a connection pool 
 programmatically, say when was it created? The maximum time
 taken by a query which used the connection from this
 connection pool? Statistics like these...
 
 -Anu
 
 Check the documentation and/or JavaDocs for the library you are
 using for the connection pool.  It is totally dependent on the
 software you've decided to use for creating/managing the pool.
 For example, I'm pretty sure that there is a management class
 for Oracle's Universal Connection Pool (UCP).
 
 ...or hook-up a JMX browser to Tomcat and see what you can
 find...
 
 - -chris
 
 Yes, but the OP asked specifically for a way to do it 
 programmatically, so I didn't think he was look for the standard 
 Use jconsole or jvisualvm answer.  And even if you can find out 
 what is advertised, you'll still need to look into the docs to 
 determine what those values mean in a lot of cases.

Well, if you know the JMX bean (by using JVisualVM to find it, for
instance), you can certainly grab a hold of the bean at runtime and
query it all you want programmatically. ;)

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

iQIcBAEBCAAGBQJSZwGzAAoJEBzwKT+lPKRYNXEP/37ztfW5eRu5dvKs2U6BPtC4
TxeRV30X7zrK6ypPGjqMy+JvPSJXsSgD8x1tjkoKVHgKvDqxCE2jDwBqfJUpIiA7
7b5oruUrCijhpOuSN4zHsLFIlt9K1V2a7sc77t9NcFXmdLKbgIBMgI3O3Gzdwb7v
Y56TxI2IuI1vB80FcEefSJG1N7SJj3iLfrgV41lVoJECprVUJnXN4BRrFa+q40/E
8vMYJ64Mspr3tHSBfySksCcNzn4YQ9WlIRSE0O5KoaUahKtJRqkwBf746PmWgChM
m0BzEeexKZHI4+B8plXVi+jRouhVxhHSUf75Wg2LCGDEHJIvYEYuq4Axi2QgcOIb
jjnEqiy5dMJ8oYvKKUXgVRDLWrHzyBVQkdBc8mJwMxPdmxbH6U9KSL/9gjFOzuA1
NIYoguBeujQmol4sG0tTesK/BBfj7vGzYX40dFhumw/85HPHqfBdNGEMae8xLsSy
kXVM2hPIaYd5DRY4KkXVJeVo4sS8CMn0dnqz4XsnQ07FOLJqNaaqs9/qrjdNexrT
COk6obTBGGUE4DXNUZ/gAHdWgKZgAydB2UlCi2YsY+zbnZotAqJjG9+8RX9MZesi
n2dgctl5NtGPqPrOqU8xVxIVtCnlI0he5EOCw4oCXInsRgKwlOLbGjBEFI1aO6mf
EIxqbKc60Vns/AKvEQeq
=0yuR
-END PGP SIGNATURE-

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



Servlet init method called multiple times

2013-10-22 Thread Richard Pierce
The init()  method of all of my servlets is being called every 10 seconds or 
so. I verified this by adding a System.out to the init() methods of my 
servlets. However, the server is not restarting- just init gets recalled, even 
with no load on the box at all. I have no idea where to begin debugging this, 
but it does appear to be affecting performance.

The API states The servlet container calls the init method exactly once after 
instantiating the servlet.

I added an instance and static variable to the servlet, to see whether the init 
method was being called multiple times on the same instance or if new instances 
were being created.

Initialized: 1 times (local), 28 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:36 EDT 2013
Initialized: 1 times (local), 29 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:41 EDT 2013
Initialized: 1 times (local), 30 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:46 EDT 2013
Initialized: 1 times (local), 31 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:51 EDT 2013

Obviously it is happening every 5 seconds, but WHAT is happening?


Tomcat version: Apache Tomcat/6.0.35
OS: Linux version 2.6.18-194.11.3.el5


Richard Pierce | Software Architect
Empowered Benefits
rpie...@empoweredbenefits.commailto:rpie...@empoweredbenefits.com


Re: Servlet init method called multiple times

2013-10-22 Thread André Warnier

Richard Pierce wrote:

The init()  method of all of my servlets is being called every 10 seconds or 
so. I verified this by adding a System.out to the init() methods of my 
servlets. However, the server is not restarting- just init gets recalled, even 
with no load on the box at all. I have no idea where to begin debugging this, 
but it does appear to be affecting performance.

The API states The servlet container calls the init method exactly once after 
instantiating the servlet.

I added an instance and static variable to the servlet, to see whether the init 
method was being called multiple times on the same instance or if new instances 
were being created.

Initialized: 1 times (local), 28 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:36 EDT 2013
Initialized: 1 times (local), 29 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:41 EDT 2013
Initialized: 1 times (local), 30 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:46 EDT 2013
Initialized: 1 times (local), 31 total (static);   Thead=http-127.0.0.1-51443-1 
 Time: Tue Oct 22 18:40:51 EDT 2013

Obviously it is happening every 5 seconds, but WHAT is happening?


Tomcat version: Apache Tomcat/6.0.35
OS: Linux version 2.6.18-194.11.3.el5


Hi.
1) anything noteworthy mentioned in the Tomcat logs ?
2) can you paste your conf/server.xml here ? (confidential info removed)




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



Re: Servlet init method called multiple times

2013-10-22 Thread Richard Pierce

Hey Andre, thanks for any help you can provide. Nothing in the tomcat
logs, just server startup spam and then the log lines from the init methods


server.xml:

?xml version='1.0' encoding='utf-8'?
Server port=8006 shutdown=SHUTDOWN

  !--APR library loader. Documentation at /docs/apr.html --
  Listener className=org.apache.catalina.core.AprLifecycleListener
SSLEngine=on /
  !--Initialize Jasper prior to webapps are loaded. Documentation at
/docs/jasper-howto.html --
  Listener className=org.apache.catalina.core.JasperListener /
  !-- Prevent memory leaks due to use of particular java/javax APIs--
  Listener 
className=org.apache.catalina.core.JreMemoryLeakPreventionListener /
  !-- JMX Support for the Tomcat server. Documentation at
/docs/non-existent.html --
  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener
/
  Listener 
className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener /

  GlobalNamingResources
Resource name=UserDatabase auth=Container
type=org.apache.catalina.UserDatabase description=User database that
can be updated and saved
factory=org.apache.catalina.users.MemoryUserDatabaseFactory
pathname=conf/tomcat-users.xml /
  /GlobalNamingResources

  Service name=Catalina

Connector port=8082 maxHttpHeaderSize=8192 maxThreads=1500
minSpareThreads=25 maxSpareThreads=75 minProcessors=5
maxProcessors=200 enableLookups=false redirectPort=8443
acceptCount=100 connectionTimeout=3000 disableUploadTimeout=true
server=Apache address=127.0.01 /

!-- Define an AJP 1.3 Connector on port 8009 --
Connector port=8009 enableLookups=false protocol=AJP/1.3
redirectPort=8443 address=127.0.01/

Engine name=Catalina defaultHost=localhost jvmRoute=web04_EB

  Realm className=org.apache.catalina.realm.UserDatabaseRealm
resourceName=UserDatabase/

  Host name=localhost  appBase=webapps unpackWARs=true
autoDeploy=true xmlValidation=false xmlNamespaceAware=false

  /Host
/Engine
  /Service
/Server







On 10/22/13 7:42 PM, André Warnier a...@ice-sa.com wrote:

Hi.
1) anything noteworthy mentioned in the Tomcat logs ?
2) can you paste your conf/server.xml here ? (confidential info removed)



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



java.net.SocketException: Permission denied: connect, when running Tomcat 7 as a windows service

2013-10-22 Thread Rodolfo Piedrabuena
Hi there,

I'm receiving the following exception:

java.net.SocketException: Permission denied: connect

when instantiating a Socket from a servlet:

final Socket smtpSocket = new Socket(mailTransportHost, mailTransportPort);

This application was running as a service under Windows Server 3003 R2
32-bits. After migrating it to Windows Server 2008 R2 64-bit, I cannot
longer establish connection with the smtp server.

This only happen when running Tomcat as a service.
Running as a standalone (starting it up using startup.bat) works fine. No
exception instantiating Socket, emails are sent.

Environment:

   - Windows Server 2008 R2 64-bit
   - Tomcat 7.0.39
   - jdk1.6.0_33-x64

Any help would be much appreciated


Re: Multi-URL Access 1 Webapp

2013-10-22 Thread Chris Arnold
I didn't know you were running a 3rd-party application. Do you need
the application to behave differently given a particular client? If
not, there's nothing to do. If so, you probably need to ask the
Alfresco folks how to do that. I personally know nothing about
Alfresco, though there may be some folks on the list who do and might
reply here.

I need to revisit this issue. Here is my apache vhost:
VirtualHost *:80
ServerName share.*

#This rewrites https://share.anydomain.tld to our alfresco server
RewriteCond %{HTTP_HOST} ^share\.
RewriteCond %{HTTPS} on
RewriteRule ^/(.*) http://192.168.123.3:8080/share/$1 [P]
RedirectMatch ^/$ /share/

/VirtualHost

This lands on the the apache part not the tomact part (both apache and tomcat 
are the same server). We need http://share.*.* to land on the tomcat web app. 
Any advise?

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



RE: Multi-URL Access 1 Webapp

2013-10-22 Thread Matt Barry
Hi Chris,

I didn't know you were running a 3rd-party application. Do you need
the application to behave differently given a particular client? If
not, there's nothing to do. If so, you probably need to ask the
Alfresco folks how to do that. I personally know nothing about
Alfresco, though there may be some folks on the list who do and might
reply here.

I need to revisit this issue. Here is my apache vhost:
VirtualHost *:80
ServerName share.*

You probably want to be using ServerAlias here, iirc..

#This rewrites https://share.anydomain.tld to our alfresco server
RewriteCond %{HTTP_HOST} ^share\.
RewriteCond %{HTTPS} on

Okay, I'll take a bite at the obvious.  Your vhost is running on *:80, and your 
mod_rewrite condition only triggers for https; is your httpd actually serving 
https on port 80?

RewriteRule ^/(.*) http://192.168.123.3:8080/share/$1 [P]
RedirectMatch ^/$ /share/

I sort of doubt that this combination of rewrites and redirects is going to do 
what you want.  If the RedirectMatch fires (I'm not positive it would), it 
would send a 302 to /share/, which would then get proxied to /share/share/ on 
your app server.  (This is the type of setup I typically find mod_proxy much 
easier to work with vs mod_redirect, but this is all OT for this list..)

Cheers,
Matt
The contents of this message and any attachments to it are confidential and may 
be legally privileged.
If you have received this message in error you should delete it from your 
system immediately and advise the sender.
dunnhumby may monitor and record all emails. The views expressed in this email 
are those of the sender and not those of dunnhumby.


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