Re: Tomcat and NGINX ip forwarding

2019-09-01 Thread Sean Dawson
That seems to have worked - thanks!


On Sun, Sep 1, 2019 at 2:05 PM Mark Thomas  wrote:

> On September 1, 2019 2:52:36 PM UTC, Sean Dawson 
> wrote:
> >Hello, I'm trying to get the actual client IP address in the Tomcat
> >access
> >logs rather than the 127.0.0.1 that's coming from nginx.
> >
> >CentOS 7.6 (on AWS)
> >Amazon Coretto 1.8.0_222.b10-1.x86_64
> >Tomcat 8.5.45.0 (extracted from tar.gz)
> >Nginx 1.12.2 (very basic setup)
> >
> >http (80) / https (443) to nginx
> >Tomcat running on 8080
> >
> >localhost_access_log shows all requests coming from ip: 127.0.0.1
> >
> >How do I get it to show the real IP address coming in through nginx ?
> >
> >I've tried various combinations of these - and others (and in various
> >sections of the nginx.conf)...
> >
> >proxy_set_header Host $host;
> >proxy_set_header X-Real-IP $remote_addr;
> >proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> >
> >I've tried adding this to Tomcat server.xml (in the Engine section):
> >
> > >internalProxies="127\.0\.[0-1]\.1"
> >remoteIpHeader="x-forwarded-for"
> >requestAttributesEnabled="true"
> >protocolHeader="x-forwarded-proto"
> >protocolHeaderHttpsValue="https"/>
> >
> >(As well as trying changing https to http.)
> >
> >I've also tried modifying this based on something I found online but it
> >didn't help:
> >
> >  >directory="logs"
> >   prefix="localhost_access_log" suffix=".txt"
> >   pattern="%h %l %u %t %r %s %b" />
>
> The remote ip valve looks ok.
>
> Use the default access log valve but add requestAttributesEnabled="true"
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Apache Tomcat 9.0 start error 1067 (3)

2019-09-01 Thread Lars E. Andersen
Hello Mark

The release text file states:
JAVA_VERSION="1.8.0_111"

Kind Regards

Lars E. Andersen


Den søn. 1. sep. 2019 kl. 20.46 skrev Lars E. Andersen :

> Hello Mark
>
> My java version is "jdk-8u111-nb-8_2-windows-x64", it was installed on the
> 25.3.2019.
> I do not know if, it has been updated afterwards.
>
> Kind Regards
>
> Lars E. Andersen
>
>
> Den søn. 1. sep. 2019 kl. 20.21 skrev Mark Thomas :
>
>> On 01/09/2019 20:14, Lars E. Andersen wrote:
>> > Hello Tomcat Users
>> >
>> > I have a start up error on my newly installed Tomcat 9.0, the error
>> > information is:
>> >
>> > Windows could not start Apache Tomcat 9.0 Tomcat9 service on
>> > Local Computer.
>> >
>> > Error 1067: The process terminated unexpectedly.
>> >
>> >
>> > My Tomcat version:
>> > Apache-tomcat-9.0.24
>> >
>> > My computer runs:
>> > Windows 10 Home x64, Version 1903, OS build 18362.295
>> >
>> > I hope you can help me to solve this problem.
>>
>> (Exact) Java version?
>>
>> Mark
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
>>


Apache Tomcat 9.0 start error 1067 (2)

2019-09-01 Thread Lars E. Andersen
Hello Mark

My java version is "jdk-8u111-nb-8_2-windows-x64", it was installed on the
25.3.2019.
I do not know if, it has been updated afterwards.

Kind Regards

Lars E. Andersen


Den søn. 1. sep. 2019 kl. 20.21 skrev Mark Thomas :

> On 01/09/2019 20:14, Lars E. Andersen wrote:
> > Hello Tomcat Users
> >
> > I have a start up error on my newly installed Tomcat 9.0, the error
> > information is:
> >
> > Windows could not start Apache Tomcat 9.0 Tomcat9 service on
> > Local Computer.
> >
> > Error 1067: The process terminated unexpectedly.
> >
> >
> > My Tomcat version:
> > Apache-tomcat-9.0.24
> >
> > My computer runs:
> > Windows 10 Home x64, Version 1903, OS build 18362.295
> >
> > I hope you can help me to solve this problem.
>
> (Exact) Java version?
>
> Mark
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>


Re: Apache Tomcat 9.0 start error 1067

2019-09-01 Thread Mark Thomas
On 01/09/2019 20:14, Lars E. Andersen wrote:
> Hello Tomcat Users
> 
> I have a start up error on my newly installed Tomcat 9.0, the error
> information is:
> 
> Windows could not start Apache Tomcat 9.0 Tomcat9 service on
> Local Computer.
> 
> Error 1067: The process terminated unexpectedly.
> 
> 
> My Tomcat version:
> Apache-tomcat-9.0.24
> 
> My computer runs:
> Windows 10 Home x64, Version 1903, OS build 18362.295
> 
> I hope you can help me to solve this problem.

(Exact) Java version?

Mark


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



Re: Tomcat and NGINX ip forwarding

2019-09-01 Thread Mark Thomas
On September 1, 2019 2:52:36 PM UTC, Sean Dawson  
wrote:
>Hello, I'm trying to get the actual client IP address in the Tomcat
>access
>logs rather than the 127.0.0.1 that's coming from nginx.
>
>CentOS 7.6 (on AWS)
>Amazon Coretto 1.8.0_222.b10-1.x86_64
>Tomcat 8.5.45.0 (extracted from tar.gz)
>Nginx 1.12.2 (very basic setup)
>
>http (80) / https (443) to nginx
>Tomcat running on 8080
>
>localhost_access_log shows all requests coming from ip: 127.0.0.1
>
>How do I get it to show the real IP address coming in through nginx ?
>
>I've tried various combinations of these - and others (and in various
>sections of the nginx.conf)...
>
>proxy_set_header Host $host;
>proxy_set_header X-Real-IP $remote_addr;
>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
>
>I've tried adding this to Tomcat server.xml (in the Engine section):
>
>internalProxies="127\.0\.[0-1]\.1"
>remoteIpHeader="x-forwarded-for"
>requestAttributesEnabled="true"
>protocolHeader="x-forwarded-proto"
>protocolHeaderHttpsValue="https"/>
>
>(As well as trying changing https to http.)
>
>I've also tried modifying this based on something I found online but it
>didn't help:
>
> directory="logs"
>   prefix="localhost_access_log" suffix=".txt"
>   pattern="%h %l %u %t %r %s %b" />

The remote ip valve looks ok.

Use the default access log valve but add requestAttributesEnabled="true"

Mark

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



Apache Tomcat 9.0 start error 1067

2019-09-01 Thread Lars E. Andersen
Hello Tomcat Users

I have a start up error on my newly installed Tomcat 9.0, the error
information is:

Windows could not start Apache Tomcat 9.0 Tomcat9 service on
Local Computer.

Error 1067: The process terminated unexpectedly.


My Tomcat version:
Apache-tomcat-9.0.24

My computer runs:
Windows 10 Home x64, Version 1903, OS build 18362.295

I hope you can help me to solve this problem.


Kind Regards

Lars E. Andersen
Lisbon Portugal

Email: lea4...@gmail.com


Tomcat and NGINX ip forwarding

2019-09-01 Thread Sean Dawson
Hello, I'm trying to get the actual client IP address in the Tomcat access
logs rather than the 127.0.0.1 that's coming from nginx.

CentOS 7.6 (on AWS)
Amazon Coretto 1.8.0_222.b10-1.x86_64
Tomcat 8.5.45.0 (extracted from tar.gz)
Nginx 1.12.2 (very basic setup)

http (80) / https (443) to nginx
Tomcat running on 8080

localhost_access_log shows all requests coming from ip: 127.0.0.1

How do I get it to show the real IP address coming in through nginx ?

I've tried various combinations of these - and others (and in various
sections of the nginx.conf)...

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

I've tried adding this to Tomcat server.xml (in the Engine section):



(As well as trying changing https to http.)

I've also tried modifying this based on something I found online but it
didn't help:

 

Thanks.


Re: Classloading issue on tomcat 8.5.40 on two identical machines

2019-09-01 Thread Mark Thomas
On August 31, 2019 8:31:30 PM UTC, Sagar Jadhav 
 wrote:
>Hi  I would like to seek some guidance on the issue we are facing in
>production. We got two new ubuntu 16 boxes and we are using tomcat
>8.5.40 for deploying java/spring apps (spring version 3.2 and some
>resteasy & jersey libs).Since some of it is a legacy codebase, we had
>to make sure everything works in the new tomcat 8.5.40 server
>(previously the code was deployed on tomcat6).We saw everything work as
>expected in our lower environments (which are also on ubuntu16) but
>started seeing some weird class loading issues ONLY on one machine but
>the other machine works fine. (we have some duplicate jars).Has anyone
>run to this issue and if so how did they solve it?Also has any one
>written a custom classloader and if they have how did they do it?
>Any help is deeply appreciated.
>thank youSagar Jadhav

You haven't told us what issue you are seeing. Without more information it is 
going to be very difficult to provide advice.

Mark

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



Re: Malformed chunked stream

2019-09-01 Thread Mark Thomas
On August 31, 2019 7:31:12 AM UTC, Dave Thorn  wrote:
>On Sat, Aug 31, 2019 at 05:13:06AM +, Mark Thomas wrote:
>> On August 30, 2019 8:34:02 PM UTC, Dave Thorn
> wrote:
>> >
>> >That looks, to me, like the stream is missing the [\r][\n] between
>the
>> >B50 chunk and the 3FC0 count.
>> >
>> >I'm not clear on where the responsibilities lie in producing that
>> >chunked output - Spring in my webapp, or Tomcat as my container?
>
>> I'd also recommend repeating your test with Wireshark to confirm
>> that the server doesn't send it and that you aren't seeing a client
>> side bug.
>
>Thanks.  The only problem with that is the intermittency of the
>problem.  The server processes a hundred thousand requests a day, or
>so, and the problem only occurs a scant handful of times in that.
>I'll talk to our admin and see how feasible it is to do that and still
>be able to process the results.

I was thinking run Wireshark on your client machine rather than the server.

>There is also a haproxy between client and server.  You wouldn't think
>it goes fiddling around in the middle of a response, thought.  I'm
>running some tests today that go straight to the server, skipping the
>proxy, but again with the intermittency...

Indeed. Chunking is sufficiently fundamental that I'm surprised that any 
component has a bug in this area.

>> I took a quick look at Tomcat's ChunkedOutputFilter and I don't see
>> any obvious way the \r\n could be skipped but a strange edge case
>> isn't impossible.
>
>Looking at my access log file for yesterday, the test scenario made
>5375 requests, and if I look for those in the log, they all have the
>same response size:
>
># cat /opt/apache-tomcat-8.5.8/logs/localhost_access_log.2019-08-30.txt
>| grep 'various-identifiers' | awk '{print $10}' | sort | uniq -c
>   5375 970304
>
>Could that suggest that Tomcat responded with the same response every
>time?  If it dropped a "[\r][\n]" then that response size should be
>different, shouldn't it?

I'd need to check that and I'm on my phone right now. I don't recall which byte 
count gets logged.

 > Although I suppose if it could be being
>corrupted by a bug then it might be possible that the response size is
>calculated in a way that isn't affected by that hypothetical bug?

That is certainly possible.

Mark

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