Java Mailing List Archive

http://www.junlu.com/

Home » users-digest.tomcat »

users Digest 18 Mar 2013 16:29:47 -0000 Issue 11301

users-digest-help

2013-03-18


Author LoginPost Reply

users Digest 18 Mar 2013 16:29:47 -0000 Issue 11301

Topics (messages 240475 through 240504)

Re: mail/Session resources lookup fail
 240475 by: Konstantin Kolinko

Re: AJP suddenly Stopps acting: ajp on 7009 and 9009 : connections keept open
 240476 by: David Kumar
 240477 by: David Kumar
 240478 by: Felix Schumacher
 240486 by: David Kumar
 240497 by: Christopher Schultz

help on websockets
 240479 by: Muralidhar Yaragalla
 240480 by: Mark Thomas
 240481 by: Muralidhar Yaragalla

Getting HttpSession from HandshakeRequest/Configurator
 240482 by: Nick Williams
 240483 by: Martin Gainty
 240484 by: Nick Williams
 240485 by: Nick Williams
 240490 by: Mark Thomas

Embedded Tomcat on free port
 240487 by: Jan Ehrhardt
 240488 by: Mark Thomas

Re: Deadlock when using jetty 8 JDBCSessionManager and Tomcat 7 JDBC Connector
 240489 by: Mark Thomas

Re: SSL Best Practices
 240491 by: Jeffrey Janner

Re: Procrun and Tomcat service/OS shutdown on Windows
 240492 by: Thomas, Steve
 240503 by: Jeffrey Janner

Starting tomcat7w from batch file
 240493 by: David kerber
 240494 by: André Warnier
 240495 by: David kerber
 240496 by: André Warnier
 240498 by: Christopher Schultz
 240499 by: David kerber
 240500 by: Harris, Jeffrey E.
 240501 by: André Warnier
 240502 by: Harris, Jeffrey E.
 240504 by: David kerber

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: users@(protected)
To unsubscribe, e-mail: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-digest-help@(protected)

----------------------------------------------------------------------


Attachment: users_240475.eml (zipped)
2013/3/15 Lau, Alex <alex.lau@(protected)>:
> I have a typical mail resource set up but my lookup always returns localhost as the smtp host.
>
> My webapp contect.xml looks like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <context>
> <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="smtp.mydomain.com" mail.debug="true"></Resource>
> </context>
>
> My webapp web.xml has an entry like this:
>
> <resource-ref>
>   <description>Resource reference to a factory for javax.mail.Session instances that may be used for sending electronic mail messages, preconfigured to connect to the appropriate SMTP server.</description>
>   <res-ref-name>mail/Session</res-ref-name>
>   <res-type>javax.mail.Session</res-type>
>   <res-auth>Container</res-auth>
>  </resource-ref>
>
> My webapp code
>
> Context initCtx = new InitialContext();
> Context envCtx = (Context) initCtx.lookup("java:comp/env");
> javax.mail.Session msession = (javax.mail.Session) envCtx.lookup("mail/Session");
> System.out.println("msession to string is " + msession.getProperty("mail.smtp.host"));
>
> For some reasons, this work on my Eclipse/Tomcat set up but when I deploy everything to another server, the getProperty always return localhost as the smtp host. I search for all Tomcat log files but could not find anything.
>

1. Tomcat versions = ?

2. The docs say  "4. Install the JavaMail libraries". Did you do it?
http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JavaMail_Sessions

3. Are you sure that you have packed the correct context.xml in your WAR?
How do you deploy your application to other server?

4. If you are able to debug it, a place to place a breakpoint is
org.apache.naming.factory.MailSessionFactory class
https://wiki.apache.org/tomcat/FAQ/Developing#Debugging

Best regards,
Konstantin Kolinko


Attachment: users_240476.eml (zipped)
Hey Rainer,


>It got stripped by the list. Can you post it somewhere and make the URL
available?

here you go:


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)



Attachment: users_240477.eml (zipped)
Hey Rainer,

>It got stripped by the list. Can you post it somewhere and make the URL
>available?


here you go:

http://www.telestar.de/tmp10356/threaddump.txt

thanks


David



Attachment: users_240478.eml (zipped)
Hi David,
Am 17.03.2013 16:17, schrieb David Kumar:
> Hey Rainer,
>
>> It got stripped by the list. Can you post it somewhere and make the URL
>> available?
>
> here you go:
>
> http://www.telestar.de/tmp10356/threaddump.txt
almost all of your threads are waiting to get a database connection out
of the pool. There are three possible scenarios, where this might happen.

1. You are abandoning db connections and thus are draining the pool
(most likely in my eyes)
2. The pool is too small (unlikely, since no work seems to be done other
than waiting for new connections)
3. Lock contention while going through borrowObject (unlikely, since no
thread is doing a validation)

So I would configure 'logAbandoned="true"' and even
'removeAbandoned="true"' and 'removeAbandonedTimeout="60"' as stated on
http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html.

When your pool is getting drained, you will see a message in your log
files, where you have taken connections out of the pool, but haven used
them for a while. Than you can start to look for places, where those
connections might have leaked.

Regards
Felix
>
> thanks
>
>
> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>



Attachment: users_240486.eml (zipped)
Hi Felix,


>1. You are abandoning db connections and thus are draining the pool
> (most likely in my eyes)
>2. The pool is too small (unlikely, since no work seems to be done other
>than waiting for new connections)
>3. Lock contention while going through borrowObject (unlikely, since no
>thread is doing a validation)
>
>So I would configure 'logAbandoned="true"' and even
>'removeAbandoned="true"' and 'removeAbandonedTimeout="60"' as stated on
>http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples->howto.html.

>When your pool is getting drained, you will see a message in your log
>files, where you have taken connections out of the pool, but haven used
>them for a while. Than you can start to look for places, where those
>connections might have leaked.

thanks for that hint, I will have a look at all of my databasepools..
Hopefully you're right and that is our problem..


thanks


avid


Attachment: users_240497.eml (zipped)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

David,

On 3/18/13 2:07 AM, David Kumar wrote:
>> 1. You are abandoning db connections and thus are draining the
>> pool (most likely in my eyes) 2. The pool is too small (unlikely,
>> since no work seems to be done other than waiting for new
>> connections) 3. Lock contention while going through borrowObject
>> (unlikely, since no thread is doing a validation)
>>
>> So I would configure 'logAbandoned="true"' and even
>> 'removeAbandoned="true"' and 'removeAbandonedTimeout="60"' as
>> stated on
>> http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples->howto.html.
>
>> When your pool is getting drained, you will see a message in
>> your log files, where you have taken connections out of the pool,
>> but haven used them for a while. Than you can start to look for
>> places, where those connections might have leaked.
>
> thanks for that hint, I will have a look at all of my
> databasepools.. Hopefully you're right and that is our problem..

Recommended reading:
http://blog.christopherschultz.net/index.php/2009/03/16/properly-handling-pooled-jdbc-connections/

- -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/

iEYEAREIAAYFAlFHMhEACgkQ9CaO5/Lv0PAgVwCfUoMRvSSqqrti566y/YipPTm8
b2QAoLIa3huGEVhwXEj+BnVdWAcrxUL7
=NhLI
-----END PGP SIGNATURE-----


Attachment: users_240479.eml (zipped)
Hi I have downloaded the tomcat 7.0.37 and trying to run the websocket chat
program which is with "javax.wesocket" annotations but the annotations are
not being recognized. how to run this on tomcat.

--
Thanks And Regards,
*Muralidhar Yaragalla.
*

Attachment: users_240480.eml (zipped)
On 17/03/2013 20:17, Muralidhar Yaragalla wrote:
> Hi I have downloaded the tomcat 7.0.37 and trying to run the websocket chat
> program which is with "javax.wesocket" annotations but the annotations are
> not being recognized. how to run this on tomcat.

Tomcat 7.0.x does not (yet) implement JSR-356.

Tomcat's JSR-356 implementation is a work-in-progress on trunk (i.e.
Tomcat 8.0.x). Once the JSR-356 implementation is complete, the
non-JSR-356 WebSocket implementation in Tomcat 7 will be deprecated and
the JSR-356 implementation ported from trunk to replace it.

Mark


Attachment: users_240481.eml (zipped)
Thank you. Without implementing jsr why would they show examples in tomcat7
online docs. It is so much confusing. Thanks anyway.


On Mon, Mar 18, 2013 at 2:00 AM, Mark Thomas <markt@(protected):

> On 17/03/2013 20:17, Muralidhar Yaragalla wrote:
> > Hi I have downloaded the tomcat 7.0.37 and trying to run the websocket
> chat
> > program which is with "javax.wesocket" annotations but the annotations
> are
> > not being recognized. how to run this on tomcat.
>
> Tomcat 7.0.x does not (yet) implement JSR-356.
>
> Tomcat's JSR-356 implementation is a work-in-progress on trunk (i.e.
> Tomcat 8.0.x). Once the JSR-356 implementation is complete, the
> non-JSR-356 WebSocket implementation in Tomcat 7 will be deprecated and
> the JSR-356 implementation ported from trunk to replace it.
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>


--
Thanks And Regards,
*Muralidhar Yaragalla.
*

Attachment: users_240482.eml (zipped)
Based on my reading of the WebSocket spec mailing lists and API documentation, if I want to get the HttpSession that exists when a WebSocket connection is negotiated I need to extend ServerEndpointConfig.Configurator, override #modifyHandshake(), and call #getHttpSession() on the HandshakeRequest. However, I need a little clarification, because I'm not seeing how this is going to work:

1) Tomcat doesn't implement HandshakeRequest ... anywhere. So I'm not even seeing how that method could ever be called with a non-null argument. (Admittedly, I haven't run this yet ... I'm sending this preemptively while I complete my code, to go ahead and get some feedback).

2) None of the arguments to #modifyHandshake() provide access to the Session. So how am I supposed to do anything with it? How can I associate the HttpSession with the Session?

Attachment: users_240483.eml (zipped)
Nick
if you dont mind Comet's implementation of WebSocket events to Servlet-3.0 POST and GET then checkout http://java.dzone.com/articles/tomcat-websockets-html5

I'll let you test drive to see if Ant 's WebSocketServlet fully supports all aspects of the WebSocket spechttp://en.wikipedia.org/wiki/WebSocket

Keep us apprised,
Happy Driving
Martin ______________________________________________ Place Long-winded disclaimer here

> From: nicholas@(protected)
> Subject: Getting HttpSession from HandshakeRequest/Configurator
> Date: Sun, 17 Mar 2013 17:56:23 -0500
> To: users@(protected)
>
> Based on my reading of the WebSocket spec mailing lists and API documentation, if I want to get the HttpSession that exists when a WebSocket connection is negotiated I need to extend ServerEndpointConfig.Configurator, override #modifyHandshake(), and call #getHttpSession() on the HandshakeRequest. However, I need a little clarification, because I'm not seeing how this is going to work:
>
> 1) Tomcat doesn't implement HandshakeRequest ... anywhere. So I'm not even seeing how that method could ever be called with a non-null argument. (Admittedly, I haven't run this yet ... I'm sending this preemptively while I complete my code, to go ahead and get some feedback).
>
> 2) None of the arguments to #modifyHandshake() provide access to the Session. So how am I supposed to do anything with it? How can I associate the HttpSession with the Session?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
           

Attachment: users_240484.eml (zipped)
Martin,

Don't believe we've spoken before. Good to meet you.

I'm working on a book on Servlet 3.1 + WebSockets + Spring Framework 4 + Hibernate + Spring Security. My interest is purely the new Java WebSockets API. The existing Comet implementation in Tomcat 7.0 will be deprecated in 7.0 once the official API is complete and ported, and it will not be present in Tomcat 8.0.

Thanks, though, for replying.

Nick

On Mar 17, 2013, at 7:18 PM, Martin Gainty wrote:

> Nick
> if you dont mind Comet's implementation of WebSocket events to Servlet-3.0 POST and GET then checkout http://java.dzone.com/articles/tomcat-websockets-html5
>
> I'll let you test drive to see if Ant 's WebSocketServlet fully supports all aspects of the WebSocket spechttp://en.wikipedia.org/wiki/WebSocket
>
> Keep us apprised,
> Happy Driving
> Martin ______________________________________________ Place Long-winded disclaimer here
>
>> From: nicholas@(protected)
>> Subject: Getting HttpSession from HandshakeRequest/Configurator
>> Date: Sun, 17 Mar 2013 17:56:23 -0500
>> To: users@(protected)
>>
>> Based on my reading of the WebSocket spec mailing lists and API documentation, if I want to get the HttpSession that exists when a WebSocket connection is negotiated I need to extend ServerEndpointConfig.Configurator, override #modifyHandshake(), and call #getHttpSession() on the HandshakeRequest. However, I need a little clarification, because I'm not seeing how this is going to work:
>>
>> 1) Tomcat doesn't implement HandshakeRequest ... anywhere. So I'm not even seeing how that method could ever be called with a non-null argument. (Admittedly, I haven't run this yet ... I'm sending this preemptively while I complete my code, to go ahead and get some feedback).
>>
>> 2) None of the arguments to #modifyHandshake() provide access to the Session. So how am I supposed to do anything with it? How can I associate the HttpSession with the Session?
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@(protected)
>> For additional commands, e-mail: users-help@(protected)
>>
>            



Attachment: users_240485.eml (zipped)

On Mar 17, 2013, at 5:56 PM, Nick Williams wrote:

> Based on my reading of the WebSocket spec mailing lists and API documentation, if I want to get the HttpSession that exists when a WebSocket connection is negotiated I need to extend ServerEndpointConfig.Configurator, override #modifyHandshake(), and call #getHttpSession() on the HandshakeRequest. However, I need a little clarification, because I'm not seeing how this is going to work:
>
> 1) Tomcat doesn't implement HandshakeRequest ... anywhere. So I'm not even seeing how that method could ever be called with a non-null argument. (Admittedly, I haven't run this yet ... I'm sending this preemptively while I complete my code, to go ahead and get some feedback).
>
> 2) None of the arguments to #modifyHandshake() provide access to the Session. So how am I supposed to do anything with it? How can I associate the HttpSession with the Session?

I answered my own questions:

1) That's because it didn't, and it wasn't ever calling modifyHandshake(). I created a bug and submitted a patch for this.

2) Apparently userProperties is the way to go. userProperties can be accessed from the EndpointConfig argument to #modifyHandshake() or from Session. I can store the HttpSession in there. Wish there were a less roundabout way of getting there...

Attachment: users_240490.eml (zipped)
On 18/03/2013 00:22, Nick Williams wrote:
> Martin,
>
> Don't believe we've spoken before. Good to meet you.
>
> I'm working on a book on Servlet 3.1 + WebSockets + Spring Framework
> 4 + Hibernate + Spring Security. My interest is purely the new Java
> WebSockets API. The existing Comet implementation in Tomcat 7.0 will
> be deprecated in 7.0 once the official API is complete and ported,
> and it will not be present in Tomcat 8.0.

The link Martin posted has no relation to the WebSocket implementation
in Tomcat 7.

If you build on top of Comet each WebSocket connection automatically
gets a lot of unwanted baggage (requests/responses) that potentially
hampers scalability. The Tomcat 7 implementation is built on top of
Tomcat's low-level I/O and is relatively baggage free.

In Tomcat 8 it is built on top of the Servlet 3.1 HTTP Upgrade but the
Servlet[Input|Output]Stream objects used are not the same ones you'd get
if you requested them from an HttpServlet[Request|Response]. Again, for
scalability, the Servlet[Input|Output]Stream implementations used by
HTTP upgrade are built on top of Tomcat's low-level I/O.

Mark


Attachment: users_240487.eml (zipped)
Hello,

I want to use Tomcat embedded to my application, but I do not want to set a
fixed port. Instead I want Tomcat to choose a free port itself. This works
of cause by setting the port to 0, but asking the Tomcat object for the
port, will return 0 instead of the currently chosen port. Is there any
working way to get the port, which has been chosen by network stack?

Regards
Jan Ehrhardt

Attachment: users_240488.eml (zipped)
On 18/03/2013 08:56, Jan Ehrhardt wrote:
> Hello,
>
> I want to use Tomcat embedded to my application, but I do not want to set a
> fixed port. Instead I want Tomcat to choose a free port itself. This works
> of cause by setting the port to 0, but asking the Tomcat object for the
> port, will return 0 instead of the currently chosen port. Is there any
> working way to get the port, which has been chosen by network stack?

Connector.getLocalPort()

Mark



Attachment: users_240489.eml (zipped)
On 15/03/2013 21:36, Colin Ingarfield wrote:

Short version:
Your upgrade to the latest Connector/J will have fixed this particular
problem.


Long version:

<snip/>

>>>> Found one Java-level deadlock: =============================

<snip>

Thread 1:

>>>> Here are the stack traces: Thread 12820: (state = BLOCKED) -
>>>> com.mysql.jdbc.ConnectionImpl.getCharacterSetMetadata() @bci=0,
>>>> line=2851 (Compiled frame) -
>>>> com.mysql.jdbc.Field.getStringFromBytes(int, int) @bci=37,
>>>> line=717 (Compiled frame) - com.mysql.jdbc.Field.getName() @bci=17,
>>>> line=631 (Interpreted frame) -
>>>> com.mysql.jdbc.ResultSetImpl.buildIndexMapping() @bci=78, line=752
>>>> (Compiled frame) -
>>>> com.mysql.jdbc.ResultSetImpl.findColumn(java.lang.String) @bci=12,
>>>> line=1110 (Interpreted frame) -
>>>> com.mysql.jdbc.ResultSetImpl.getString(java.lang.String) @bci=3,
>>>> line=5609 (Interpreted frame) -
>>>> org.eclipse.jetty.server.session.JDBCSessionManager$1.run()
>>>> @bci=111, line=844 (Interpreted frame) -

<snip/>

Thread 2:

>>>> Thread 890: (state = BLOCKED) -
>>>> com.mysql.jdbc.ResultSetImpl.realClose(boolean) @bci=0, line=7195
>>>> (Interpreted frame) - com.mysql.jdbc.ResultSetImpl.close() @bci=2,
>>>> line=909 (Interpreted frame) -
>>>> com.mysql.jdbc.StatementImpl.realClose(boolean, boolean) @bci=126,
>>>> line=2478 (Interpreted frame) -
>>>> com.mysql.jdbc.PreparedStatement.realClose(boolean, boolean)
>>>> @bci=71, line=3098 (Interpreted frame) -
>>>> com.mysql.jdbc.ConnectionImpl.closeAllOpenStatements() @bci=90,
>>>> line=1628 (Interpreted frame) -
>>>> com.mysql.jdbc.ConnectionImpl.realClose(boolean, boolean, boolean,
>>>> java.lang.Throwable) @bci=176, line=4388 (Interpreted frame) -
>>>> com.mysql.jdbc.ConnectionImpl.close() @bci=32, line=1601
>>>> (Interpreted frame) -
>>>> org.apache.tomcat.jdbc.pool.PooledConnection.disconnect(boolean)
>>>> @bci=47, line=330 (Interpreted frame) -

<snip/>

>>>> Once I dug up these stack traces I started to wonder if the mysql
>>>> driver was the problem (or contributing to the problem.) I was
>>>> using Connector/J version 5.1.19 when the deadlock occurred. I
>>>> found this bug: http://bugs.mysql.com/bug.php?id=61247 which
>>>> sounds a lot like what appears to have happened. I'm interested in
>>>> your thoughts on this.

The problem is related to two threads accessing the same connection.
Given the scenario - the pool spots a potentially abandoned connection
and tries to close it - I don't view this as unreasonable behaviour by
the pool since there are no other options available.

The problem is that Thread 1 (above) results in this call order:
ResultSetImpl.findColumn(java.lang.String) - Syncs on ResultSetImpl
...
ConnectionImpl.getCharacterSetMetadata()   - Syncs on ConnectionImpl

while Thread 2 results in this call order:
ConnectionImpl.close()        - Syncs on ConnectionImpl
...
ResultSetImpl.realClose(boolean) - Syncs on ResultSetImpl

Two threads obtaining the same locks in a different order will result in
a deadlock.

I'd view that as a bug in the JDBC driver since - to my mind - "thread
safe" includes "doesn't deadlock". However, I can see a counter argument
that goes along the lines of:
- The deadlock is triggered when the cleaner thread tries to close an
active connection
- The cleaner thread is closing abandoned connections
- The only cause of an abandoned connection is buggy client code
- Therefore the real root cause is buggy client code


>>>> In the meantime I have upgraded to latest Connector/J which
>>>> includes a fix for this bug. I was running the old driver for
>>>> months before this deadlock, though, so it will be difficult to
>>>> know if it fixes the issue or not.

A review of the Connector/J code indicates that this particular deadlock
has been fixed (all the syncs above now sync on a new connectionMutex
object). This a) fixes this particular deadlock and b) ensures that
external code that syncs on a Connection/ResultSet/whatever can't
interfere and trigger a deadlock.

<snip/>

> My database access code is built on Spring 3's JDBC APIs, so I do not
> do any explicit connection management in my code. Its Spring's job to
> get connections and release them, and I assume its JDBC APIs is
> well-tested. So I don't think my code is the problem here.

I agree but see the counter argument above. If the code accessing the
database is perfect it shouldn't need to worry about abandoned connections.

> The Jetty session manager is storing HTTP session data in the
> database, and it does acquire connections directly from the pool. I
> haven't dug through the Jetty source to see if they are doing anything
> questionable, tho I did email their user list about this issue.

I don't see anything that jumps out at me but there is the "Why does it
need to managed abandoned connections?" question.

Mark


Attachment: users_240491.eml (zipped)
> -----Original Message-----
> From: Jeffrey D. Fisher [mailto:jeff.fisher12237@(protected)]
> Sent: Friday, March 15, 2013 3:03 PM
> To: users@(protected)
> Subject: SSL Best Practices
>
> Gentlemen (Ladies):
>
>
>
> I am looking for a published "best practice" on editing the SERVER.XML
> configuration file to use SSL/HTTPS. The key are imported into the
> keystore.
>
>
>
> Any input is appreciated.
>
>
>
> Jeff Fisher
>
> Omaha, NE

I would start by reading the Tomcat Documentation on the subject.
It's pretty straightforward.
Jeff



Attachment: users_240492.eml (zipped)
-----Original Message-----
From: Christopher Schultz [mailto:chris@(protected)]
Sent: Friday, March 15, 2013 3:37 PM
To: Tomcat Users List
Subject: Re: Procrun and Tomcat service/OS shutdown on Windows

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Steve,

On 3/14/13 1:21 PM, Thomas, Steve wrote:
> Thanks, Jeffrey. That may be a possibility for the long-term.
> --Steve

Did you read Jeffrey's entire reply? He started by top-posting, but then wrote some much more informative comments at the end of his post.

- -chris
-----------------------------------------------

Chris -

Thanks for calling that out. That threw me off initially, but following the subsequent comments in the thread, I saw that he had more points to offer and will be checking into them.

Much appreciated,

Steve

This message is intended only for the named recipient. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action based on the contents of this information is strictly prohibited.


Attachment: users_240503.eml (zipped)
> -----Original Message-----
> From: Harris, Jeffrey E. [mailto:Jeffrey.Harris@(protected)]
> Sent: Thursday, March 14, 2013 11:52 AM
> To: Tomcat Users List
> Subject: RE: Procrun and Tomcat service/OS shutdown on Windows
>
> Edit the registry so Tomcat depends on the HSQLDB shutdown. This only
> works if HSQLDB is also started as a service.
>
> Edit the service entry in the registry (under
> HKEY_Local_Machine\system\currentcontrolset\services\<Tomcat Service
> Name>) so Tomcat depends on HSQLDB. This only works if HSQLDB is also
> started as a service. If HSQLDB is started some other way (i.e., by
> the Tomcat web app), you can try and install it as a service using the
> srvany utility (or possibly the sc utility).
>
> If you can configure Tomcat to be dependent on HSQLDB, this will also
> force HSQLDB to start before Tomcat.
>

I just wanted to post a word of warning on depending on this last "feature".
While Windows will start the HSQLDB server before the Tomcat server, it doesn't necessarily imply that the DB will be ready for service. As soon as the HSQLDB service reports "started", Windows will start the next service that's dependant on it. You will want to verify the behavior of your database before relying on this feature.
Spoken as one bitten by trying to do this with Oracle some years back. The Oracle DB will report started looong before the recovery process is complete and the DB is open for connections.
Jeff



Attachment: users_240493.eml (zipped)
Running TC 7.0.22 32-bit on windows server 2008 R2 Standard (64-bit).

I'm trying to start tomcat7w from a .cmd file to monitor the TC
services, and can't seem to find the correct way of formatting the
cmd-line parameters.

When I just copy the command line from the start menu shortcut, it tells
me I have a bad parameter. For example:

start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
7.0\bin\tomcat7w.exe" //MS//Small-55009

tells me "Invalid switch - "/".

Removing one of the leading slashes returns 'Invalid switch "/MS"'
I have tried it without the "start", and have tried removing one of the
leading slashes. I couldn't find anything in the TC online docs either.

What am I missing here?

D


Attachment: users_240494.eml (zipped)
David kerber wrote:
> Running TC 7.0.22 32-bit on windows server 2008 R2 Standard (64-bit).
>
> I'm trying to start tomcat7w from a .cmd file to monitor the TC
> services, and can't seem to find the correct way of formatting the
> cmd-line parameters.
>
> When I just copy the command line from the start menu shortcut, it tells
> me I have a bad parameter. For example:
>
> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
> 7.0\bin\tomcat7w.exe" //MS//Small-55009
>
> tells me "Invalid switch - "/".
>
> Removing one of the leading slashes returns 'Invalid switch "/MS"'
> I have tried it without the "start", and have tried removing one of the
> leading slashes. I couldn't find anything in the TC online docs either.
>
> What am I missing here?
>
Did you try :

start "C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\bin\tomcat7w.exe
//MS//Small-55009"

You might also try searching Google for "windows cmd quoting rules"

And are you sure that it is tomcat7w.exe that must be started, not tomcat7.exe ?



Attachment: users_240495.eml (zipped)
On 3/18/2013 11:08 AM, André Warnier wrote:
> David kerber wrote:
>> Running TC 7.0.22 32-bit on windows server 2008 R2 Standard (64-bit).
>>
>> I'm trying to start tomcat7w from a .cmd file to monitor the TC
>> services, and can't seem to find the correct way of formatting the
>> cmd-line parameters.
>>
>> When I just copy the command line from the start menu shortcut, it
>> tells me I have a bad parameter. For example:
>>
>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>> 7.0\bin\tomcat7w.exe" //MS//Small-55009
>>
>> tells me "Invalid switch - "/".
>>
>> Removing one of the leading slashes returns 'Invalid switch "/MS"'
>> I have tried it without the "start", and have tried removing one of
>> the leading slashes. I couldn't find anything in the TC online docs
>> either.
>>
>> What am I missing here?
>>
> Did you try :
>
> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
> 7.0\bin\tomcat7w.exe //MS//Small-55009"

Yes. That doesn't throw an error, but doesn't start the monitor either.

>
> You might also try searching Google for "windows cmd quoting rules"
>
> And are you sure that it is tomcat7w.exe that must be started, not
> tomcat7.exe ?

Yes, it's the service monitor I'm trying to start, not the tomcat server.


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>



Attachment: users_240496.eml (zipped)
David kerber wrote:
> On 3/18/2013 11:08 AM, André Warnier wrote:
>> David kerber wrote:
>>> Running TC 7.0.22 32-bit on windows server 2008 R2 Standard (64-bit).
>>>
>>> I'm trying to start tomcat7w from a .cmd file to monitor the TC
>>> services, and can't seem to find the correct way of formatting the
>>> cmd-line parameters.
>>>
>>> When I just copy the command line from the start menu shortcut, it
>>> tells me I have a bad parameter. For example:
>>>
>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>>> 7.0\bin\tomcat7w.exe" //MS//Small-55009
>>>
>>> tells me "Invalid switch - "/".
>>>
>>> Removing one of the leading slashes returns 'Invalid switch "/MS"'
>>> I have tried it without the "start", and have tried removing one of
>>> the leading slashes. I couldn't find anything in the TC online docs
>>> either.
>>>
>>> What am I missing here?
>>>
>> Did you try :
>>
>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>> 7.0\bin\tomcat7w.exe //MS//Small-55009"
>
> Yes. That doesn't throw an error, but doesn't start the monitor either.
>
>>
>> You might also try searching Google for "windows cmd quoting rules"
>>
>> And are you sure that it is tomcat7w.exe that must be started, not
>> tomcat7.exe ?
>
> Yes, it's the service monitor I'm trying to start, not the tomcat server.
>
Next guess then : the "monitor" tomcat7w.exe is not itself a Service, it is just an
application, no ?
Doesn't "start" refer to Services only ?



Attachment: users_240498.eml (zipped)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

André,

On 3/18/13 11:21 AM, André Warnier wrote:
> David kerber wrote:
>> On 3/18/2013 11:08 AM, André Warnier wrote:
>>> David kerber wrote:
>>>> Running TC 7.0.22 32-bit on windows server 2008 R2 Standard
>>>> (64-bit).
>>>>
>>>> I'm trying to start tomcat7w from a .cmd file to monitor the
>>>> TC services, and can't seem to find the correct way of
>>>> formatting the cmd-line parameters.
>>>>
>>>> When I just copy the command line from the start menu
>>>> shortcut, it tells me I have a bad parameter. For example:
>>>>
>>>> start "C:\Program Files (x86)\Apache Software
>>>> Foundation\Tomcat 7.0\bin\tomcat7w.exe" //MS//Small-55009
>>>>
>>>> tells me "Invalid switch - "/".
>>>>
>>>> Removing one of the leading slashes returns 'Invalid switch
>>>> "/MS"' I have tried it without the "start", and have tried
>>>> removing one of the leading slashes. I couldn't find anything
>>>> in the TC online docs either.
>>>>
>>>> What am I missing here?
>>>>
>>> Did you try :
>>>
>>> start "C:\Program Files (x86)\Apache Software
>>> Foundation\Tomcat 7.0\bin\tomcat7w.exe //MS//Small-55009"
>>
>> Yes. That doesn't throw an error, but doesn't start the monitor
>> either.
>>
>>>
>>> You might also try searching Google for "windows cmd quoting
>>> rules"
>>>
>>> And are you sure that it is tomcat7w.exe that must be started,
>>> not tomcat7.exe ?
>>
>> Yes, it's the service monitor I'm trying to start, not the tomcat
>> server.
>>
> Next guess then : the "monitor" tomcat7w.exe is not itself a
> Service, it is just an application, no ? Doesn't "start" refer to
> Services only ?

Nope, it's a kind of "do it" program that allows you to launch
programs with/without a terminal, minimized, etc.

- -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/

iEYEAREIAAYFAlFHMpwACgkQ9CaO5/Lv0PBYYwCbBUzF1a8Ye+suIUcHFAbm6G2E
E50AoLmUYgd64mfEZPkb9riWOqfrNAv7
=hVCK
-----END PGP SIGNATURE-----


Attachment: users_240499.eml (zipped)
On 3/18/2013 11:28 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> André,
>
> On 3/18/13 11:21 AM, André Warnier wrote:
>> David kerber wrote:
>>> On 3/18/2013 11:08 AM, André Warnier wrote:
>>>> David kerber wrote:
>>>>> Running TC 7.0.22 32-bit on windows server 2008 R2 Standard
>>>>> (64-bit).
>>>>>
>>>>> I'm trying to start tomcat7w from a .cmd file to monitor the
>>>>> TC services, and can't seem to find the correct way of
>>>>> formatting the cmd-line parameters.
>>>>>
>>>>> When I just copy the command line from the start menu
>>>>> shortcut, it tells me I have a bad parameter. For example:
>>>>>
>>>>> start "C:\Program Files (x86)\Apache Software
>>>>> Foundation\Tomcat 7.0\bin\tomcat7w.exe" //MS//Small-55009
>>>>>
>>>>> tells me "Invalid switch - "/".
>>>>>
>>>>> Removing one of the leading slashes returns 'Invalid switch
>>>>> "/MS"' I have tried it without the "start", and have tried
>>>>> removing one of the leading slashes. I couldn't find anything
>>>>> in the TC online docs either.
>>>>>
>>>>> What am I missing here?
>>>>>
>>>> Did you try :
>>>>
>>>> start "C:\Program Files (x86)\Apache Software
>>>> Foundation\Tomcat 7.0\bin\tomcat7w.exe //MS//Small-55009"
>>>
>>> Yes. That doesn't throw an error, but doesn't start the monitor
>>> either.
>>>
>>>>
>>>> You might also try searching Google for "windows cmd quoting
>>>> rules"
>>>>
>>>> And are you sure that it is tomcat7w.exe that must be started,
>>>> not tomcat7.exe ?
>>>
>>> Yes, it's the service monitor I'm trying to start, not the tomcat
>>> server.
>>>
>> Next guess then : the "monitor" tomcat7w.exe is not itself a
>> Service, it is just an application, no ? Doesn't "start" refer to
>> Services only ?
>
> Nope, it's a kind of "do it" program that allows you to launch
> programs with/without a terminal, minimized, etc.

Yeah, what he said. In this usage, "Start" tells a windows batch file
to start the specified program and continue on, rather than waiting for
it to finish, as it would if you started it with "call" or with just the
program name. I'm trying to have a single batch file start the various
tomcat7w instances for the TC services, rather than having to create a
shortcut for each one and copy it into the startup group.

You're thinking of the "net start..." command, which does start a service.

D


>
> - -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/
>
> iEYEAREIAAYFAlFHMpwACgkQ9CaO5/Lv0PBYYwCbBUzF1a8Ye+suIUcHFAbm6G2E
> E50AoLmUYgd64mfEZPkb9riWOqfrNAv7
> =hVCK
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>



Attachment: users_240500.eml (zipped)


> -----Original Message-----
> From: David kerber [mailto:dckerber@(protected)]
> Sent: Monday, March 18, 2013 11:33 AM
> To: Tomcat Users List
> Subject: Re: Starting tomcat7w from batch file
>
> >>>>> tells me I have a bad parameter. For example:
> >>>>>
> >>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
> >>>>> 7.0\bin\tomcat7w.exe" //MS//Small-55009
> >>>>>
> >>>>> tells me "Invalid switch - "/".
> >>>>>
> >>>>> Removing one of the leading slashes returns 'Invalid switch
> "/MS"'
> >>>>> I have tried it without the "start", and have tried removing one
> >>>>> of the leading slashes. I couldn't find anything in the TC online
> >>>>> docs either.
> >>>>>
> >>>>> What am I missing here?
> >>>>>
> >>>> Did you try :
> >>>>
> >>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
> >>>> 7.0\bin\tomcat7w.exe //MS//Small-55009"
> >>>
> >>> Yes. That doesn't throw an error, but doesn't start the monitor
> >>> either.
> >>>
> >>>>
> >>>> You might also try searching Google for "windows cmd quoting
> rules"
> >>>>
> >>>> And are you sure that it is tomcat7w.exe that must be started, not
> >>>> tomcat7.exe ?
> >>>
> >>> Yes, it's the service monitor I'm trying to start, not the tomcat
> >>> server.
> >>>
> >> Next guess then : the "monitor" tomcat7w.exe is not itself a
> Service,
> >> it is just an application, no ? Doesn't "start" refer to Services
> >> only ?
> >
> > Nope, it's a kind of "do it" program that allows you to launch
> > programs with/without a terminal, minimized, etc.
>
> Yeah, what he said. In this usage, "Start" tells a windows batch file
> to start the specified program and continue on, rather than waiting for
> it to finish, as it would if you started it with "call" or with just
> the program name. I'm trying to have a single batch file start the
> various tomcat7w instances for the TC services, rather than having to
> create a shortcut for each one and copy it into the startup group.
>

start "" "D:\Tomcat 7.0\bin\tomcat7w.exe" //MS//Tomcat7

See http://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

Attachment: users_240501.eml (zipped)
Harris, Jeffrey E. wrote:
>
>> -----Original Message-----
>> From: David kerber [mailto:dckerber@(protected)]
>> Sent: Monday, March 18, 2013 11:33 AM
>> To: Tomcat Users List
>> Subject: Re: Starting tomcat7w from batch file
>>
>>>>>>> tells me I have a bad parameter. For example:
>>>>>>>
>>>>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>>>>>>> 7.0\bin\tomcat7w.exe" //MS//Small-55009
>>>>>>>
>>>>>>> tells me "Invalid switch - "/".
>>>>>>>
>>>>>>> Removing one of the leading slashes returns 'Invalid switch
>> "/MS"'
>>>>>>> I have tried it without the "start", and have tried removing one
>>>>>>> of the leading slashes. I couldn't find anything in the TC online
>>>>>>> docs either.
>>>>>>>
>>>>>>> What am I missing here?
>>>>>>>
>>>>>> Did you try :
>>>>>>
>>>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>>>>>> 7.0\bin\tomcat7w.exe //MS//Small-55009"
>>>>> Yes. That doesn't throw an error, but doesn't start the monitor
>>>>> either.
>>>>>
>>>>>> You might also try searching Google for "windows cmd quoting
>> rules"
>>>>>> And are you sure that it is tomcat7w.exe that must be started, not
>>>>>> tomcat7.exe ?
>>>>> Yes, it's the service monitor I'm trying to start, not the tomcat
>>>>> server.
>>>>>
>>>> Next guess then : the "monitor" tomcat7w.exe is not itself a
>> Service,
>>>> it is just an application, no ? Doesn't "start" refer to Services
>>>> only ?
>>> Nope, it's a kind of "do it" program that allows you to launch
>>> programs with/without a terminal, minimized, etc.
>> Yeah, what he said. In this usage, "Start" tells a windows batch file
>> to start the specified program and continue on, rather than waiting for
>> it to finish, as it would if you started it with "call" or with just
>> the program name. I'm trying to have a single batch file start the
>> various tomcat7w instances for the TC services, rather than having to
>> create a shortcut for each one and copy it into the startup group.
>>
>
> start "" "D:\Tomcat 7.0\bin\tomcat7w.exe" //MS//Tomcat7
>
> See http://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program
>

Judging by that thread though, there appears to be as many different suggestions as
people.. ;-)
Windows's CMD shell has so many quirks in general, that it is really hard to figure out
how it will handle a command-line.
It`s almost worth installing a Windows bash port just to avoid it.
Not that I've ever tried it though.




Attachment: users_240502.eml (zipped)


> -----Original Message-----
> From: André Warnier [mailto:aw@(protected)]
> Sent: Monday, March 18, 2013 12:04 PM
> To: Tomcat Users List
> Subject: Re: Starting tomcat7w from batch file
>
> Harris, Jeffrey E. wrote:
> >
> >> -----Original Message-----
> >> From: David kerber [mailto:dckerber@(protected)]
> >> Sent: Monday, March 18, 2013 11:33 AM
> >> To: Tomcat Users List
> >> Subject: Re: Starting tomcat7w from batch file
> >>
> >>>>>>> tells me I have a bad parameter. For example:
> >>>>>>>
> >>>>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
> >>>>>>> 7.0\bin\tomcat7w.exe" //MS//Small-55009
> >>>>>>>
> >>>>>>> tells me "Invalid switch - "/".
> >>>>>>>
> >>>>>>> Removing one of the leading slashes returns 'Invalid switch
> >> "/MS"'
> >>>>>>> I have tried it without the "start", and have tried removing
> one
> >>>>>>> of the leading slashes. I couldn't find anything in the TC
> >>>>>>> online docs either.
> >>>>>>>
> >>>>>>> What am I missing here?
> >>>>>>>
> >>>>>> Did you try :
> >>>>>>
> >>>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
> >>>>>> 7.0\bin\tomcat7w.exe //MS//Small-55009"
> >>>>> Yes. That doesn't throw an error, but doesn't start the monitor
> >>>>> either.
> >>>>>
> >>>>>> You might also try searching Google for "windows cmd quoting
> >> rules"
> >>>>>> And are you sure that it is tomcat7w.exe that must be started,
> >>>>>> not tomcat7.exe ?
> >>>>> Yes, it's the service monitor I'm trying to start, not the tomcat
> >>>>> server.
> >>>>>
> >>>> Next guess then : the "monitor" tomcat7w.exe is not itself a
> >> Service,
> >>>> it is just an application, no ? Doesn't "start" refer to Services
> >>>> only ?
> >>> Nope, it's a kind of "do it" program that allows you to launch
> >>> programs with/without a terminal, minimized, etc.
> >> Yeah, what he said. In this usage, "Start" tells a windows batch
> >> file to start the specified program and continue on, rather than
> >> waiting for it to finish, as it would if you started it with "call"
> >> or with just the program name. I'm trying to have a single batch
> >> file start the various tomcat7w instances for the TC services,
> rather
> >> than having to create a shortcut for each one and copy it into the
> startup group.
> >>
> >
> > start "" "D:\Tomcat 7.0\bin\tomcat7w.exe" //MS//Tomcat7
> >
> > See
> > http://stackoverflow.com/questions/154075/using-the-dos-start-
> command-
> > with-parameters-passed-to-the-started-program
> >
>
> Judging by that thread though, there appears to be as many different
> suggestions as people.. ;-) Windows's CMD shell has so many quirks in
> general, that it is really hard to figure out how it will handle a
> command-line.
> It`s almost worth installing a Windows bash port just to avoid it.
> Not that I've ever tried it though.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)

I tested the solution above, and it worked for me.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

Attachment: users_240504.eml (zipped)
On 3/18/2013 11:49 AM, Harris, Jeffrey E. wrote:
>
>
>> -----Original Message-----
>> From: David kerber [mailto:dckerber@(protected)]
>> Sent: Monday, March 18, 2013 11:33 AM
>> To: Tomcat Users List
>> Subject: Re: Starting tomcat7w from batch file
>>
>>>>>>> tells me I have a bad parameter. For example:
>>>>>>>
>>>>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>>>>>>> 7.0\bin\tomcat7w.exe" //MS//Small-55009
>>>>>>>
>>>>>>> tells me "Invalid switch - "/".
>>>>>>>
>>>>>>> Removing one of the leading slashes returns 'Invalid switch
>> "/MS"'
>>>>>>> I have tried it without the "start", and have tried removing one
>>>>>>> of the leading slashes. I couldn't find anything in the TC online
>>>>>>> docs either.
>>>>>>>
>>>>>>> What am I missing here?
>>>>>>>
>>>>>> Did you try :
>>>>>>
>>>>>> start "C:\Program Files (x86)\Apache Software Foundation\Tomcat
>>>>>> 7.0\bin\tomcat7w.exe //MS//Small-55009"
>>>>>
>>>>> Yes. That doesn't throw an error, but doesn't start the monitor
>>>>> either.
>>>>>
>>>>>>
>>>>>> You might also try searching Google for "windows cmd quoting
>> rules"
>>>>>>
>>>>>> And are you sure that it is tomcat7w.exe that must be started, not
>>>>>> tomcat7.exe ?
>>>>>
>>>>> Yes, it's the service monitor I'm trying to start, not the tomcat
>>>>> server.
>>>>>
>>>> Next guess then : the "monitor" tomcat7w.exe is not itself a
>> Service,
>>>> it is just an application, no ? Doesn't "start" refer to Services
>>>> only ?
>>>
>>> Nope, it's a kind of "do it" program that allows you to launch
>>> programs with/without a terminal, minimized, etc.
>>
>> Yeah, what he said. In this usage, "Start" tells a windows batch file
>> to start the specified program and continue on, rather than waiting for
>> it to finish, as it would if you started it with "call" or with just
>> the program name. I'm trying to have a single batch file start the
>> various tomcat7w instances for the TC services, rather than having to
>> create a shortcut for each one and copy it into the startup group.
>>
>
> start "" "D:\Tomcat 7.0\bin\tomcat7w.exe" //MS//Tomcat7
>
> See http://stackoverflow.com/questions/154075/using-the-dos-start-command-with-parameters-passed-to-the-started-program

That did the trick; thanks, people!

D

>
> Jeffrey Harris
>
> This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>
>


©2008 junlu.com - Jax Systems, LLC, U.S.A.