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





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


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: Getting the Manager app running on localhost.. Please help

2018-07-13 Thread Désilets , Alain
Thx everyone for the great replies.

I decided to take Konstantin Kolinko's advice and start a new installation from 
scratch using tomcat-8.5.32.

I have had some success, but still can't deploy WARS.

Here is what I did:

== Step 1: Installing Tomcat per se ==
I used the instructions on this page:

https://wolfpaulus.com/mac/tomcat/

* Download the zip file and unzip it on your HD under 
/usr/local/apache-tomcat-N.N.N (where N.N.N is the version number).
** Note: In the rest of this document, that directory will be referred to 
[CATALINA_HOME].
* Create a symlink /Library/Tomcat to make managing future versions easier:
sudo rm -f /Library/Tomcat
sudo ln -s [CATALINA_HOME] /Library/Tomcat
* Change ownership of /Library/Tomcat
sudo chown -R  /Library/Tomcat
* Make all scripts executable
sudo chmod +x /Library/Tomcat/bin/*.sh
* Now, I can start/stop tomcat as follows:
/Library/Tomcat/bin/startup.sh
/Library/Tomcat/bin/shutdown.sh
** IMPORTANT: DON’T RUN THOSE SCRIPTS WITH SUDO!!! 
 Especially ‘startup.sh’, as this will end up creating a bunch of temporay 
dirs and files that will be owned by ROOT, and cannot be written unless you 
start Tomcat as ROOT.
* Test the installation by:
** Starting Tomcat with startup.sh
** Pointing my browser at http://localhost:8080/.
** I see the Tomcat home page no problem

== Step 2: Configuring the Tomcat Manager Apps ==

* Edit the file /Library/Tomcat/conf/tomcat-users.xml, and add the following 
lines inside the  tag pair:





* Shutdown and re-start Tomcat
* At this point, I can click on any of the following buttons: 'Server Status', 
'Manager' App, 'Host Manager' and once I enter the user and passwords I 
specified in , I get to see the corresponding page.
** On 'Manager App', I was able to start, stop, re-deploy EXISTING apps.
** BUT
*** When I tried to deploy a new WAR file, I got:

This site can’t be reached
The connection was reset.
Try:

Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_RESET

After a bit of reading, it seems that this is because the WAR file I was 
deploying was larger than the maximum size allowed. I fixed that by editing 
/Library/Tomcat/webapps/manager/WEB-INF/web.xml, and changing the size in the 
following tags:


5000 
5000 
0


And now, all seem to work fine.

Again, thanks to everyone who pitched in with some advice. It was really 
helpful.

Alain 



Getting the Manager app running on localhost.. Please help

2018-07-12 Thread Désilets , Alain
I have been trying to get my local Tomcat installation to allow me to deploy 
apps from the local machine and nothing I do seems to help.

At the moment, I have a file [CATALINA_HOME]/conf/tomcat-users.xml with the 
following content:

   
   
   
   

When I go to http://localhost:8080/ and click on the various apps buttons I get 
the following outcomes:


  *   Server Status: Opens the ‘Server Status’ page
  *   Manager App: Opens the ‘Tomcat Web Application Manager’ page. But if I 
try to deploy a war file, I get “This site can’t be reached”.
  *   Host Manager: I get ‘403 Access Denied’ with a long series of 
explanations about roles, context.xml and tomcat-users.xml.

Reading the instructions, it sounds like I got the tomcat-users.xml part right 
(see the content above). Correct?

So now I go about creating the context file for the Manager app. I create a 
file:

   [CATALINA_HOME]/ conf/Catalina/localhost/manager.xml

With the following content:


  


Re: Getting the Manager app running on localhost.. Please help

2018-07-12 Thread Désilets , Alain
> Where 132.246.129.58 is my IP address. Note that I tried also with 
> “132.0.0.0” and with “^.*$” to no avail.

I should be more precise…

When I try with “^.*$”, I get same behavior as when I didn’t have a manager.xml 
file, ie:

  *   Server Status: works
  *   Manager: opens page but deploying war causes ‘This site can’t be reached’
  *   Host Manager: ‘403 Access Denied’

And by “132.0.0.0.”, I actually meant “127.0.0.1”. When I try that from 
‘localhost:8080’, all buttons result in ‘403 Access Denied’. But when I access 
the buttons from “127.0.0.1:8080”, I get the same behavior as above


Alain Désilets
National Research Council of Canada


Re: Getting the Manager app running on localhost.. Please help

2018-07-12 Thread Désilets , Alain
Thx for the reply.

> have you enabled all user roles with passwords? in 
> CATALINA_HOME/conf/tomcat-users.xml file? 
> Also, don't forget to change
>  the passwords noted as "" with something "interesting".

Yes. As I mentioned in the first email of this thread, I have a file 
[CATALINA_HOME]/conf/tomcat-users.xml with the following content:

   
   
   
   

>By default, it can only run on localhost, and it's configured to listen to
>127.0.0.1 via the valve. If you uncomment the user role part and change the
>password, you should be able to log in. i was able to start it by doing
>above.

As I mentioned in the first email, when I tried it first with the above 
tomcat-users.xml file and no manager.xml file, it didn't work. Server Status 
worked, Manager opened the page but couldn't deploy a war file, and Host 
Manager gave me 403. This happened whether I accessed the site as 
http://localhost:8080 or http://127.0.0.1:8080. 

So for some reason or other, the default behaviour doesn't seem to work for me.

Note that I am using OSX. 

Could this be due to some sort of proxy issue?

Thx again.

Alain



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