Re: Can't start Tomcat in debug mode

2018-07-16 Thread Désilets , Alain
On 2018-07-16, 9:28 AM, "Konstantin Kolinko"  wrote:

  >  >>ps: a HTTP request against the debug port will print this message in 
the
  >  >>catalina.out Debugger failed to attach: handshake failed - received 
>GET /
  >  >>HTTP/1.1< - expected >JDWP-Handshake<
  >  >
  >  >  Yep, I get that message when running with jpda
  >  
  >  You have that message = You have started in debug mode = You tried
  >  connecting with a wrong client.
  >  
  >  I have impression that you have successfully started Tomcat in debug mode.
  >  The problem is that you cannot connect to it.
  >  
 >   Have you tried to connect with a proper debug client (IDE)?
   
Duh... I thought both the IDE AND the browser had to use port 8000. I now 
realize that port 8000 is just for the IDE to connect to the server and request 
a debugging session. The browser should still connect through 8080.

Now that I do that, everything works file.

Thx for the help everybody.

Alain



 
You may try using explicit IPv4 address, http://127.0.0.1:8000/

I wonder whether address=8000 can be used to specify IP address as well as 
port.


Also
>  /Library/Tomcat

What version is that? Is it ours?

> I have a file /Library/Tomcat/bin/setenv

You tried many ways. I wonder which one wins.
All those environment variables are used to build the command line for
Java. I wonder whether java sees several copies of those options.

For example, if you start with suspend=y then Java will start, but it
will stop (like being on a breakpoint) at Tomcat startup sequence.

Have you looked into Tomcat log files? Look for output from
VersionLoggerListener.

http://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#Version_Logging_Lifecycle_Listener_-_org.apache.catalina.startup.VersionLoggerListener


Best regards,
Konstantin Kolinko

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





RE: Can't start Tomcat in debug mode

2018-07-16 Thread Sebastian Trost
-Original Message-
From: Désilets, Alain  
Sent: Monday, July 16, 2018 1:45 PM
To: Tomcat Users List 
Subject: Can't start Tomcat in debug mode

> I am unable to start Tomcat in debug mode. I have searched and see that lots 
> of people are having similar issues. I tried all the fixes that were proposed 
> and none of them seem to work.

> Here is what I have at the moment.

> I have a file /Library/Tomcat/bin/setenv with the following content
> # Trying to start Tomcat in debug mode...
> #
> # 
> CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
> JPDA_ADDRESS=8000
> JPDA_TRANSPORT=dtsocket
> JPDA_SUSPEND=n

Shouldn't it be "JDPA_TRANSPORT=dt_socket" - with the underscore?

Regards
Sebastian

[snip]


Re: Can't start Tomcat in debug mode

2018-07-16 Thread Konstantin Kolinko
2018-07-16 15:56 GMT+03:00 Désilets, Alain :
>>lurodrig@:tomcat-9-0-5-installation$ lsof -i:8000
>>COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
>>java13522 lurodrig4u  IPv4 450991  0t0  TCP localhost:8000
>>(LISTEN)
>
> Gives me this
>
> java2323 desilets5u  IPv4 0xad510ad86ad41671  0t0  TCP 
> *:irdmi (LISTEN)
>
> which seems to indicate that Tomcat is NOT listening on locahost, but on 
> something called *:irdmi. Not sure that this matters, because from what I can 
> read on the net, *:irdmi corresponds to port 8000.
>

Note that the above lsof output for port 8000 says "IPv4",but the one
below for port 8080 says "IPv6".

>>lurodrig@:tomcat-9-0-5-installation$ lsof -i:8080
>>COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
>>java13522 lurodrig   51u  IPv6 450993  0t0  TCP *:http-alt 
>> (LISTEN)
>
> Gives me this:
>
> java2323 desilets   61u  IPv6 0xad510ad8630f7d61  0t0  TCP 
> *:http-alt (LISTEN)
>
> Again, I believe *:http-alt is just an alias for  8080, so it doesn't seem to 
> matter.
>
> Note that if I start with 'catalina.sh start' (i.e. no jpda), I get *:http-al 
> for 'lsof -8080'  and nothing for 'lsof -8000'.
>
>>Hope it helps,
>
> So far, no. But I appreciate the effort. Any other ideas?
>
>>ps: a HTTP request against the debug port will print this message in the
>>catalina.out Debugger failed to attach: handshake failed - received >GET /
>>HTTP/1.1< - expected >JDWP-Handshake<
>
>  Yep, I get that message when running with jpda

You have that message = You have started in debug mode = You tried
connecting with a wrong client.

I have impression that you have successfully started Tomcat in debug mode.
The problem is that you cannot connect to it.

Have you tried to connect with a proper debug client (IDE)?

You may try using explicit IPv4 address, http://127.0.0.1:8000/

I wonder whether address=8000 can be used to specify IP address as well as port.


Also
>  /Library/Tomcat

What version is that? Is it ours?

> I have a file /Library/Tomcat/bin/setenv

You tried many ways. I wonder which one wins.
All those environment variables are used to build the command line for
Java. I wonder whether java sees several copies of those options.

For example, if you start with suspend=y then Java will start, but it
will stop (like being on a breakpoint) at Tomcat startup sequence.

Have you looked into Tomcat log files? Look for output from
VersionLoggerListener.
http://tomcat.apache.org/tomcat-9.0-doc/config/listeners.html#Version_Logging_Lifecycle_Listener_-_org.apache.catalina.startup.VersionLoggerListener


Best regards,
Konstantin Kolinko

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



Re: Can't start Tomcat in debug mode

2018-07-16 Thread Désilets , Alain
Thx Luis,

> /Library/Tomcat/bin/catalina.sh jpda start should be good enough. If you
> have a look at the tomcat command line process are the JPDA options
>  enabled? E.g.:
>   
>$ $CATALINA_HOME/bin/catalina.sh jpda start
>
>$ ps -ef | grep --color dt_socket
>lurodrig 13522  2883  6 13:58 pts/500:00:04
>.../jdk1.8.0_162/bin/java...
>
> -agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n
>... org.apache.catalina.startup.Bootstrap start
  
This is what I get:

  501  2323 1   0  8:31am ttys0010:25.08 
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/bin/java 
[...] -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n [...] 
org.apache.catalina.startup.Bootstrap start
  
>In the catalina.out you should see something like: Listening for transport
>dt_socket at address: 8000

Yep, I get it.



>lurodrig@:tomcat-9-0-5-installation$ lsof -i:8000
>COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
>java13522 lurodrig4u  IPv4 450991  0t0  TCP localhost:8000
>(LISTEN)
  
Gives me this

java2323 desilets5u  IPv4 0xad510ad86ad41671  0t0  TCP 
*:irdmi (LISTEN)
  
which seems to indicate that Tomcat is NOT listening on locahost, but on 
something called *:irdmi. Not sure that this matters, because from what I can 
read on the net, *:irdmi corresponds to port 8000.


>lurodrig@:tomcat-9-0-5-installation$ lsof -i:8080
>COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
>java13522 lurodrig   51u  IPv6 450993  0t0  TCP *:http-alt (LISTEN)

Gives me this:

java2323 desilets   61u  IPv6 0xad510ad8630f7d61  0t0  TCP 
*:http-alt (LISTEN)

Again, I believe *:http-alt is just an alias for  8080, so it doesn't seem to 
matter.

Note that if I start with 'catalina.sh start' (i.e. no jpda), I get *:http-al 
for 'lsof -8080'  and nothing for 'lsof -8000'.

>Hope it helps,
  
So far, no. But I appreciate the effort. Any other ideas?
  
>ps: a HTTP request against the debug port will print this message in the
>catalina.out Debugger failed to attach: handshake failed - received >GET /
>HTTP/1.1< - expected >JDWP-Handshake<

 Yep, I get that message when running with jpda

Alain
 



Re: Can't start Tomcat in debug mode

2018-07-16 Thread Luis Rodríguez Fernández
Hello Alain,

 /Library/Tomcat/bin/catalina.sh jpda start should be good enough. If you
have a look at the tomcat command line process are the JPDA options
enabled? E.g.:

$ $CATALINA_HOME/bin/catalina.sh jpda start

$ ps -ef | grep --color dt_socket
lurodrig 13522  2883  6 13:58 pts/500:00:04
.../jdk1.8.0_162/bin/java...
-agentlib:jdwp=transport=dt_socket,address=localhost:8000,server=y,suspend=n
... org.apache.catalina.startup.Bootstrap start

In the catalina.out you should see something like: Listening for transport
dt_socket at address: 8000

Asking for the debug and http ports:

lurodrig@:tomcat-9-0-5-installation$ lsof -i:8000
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java13522 lurodrig4u  IPv4 450991  0t0  TCP localhost:8000
(LISTEN)

lurodrig@:tomcat-9-0-5-installation$ lsof -i:8080
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java13522 lurodrig   51u  IPv6 450993  0t0  TCP *:http-alt (LISTEN)

Hope it helps,

Luis

ps: a HTTP request against the debug port will print this message in the
catalina.out Debugger failed to attach: handshake failed - received >GET /
HTTP/1.1< - expected >JDWP-Handshake<



2018-07-16 13:45 GMT+02:00 Désilets, Alain :

> I am unable to start Tomcat in debug mode. I have searched and see that
> lots of people are having similar issues. I tried all the fixes that were
> proposed and none of them seem to work.
>
> Here is what I have at the moment.
>
> I have a file /Library/Tomcat/bin/setenv with the following content
> # Trying to start Tomcat in debug mode...
> #
> # CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=
> 8000,server=y,suspend=n"
> JPDA_ADDRESS=8000
> JPDA_TRANSPORT=dtsocket
> JPDA_SUSPEND=n
>
> Note that I tried setting the JPDA environment both ways (using
> CATALINA_OPTS and JPDA_* vars) and the result is the same.
>
> To restart tomcat, I do the following command:
>
>
> echo "" > /Library/Tomcat/logs/catalina.out ;
> /Library/Tomcat/bin/shutdown.sh; sleep 2; /Library/Tomcat/bin/catalina.sh
> jpda start; echo "Restarted tomcat, catalina.out is:"; cat
> /Library/Tomcat/logs/catalina.out
>
> This produces the following output:
>
>
> Using CATALINA_BASE:   /Library/Tomcat
>
> Using CATALINA_HOME:   /Library/Tomcat
>
> Using CATALINA_TMPDIR: /Library/Tomcat/temp
>
> Using JRE_HOME:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> 102.jdk/Contents/Home
>
> Using CLASSPATH:   /Library/Tomcat/bin/bootstrap.
> jar:/Library/Tomcat/bin/tomcat-juli.jar
>
> Using CATALINA_BASE:   /Library/Tomcat
>
> Using CATALINA_HOME:   /Library/Tomcat
>
> Using CATALINA_TMPDIR: /Library/Tomcat/temp
>
> Using JRE_HOME:/Library/Java/JavaVirtualMachines/jdk1.8.0_
> 102.jdk/Contents/Home
>
> Using CLASSPATH:   /Library/Tomcat/bin/bootstrap.
> jar:/Library/Tomcat/bin/tomcat-juli.jar
>
> Tomcat started.
>
> Restarted tomcat, catalina.out is:
>
>
>
> 16-Jul-2018 07:35:12.366 INFO [main] 
> org.apache.catalina.core.StandardServer.await
> A valid shutdown command was received via the shutdown port. Stopping the
> Server instance.
>
> 16-Jul-2018 07:35:12.366 INFO [main] org.apache.coyote.AbstractProtocol.pause
> Pausing ProtocolHandler ["http-nio-8080"]
>
> 16-Jul-2018 07:35:12.426 INFO [main] org.apache.coyote.AbstractProtocol.pause
> Pausing ProtocolHandler ["ajp-nio-8009"]
>
> 16-Jul-2018 07:35:12.483 INFO [main] 
> org.apache.catalina.core.StandardService.stopInternal
> Stopping service [Catalina]
>
> 16-Jul-2018 07:35:12.517 INFO [main] org.apache.coyote.AbstractProtocol.stop
> Stopping ProtocolHandler ["http-nio-8080"]
>
> 16-Jul-2018 07:35:12.520 INFO [main] org.apache.coyote.AbstractProtocol.stop
> Stopping ProtocolHandler ["ajp-nio-8009"]
>
> 16-Jul-2018 07:35:12.523 INFO [main] 
> org.apache.coyote.AbstractProtocol.destroy
> Destroying ProtocolHandler ["http-nio-8080"]
>
> 16-Jul-2018 07:35:12.523 INFO [main] 
> org.apache.coyote.AbstractProtocol.destroy
> Destroying ProtocolHandler ["ajp-nio-8009"]
>
>
>
> When I go to http://localhost:8000, I get “This site can’t be reached”.
>
>
>
> Same if I go to http://localhost:8080/.
>
>
>
> But… if I restart tomcat using the same command as above, except without
> the ‘jpda’ argument to Catalina.sh, then 8080 is started fine, but not 8000
> (which Is to be expected).
>
>
>
> I checked to see if port 8000 is already busy by issueing this command:
>
>
>
> sudo lsof -iTCP -sTCP:LISTEN -n -P | grep 8000
>
>
>
> But is shows no process listening on that port. And I know that this
> command works because when I successfully start tomcat without ‘jpda’, if I
> use this command to check for port 8080, I get:
>
>
>
> java  1925 desilets   60u  IPv6 0xad510ad8630ef821  0t0  TCP
> *:8080 (LISTEN)
>
>
> Not sure what to try next… have pretty much run out of options at this
> point.
>
> Any help will be greatly appreciated.
>
> Thx.
>
> Alain Désilets
> National Research Council of Canad
>



-- 

"Ever tried. Ever failed. No matter. Try Again. Fail 

Can't start Tomcat in debug mode

2018-07-16 Thread Désilets , Alain
I am unable to start Tomcat in debug mode. I have searched and see that lots of 
people are having similar issues. I tried all the fixes that were proposed and 
none of them seem to work.

Here is what I have at the moment.

I have a file /Library/Tomcat/bin/setenv with the following content
# Trying to start Tomcat in debug mode...
#
# 
CATALINA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"
JPDA_ADDRESS=8000
JPDA_TRANSPORT=dtsocket
JPDA_SUSPEND=n

Note that I tried setting the JPDA environment both ways (using CATALINA_OPTS 
and JPDA_* vars) and the result is the same.

To restart tomcat, I do the following command:


echo "" > /Library/Tomcat/logs/catalina.out ; /Library/Tomcat/bin/shutdown.sh; 
sleep 2; /Library/Tomcat/bin/catalina.sh jpda start; echo "Restarted tomcat, 
catalina.out is:"; cat /Library/Tomcat/logs/catalina.out

This produces the following output:


Using CATALINA_BASE:   /Library/Tomcat

Using CATALINA_HOME:   /Library/Tomcat

Using CATALINA_TMPDIR: /Library/Tomcat/temp

Using JRE_HOME:
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home

Using CLASSPATH:   
/Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar

Using CATALINA_BASE:   /Library/Tomcat

Using CATALINA_HOME:   /Library/Tomcat

Using CATALINA_TMPDIR: /Library/Tomcat/temp

Using JRE_HOME:
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home

Using CLASSPATH:   
/Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar

Tomcat started.

Restarted tomcat, catalina.out is:



16-Jul-2018 07:35:12.366 INFO [main] 
org.apache.catalina.core.StandardServer.await A valid shutdown command was 
received via the shutdown port. Stopping the Server instance.

16-Jul-2018 07:35:12.366 INFO [main] org.apache.coyote.AbstractProtocol.pause 
Pausing ProtocolHandler ["http-nio-8080"]

16-Jul-2018 07:35:12.426 INFO [main] org.apache.coyote.AbstractProtocol.pause 
Pausing ProtocolHandler ["ajp-nio-8009"]

16-Jul-2018 07:35:12.483 INFO [main] 
org.apache.catalina.core.StandardService.stopInternal Stopping service 
[Catalina]

16-Jul-2018 07:35:12.517 INFO [main] org.apache.coyote.AbstractProtocol.stop 
Stopping ProtocolHandler ["http-nio-8080"]

16-Jul-2018 07:35:12.520 INFO [main] org.apache.coyote.AbstractProtocol.stop 
Stopping ProtocolHandler ["ajp-nio-8009"]

16-Jul-2018 07:35:12.523 INFO [main] org.apache.coyote.AbstractProtocol.destroy 
Destroying ProtocolHandler ["http-nio-8080"]

16-Jul-2018 07:35:12.523 INFO [main] org.apache.coyote.AbstractProtocol.destroy 
Destroying ProtocolHandler ["ajp-nio-8009"]



When I go to http://localhost:8000, I get “This site can’t be reached”.



Same if I go to http://localhost:8080/.



But… if I restart tomcat using the same command as above, except without the 
‘jpda’ argument to Catalina.sh, then 8080 is started fine, but not 8000 (which 
Is to be expected).



I checked to see if port 8000 is already busy by issueing this command:



sudo lsof -iTCP -sTCP:LISTEN -n -P | grep 8000



But is shows no process listening on that port. And I know that this command 
works because when I successfully start tomcat without ‘jpda’, if I use this 
command to check for port 8080, I get:



java  1925 desilets   60u  IPv6 0xad510ad8630ef821  0t0  TCP *:8080 
(LISTEN)


Not sure what to try next… have pretty much run out of options at this point.

Any help will be greatly appreciated.

Thx.

Alain Désilets
National Research Council of Canad