Re: distinction between resource charset and format octet decoding

2019-01-22 Thread Garret Wilson

On 1/15/2019 3:20 AM, Mark Thomas wrote:

…
Anything in PascalCase becomes a link to a wiki page of that name.
Usernames are created in this form so references to the user
automatically become links to that user's page in the wiki.



Ah, OK, that explains it. Very good to know. Maybe a little semantic 
overloading, but as this is my first wiki account anywhere, I'm guessing 
it's typical with whatever software you're using.


Anyway my account is created, with username `GarretWilson`. After I get 
permissions I'll update the info on octet encoding for 
application/x-www-form-urlencoded in relation to the servlet spec. It 
may not be immediately, but I'll slowly but surely get to it.


Cheers,

Garret


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



Re: Tomcat 8.5 Startup w/systemctl & Immediate Shutdown

2019-01-22 Thread David Filip
The tomcat installation on both — working and non-working — are clean, fresh 
download-n-untar distributions from the Apache web site; I have not deployed 
any web apps or modified any configuration files.

Moreover, as I point out, if I manually run catalina.sh in ../bin, the server 
starts up fine, and keeps running, and responds correctly to requests (i.e., I 
get the Tomcat 8.5 installation success screen).

So the problem does not appear to be with tomcat and its configuration, per se, 
but trying to get systems / systemctl to work.  If Tomcat itself was 
mis-configured, I would think that it wouldn’t start up when I manually ran 
catalina.sh in ../bin, and response to requests.

So the assistance I am seeking is related to how to get it to start and run 
with systemctl.  In the past (going back many years to tomcat 3 I believe), I 
always wrote /etc/init.d scripts, which were shell scripts, but now trying to 
get this to work with systemd / systemctl (which are configured with .service 
parameter files in /usr/lib/systemd/system, and not shell scripts).

Thanks.

> On Jan 22, 2019, at 10:26 PM, Christopher Schultz 
>  wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
> 
> David,
> 
> On 1/22/19 18:52, David Filip wrote:
>> Hi All,
>> 
>> I seem to be having troubles getting Tomcat 8.5 to start on an 
>> Amazon Linux 2 server with systemctl.  The problem seems to be
>> that after starting tomcat, it always immediately tries to shut
>> down. From /var/log:
>>> Jan 22 23:13:32 cloud systemd: Starting Tomcat 8.5 servlet
>>> container...
>> Jan 22 23:13:32 cloud startup.sh: Tomcat started. Jan 22 23:13:32
>> cloud systemd: Started Tomcat 8.5 servlet container. Jan 22
>> 23:13:33 cloud shutdown.sh: Jan 22, 2019 11:13:33 PM
>> org.apache.catalina.startup.Catalina stopServer Jan 22 23:13:33
>> cloud shutdown.sh: SEVERE: Could not contact [localhost:[8005]].
>> Tomcat may not be running. Jan 22 23:13:33 cloud shutdown.sh: Jan
>> 22, 2019 11:13:33 PM org.apache.catalina.startup.Catalina
>> stopServer Jan 22 23:13:33 cloud shutdown.sh: SEVERE:
>> Catalina.stop: Jan 22 23:13:33 cloud shutdown.sh:
>> java.net.ConnectException: Connection refused (Connection refused) 
>> Jan 22 23:13:33 cloud shutdown.sh: at
>> java.net.PlainSocketImpl.socketConnect(Native Method) Jan 22
>> 23:13:33 cloud shutdown.sh: at
>> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.jav
> a:350)
>> 
>> 
> Jan 22 23:13:33 cloud shutdown.sh: at
> java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImp
> l.java:206)
>> Jan 22 23:13:33 cloud shutdown.sh: at
>> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:
> 188)
>> 
>> 
> Jan 22 23:13:33 cloud shutdown.sh: at
> java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
>> Jan 22 23:13:33 cloud shutdown.sh: at
>> java.net.Socket.connect(Socket.java:589) Jan 22 23:13:33 cloud
>> shutdown.sh: at java.net.Socket.connect(Socket.java:538) Jan 22
>> 23:13:33 cloud shutdown.sh: at
>> java.net.Socket.(Socket.java:434) Jan 22 23:13:33 cloud
>> shutdown.sh: at java.net.Socket.(Socket.java:211) Jan 22
>> 23:13:33 cloud shutdown.sh: at
>> org.apache.catalina.startup.Catalina.stopServer(Catalina.java:503) 
>> Jan 22 23:13:33 cloud shutdown.sh: at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Jan 22
>> 23:13:33 cloud shutdown.sh: at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
> ava:62)
>> 
>> 
> Jan 22 23:13:33 cloud shutdown.sh: at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:43)
>> Jan 22 23:13:33 cloud shutdown.sh: at
>> java.lang.reflect.Method.invoke(Method.java:498) Jan 22 23:13:33
>> cloud shutdown.sh: at
>> org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:406)
>> 
>> 
> Jan 22 23:13:33 cloud shutdown.sh: at
> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:498)
>> Jan 22 23:13:33 cloud shutdown.sh: The stop command failed.
>> Attempting to signal the process to stop through OS signal. Jan 22
>> 23:13:34 cloud shutdown.sh: Tomcat stopped.
>> 
>> However, I can manually start tomcat on the same server, which
>> works fine, e.g.:
>> 
>> # cd /opt/tomcat/bin # ./catalina.sh start Using CATALINA_BASE:
>> /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using
>> CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:/usr Using
>> CLASSPATH:
>> /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar 
>> Tomcat started.
>> 
>> # ps -aef | grep java root  8598 1 50 23:17 pts/0
>> 00:00:02 /usr/bin/java
>> -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
>> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
>> -Djdk.tls.ephemeralDHKeySize=2048
>> -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
>> -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
>> -Dignore.endorsed.dirs= -classpath
>> /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
>> 

Re: Tomcat 8.5 Startup w/systemctl & Immediate Shutdown

2019-01-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

David,

On 1/22/19 18:52, David Filip wrote:
> Hi All,
> 
> I seem to be having troubles getting Tomcat 8.5 to start on an 
> Amazon Linux 2 server with systemctl.  The problem seems to be
> that after starting tomcat, it always immediately tries to shut
> down. From /var/log:
>> Jan 22 23:13:32 cloud systemd: Starting Tomcat 8.5 servlet
>> container...
> Jan 22 23:13:32 cloud startup.sh: Tomcat started. Jan 22 23:13:32
> cloud systemd: Started Tomcat 8.5 servlet container. Jan 22
> 23:13:33 cloud shutdown.sh: Jan 22, 2019 11:13:33 PM
> org.apache.catalina.startup.Catalina stopServer Jan 22 23:13:33
> cloud shutdown.sh: SEVERE: Could not contact [localhost:[8005]].
> Tomcat may not be running. Jan 22 23:13:33 cloud shutdown.sh: Jan
> 22, 2019 11:13:33 PM org.apache.catalina.startup.Catalina
> stopServer Jan 22 23:13:33 cloud shutdown.sh: SEVERE:
> Catalina.stop: Jan 22 23:13:33 cloud shutdown.sh:
> java.net.ConnectException: Connection refused (Connection refused) 
> Jan 22 23:13:33 cloud shutdown.sh: at
> java.net.PlainSocketImpl.socketConnect(Native Method) Jan 22
> 23:13:33 cloud shutdown.sh: at
> java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.jav
a:350)
>
> 
Jan 22 23:13:33 cloud shutdown.sh: at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImp
l.java:206)
> Jan 22 23:13:33 cloud shutdown.sh: at
> java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:
188)
>
> 
Jan 22 23:13:33 cloud shutdown.sh: at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
> Jan 22 23:13:33 cloud shutdown.sh: at
> java.net.Socket.connect(Socket.java:589) Jan 22 23:13:33 cloud
> shutdown.sh: at java.net.Socket.connect(Socket.java:538) Jan 22
> 23:13:33 cloud shutdown.sh: at
> java.net.Socket.(Socket.java:434) Jan 22 23:13:33 cloud
> shutdown.sh: at java.net.Socket.(Socket.java:211) Jan 22
> 23:13:33 cloud shutdown.sh: at
> org.apache.catalina.startup.Catalina.stopServer(Catalina.java:503) 
> Jan 22 23:13:33 cloud shutdown.sh: at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Jan 22
> 23:13:33 cloud shutdown.sh: at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j
ava:62)
>
> 
Jan 22 23:13:33 cloud shutdown.sh: at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:43)
> Jan 22 23:13:33 cloud shutdown.sh: at
> java.lang.reflect.Method.invoke(Method.java:498) Jan 22 23:13:33
> cloud shutdown.sh: at
> org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:406)
>
> 
Jan 22 23:13:33 cloud shutdown.sh: at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:498)
> Jan 22 23:13:33 cloud shutdown.sh: The stop command failed.
> Attempting to signal the process to stop through OS signal. Jan 22
> 23:13:34 cloud shutdown.sh: Tomcat stopped.
> 
> However, I can manually start tomcat on the same server, which
> works fine, e.g.:
> 
> # cd /opt/tomcat/bin # ./catalina.sh start Using CATALINA_BASE:
> /opt/tomcat Using CATALINA_HOME:   /opt/tomcat Using
> CATALINA_TMPDIR: /opt/tomcat/temp Using JRE_HOME:/usr Using
> CLASSPATH:
> /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar 
> Tomcat started.
> 
> # ps -aef | grep java root  8598 1 50 23:17 pts/0
> 00:00:02 /usr/bin/java
> -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties
> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> -Djdk.tls.ephemeralDHKeySize=2048
> -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
> -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
> -Dignore.endorsed.dirs= -classpath
> /opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
> -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat
> -Djava.io.tmpdir=/opt/tomcat/temp
> org.apache.catalina.startup.Bootstrap start
> 
> And it stays running until I explicitly shut it down.  However,
> what is most odd is that I also have tomcat 8.5 running on a
> DIFFERENT system, which was built with a generic CentOS 7.5
> download (vs. an Amazon Linux 2 EC2 server), but USING THE SAME
> SERVICE FILE.  I was under the impression that the Amazon Linux 2
> is based on CentOS 7.
I think it's supposed to be "CentOS/RHEL Compatible" but not
necessarily "based upon" one particular version  of CentOS/RHEL.

> Or, at least I can’t find the difference.  And while Google’ing 
> around, I did find other mentions of the exact same problem,
> whereby tomcat tries to immediately shut down after starting up,
> but alas without a posted solution.  I was wondering if anyone out
> there might have come across this problem, and have any advice?
I'll point out that Tomcat isn't just shutting down because it's
unhappy about something. The shutdown.sh script is being invoked,
probably by systemd. It would be great if you could just read the
scripts to find out what's going on, but evidently scripts are so passe.

I believe this is a problem with system and/or the 

Tomcat 8.5 Startup w/systemctl & Immediate Shutdown

2019-01-22 Thread David Filip
Hi All,

I seem to be having troubles getting Tomcat 8.5 to start on an Amazon Linux 2 
server with systemctl.  The problem seems to be that after starting tomcat, it 
always immediately tries to shut down.  From /var/log:

Jan 22 23:13:32 cloud systemd: Starting Tomcat 8.5 servlet container...
Jan 22 23:13:32 cloud startup.sh: Tomcat started.
Jan 22 23:13:32 cloud systemd: Started Tomcat 8.5 servlet container.
Jan 22 23:13:33 cloud shutdown.sh: Jan 22, 2019 11:13:33 PM 
org.apache.catalina.startup.Catalina stopServer
Jan 22 23:13:33 cloud shutdown.sh: SEVERE: Could not contact 
[localhost:[8005]]. Tomcat may not be running.
Jan 22 23:13:33 cloud shutdown.sh: Jan 22, 2019 11:13:33 PM 
org.apache.catalina.startup.Catalina stopServer
Jan 22 23:13:33 cloud shutdown.sh: SEVERE: Catalina.stop:
Jan 22 23:13:33 cloud shutdown.sh: java.net.ConnectException: Connection 
refused (Connection refused)
Jan 22 23:13:33 cloud shutdown.sh: at 
java.net.PlainSocketImpl.socketConnect(Native Method)
Jan 22 23:13:33 cloud shutdown.sh: at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
Jan 22 23:13:33 cloud shutdown.sh: at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
Jan 22 23:13:33 cloud shutdown.sh: at 
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
Jan 22 23:13:33 cloud shutdown.sh: at 
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
Jan 22 23:13:33 cloud shutdown.sh: at java.net.Socket.connect(Socket.java:589)
Jan 22 23:13:33 cloud shutdown.sh: at java.net.Socket.connect(Socket.java:538)
Jan 22 23:13:33 cloud shutdown.sh: at java.net.Socket.(Socket.java:434)
Jan 22 23:13:33 cloud shutdown.sh: at java.net.Socket.(Socket.java:211)
Jan 22 23:13:33 cloud shutdown.sh: at 
org.apache.catalina.startup.Catalina.stopServer(Catalina.java:503)
Jan 22 23:13:33 cloud shutdown.sh: at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Jan 22 23:13:33 cloud shutdown.sh: at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Jan 22 23:13:33 cloud shutdown.sh: at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jan 22 23:13:33 cloud shutdown.sh: at 
java.lang.reflect.Method.invoke(Method.java:498)
Jan 22 23:13:33 cloud shutdown.sh: at 
org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:406)
Jan 22 23:13:33 cloud shutdown.sh: at 
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:498)
Jan 22 23:13:33 cloud shutdown.sh: The stop command failed. Attempting to 
signal the process to stop through OS signal.
Jan 22 23:13:34 cloud shutdown.sh: Tomcat stopped.

However, I can manually start tomcat on the same server, which works fine, e.g.:

# cd /opt/tomcat/bin
# ./catalina.sh start
Using CATALINA_BASE:   /opt/tomcat
Using CATALINA_HOME:   /opt/tomcat
Using CATALINA_TMPDIR: /opt/tomcat/temp
Using JRE_HOME:/usr
Using CLASSPATH:   
/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar
Tomcat started.

# ps -aef | grep java
root  8598 1 50 23:17 pts/000:00:02 /usr/bin/java 
-Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties 
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 
-Djdk.tls.ephemeralDHKeySize=2048 
-Djava.protocol.handler.pkgs=org.apache.catalina.webresources 
-Dorg.apache.catalina.security.SecurityListener.UMASK=0027 
-Dignore.endorsed.dirs= -classpath 
/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/tomcat-juli.jar 
-Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat 
-Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start

And it stays running until I explicitly shut it down.  However, what is most 
odd is that I also have tomcat 8.5 running on a DIFFERENT system, which was 
built with a generic CentOS 7.5 download (vs. an Amazon Linux 2 EC2 server), 
but USING THE SAME SERVICE FILE.  I was under the impression that the Amazon 
Linux 2 is based on CentOS 7.

Or, at least I can’t find the difference.  And while Google’ing around, I did 
find other mentions of the exact same problem, whereby tomcat tries to 
immediately shut down after starting up, but alas without a posted solution.  I 
was wondering if anyone out there might have come across this problem, and have 
any advice?

Also, the one difference was that on CentOS 7 — which works — I am using Oracle 
Java 8 java installed on /opt/java, and on AWS — which does not work — I was 
using OpenJDK 8.  However, I have also tried installing the same Oracle Java 8 
on Amazon Linux 2 in /opt/java, and then changing:

Environment="JAVA_HOME=/opt/java“

and have the exact same problem.  So I am running out of things to try!

Actually, one other minor difference is that the CentOS 7.5 server has tomcat 
8.5.34 and the AWS server has tomcat 8.5.37, and I am assuming that the 
difference in patch level is not relevant, but am mentioning it nonetheless.

Finally, nothing else is currently running on port 

Re: context destroy method only be called once

2019-01-22 Thread Mark Thomas
On 22/01/2019 04:16, Aryeh Friedman wrote:
> Platform / tomcat version:  Tomcat 9.0.13 / FreeBSD 11.2-RELEASE (amd64)
> [from ports collection without modification]
> 
> I have 3 ServletContextListener concrete classes and on tomcat start all 3
> contextInitalized() methods are called, and complete,but on tomcat stop
> only one of the three contextDestroyed() methods completes though all are
> called.  Is this normal?  If so what is the right way to work around only
> one being able to complete?  If not where and how should I start debugging
> this?

What do you mean by "don't complete"? Are they blocked? Is an exception
thrown? Something else?

Generally, if the methods are called then Tomcat is doing the right
thing. If the methods don't complete normally that would usually
indicate an application issue.

Mark

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