Re: APR libs present but not found

2019-09-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

John,

On 9/10/19 14:20, John Beaulaurier -X (jbeaulau - ADVANCED NETWORK
INFORMATION INC at Cisco) wrote:
> I needed to build the APR libs from source as there was no rpm in 
> yum, but the default directory where the libs were place was not
> in the Java path, and so once I noticed that and added that
> directory to the path in setenv.sh APR is found and used.
AFAIK, all yum repos contain a package for libapr. You should not have
had to build from source. Actually, most repos also include a package
for libtcnative, so you can probably avoid building anything yourself.

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl16hmAACgkQHPApP6U8
pFi/MQ//Q4bIF4pXYXiBSuqhptVrKli7JNZn9i4frW0ldK60e/0IowgLC36Ji9y0
bcohhinKy/Oq/Y/Buvr8LWyb4yDeS6uk8pcKbC54+Jd7BcUFI1X1qcftobpwnU0b
4B7ooMiNHAEudNiZN/FGGgXzyEVEIDtTQa6745DLDVT94kXpegCyb7qCVE6K2IgY
eiwGMyPCNuGXNBN0emByWGSuy5W0FVsB/cTgdlnJrZZeX7CP9mgHnJ9kE0BQPy81
PO43go/4n+AQargnzdbzwGuVFB4k1AD4Q4l0JpdhBi+RiqrjGGbUBetTSQ+I55D1
tDw9fHjhBZrRSRfcT0AMc5MZQL3KS72mbPKrUNfZ5QxoltVv+1SfYOAt19D1T9Zd
qcyJ6v9gTluuioxyQpIUPW7IQ5b+iFe6X/GI7nQUQh+U4gdOhxbQiZvw8rx1CCpO
ADbXHBNGBc1E5s6optR9ad39xEujA+2O4zqVG8pwjSZ65ZBVyfrCg5LfCR81wdCg
Su1K0n+r2y1QlOAABp50IjiEpIr7fmYqVGI+K74KvPmp8yC37KFI6+XkgOu6cEQr
ebQcWjBuYir+TpCkZz+KBWpJ5QVM7TlDQTGFy5qOOyCitOHiEW7XAscc4w34+H5Q
Pa26jNO8LWC/9fH+ckj0PmMdslojM3MXJwn/hKkOoky0cBHZfBQ=
=SuNP
-END PGP SIGNATURE-

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



Re: Embedded Tomcat server starts but unable to connect via browser on mobile phone.

2019-09-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Linus,

On 9/12/19 09:33, LINUS FERNANDES wrote:
> I have set up an embedded Tomcat server program on Arch Linux on
> Termux using OpenJDK version 12.

What version of Tomcat?

> However, I am unable to connect to the server using the browser.
> The same WAR file with a web.xml works fine on Jetty.
> 
> Could you point me in the right direction?

You are probably missing a call to Tomcat.getConnector() to create a
default connector.

https://stackoverflow.com/questions/48998387/code-works-with-embedded-ap
ache-tomcat-8-but-not-with-9-whats-changed/49011424#49011424

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl16hfgACgkQHPApP6U8
pFjUshAAhft5Xl8JHEn1mR//jMUIczh6IwLzytyXFV4XahSFXxsKDSP2YdIJT0Pi
OeWckF+toejXvlpZ8D2tNjqJeyMJwAijVn9EqVacz/uxXmXCpXUAAfBqqwwwVCwg
uzhWwf1E7CFtXL+jG9YtEcoRWKxXbL2Jsr3zNW1jPlMH/3vdi3jgUtidshn4iovG
q99JUNrMIfHVDafd9n6KDR3jzVBMUBrMHy2nO3G9bw2wVeaFHXv2rgXT5hzTe8oD
w5O3DztKnEIY6LhKILmkrDRBFs6zT1oUX5XDdQmtpzoFfzDzvP6I0EhoUr8aLhOi
f8W35Y1R0gAd0XG1KhwNlNXXwVtKztYGVAtwkhvzwTt5XCM2nDjRt4wpakw5XkoX
VBJBrhn0X5D/iICrU0TbnJqHwfmoTpwji0ISTfVSCzmy2V36sfVE0ud/DhlxIEhO
CWBTpsYlBrRs2/kpeskqzsDQ/XxdVU6vZ34YfbYmJHdK3UBkCeo8wdK4CgrN4pTb
7pyY0u9tNZPMnpkyaPtauB2GSlMGdEGRHtIOXZpJU0mUmvQ5OAXGprAFnx6Vif2I
TL+GWFv/yLn8AVB/Jp2wRDeplCmz6Qt2aoaH+KpfDC7vvNC3F+OtOdLVsH9ipPEV
lXH1C2xtFaUuNqi/Q+a0Qj3HGgwTSYc0TjB6oRXDiuAutSQL2DI=
=MBh6
-END PGP SIGNATURE-

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



Re: Tomcat sets `Content-Length: 0` for 304 responses on HTTP/2

2019-09-12 Thread Mark Thomas
On 12/09/2019 16:34, Boris Petrov wrote:
> Hi,
> 
> Thanks for the response.
> 
> About the first issue - I opened this issue for it:
> 
> https://bz.apache.org/bugzilla/show_bug.cgi?id=63710

Fell free to re-open that issue and add the additional info.

> However I now see that I didn't specify that it was specifically on
> HTTP/2. Sorry about that.
> 
> About the second issue - you're right, it is our fault, we've configured
> Gradle to put such a timestamp. Thanks for the support!
> 
> Is the fix for issue 1 going to be in 9.0.25?

I don't see any reason why not at this point.

Mark


> 
> Thanks again,
> 
> Boris
> 
> On 9/12/19 6:21 PM, Mark Thomas wrote:
>> On September 12, 2019 2:19:30 PM UTC, Boris Petrov  
>> wrote:
>>> Hi,
>>>
>>> I have two issues with the "default" Tomcat configuration (the only
>>> thing I've changed from it is that I've added an `UpgradeProtocol`
>>> directive and SSL certificates). Tomcat version is 9.0.24.
>>>
>>> The first one is the one I've written in the subject - for all 304
>>> responses Tomcat is adding a `Content-Length: 0` header. This happens
>>> only on HTTP/2. Any suggestions how to debug this are appreciated.
>> That looks like a Tomcat bug. The flow for HTTP/2 is different to HTTP/1.1 
>> and it looks like we missed a check.
>>
>>> The second issue is that Tomcat sets the same ETag header for a static
>>> file that changes between updates of my WAR. That is, I have a file
>>> called `git-revision.json` in which there is the build-date and the
>>> revision-number of the application. This file changes with every new
>>> release of our WAR. Note that the length of the file is always the
>>> same.
>>> And Tomcat *ALWAYS* puts the same ETag header for it -
>>> `W/"89-31820400"` (89 is the file length, not sure about the rest).
>> It is the last modified timestamp.
>>
>>> Why is Tomcat not changing the ETag header? This breaks for clients
>>> which have already loaded it and don't get the new version because 304
>>> is returned.
>> If the file contents changes the expectation is that the timestamp changes 
>> too.
>>
>> Mark
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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



Re: Tomcat sets `Content-Length: 0` for 304 responses on HTTP/2

2019-09-12 Thread Boris Petrov
Hi,

Thanks for the response.

About the first issue - I opened this issue for it:

https://bz.apache.org/bugzilla/show_bug.cgi?id=63710

However I now see that I didn't specify that it was specifically on
HTTP/2. Sorry about that.

About the second issue - you're right, it is our fault, we've configured
Gradle to put such a timestamp. Thanks for the support!

Is the fix for issue 1 going to be in 9.0.25?

Thanks again,

Boris

On 9/12/19 6:21 PM, Mark Thomas wrote:
> On September 12, 2019 2:19:30 PM UTC, Boris Petrov  
> wrote:
>> Hi,
>>
>> I have two issues with the "default" Tomcat configuration (the only
>> thing I've changed from it is that I've added an `UpgradeProtocol`
>> directive and SSL certificates). Tomcat version is 9.0.24.
>>
>> The first one is the one I've written in the subject - for all 304
>> responses Tomcat is adding a `Content-Length: 0` header. This happens
>> only on HTTP/2. Any suggestions how to debug this are appreciated.
> That looks like a Tomcat bug. The flow for HTTP/2 is different to HTTP/1.1 
> and it looks like we missed a check.
>
>> The second issue is that Tomcat sets the same ETag header for a static
>> file that changes between updates of my WAR. That is, I have a file
>> called `git-revision.json` in which there is the build-date and the
>> revision-number of the application. This file changes with every new
>> release of our WAR. Note that the length of the file is always the
>> same.
>> And Tomcat *ALWAYS* puts the same ETag header for it -
>> `W/"89-31820400"` (89 is the file length, not sure about the rest).
> It is the last modified timestamp.
>
>> Why is Tomcat not changing the ETag header? This breaks for clients
>> which have already loaded it and don't get the new version because 304
>> is returned.
> If the file contents changes the expectation is that the timestamp changes 
> too.
>
> Mark
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

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



Re: Tomcat sets `Content-Length: 0` for 304 responses on HTTP/2

2019-09-12 Thread Mark Thomas
On September 12, 2019 2:19:30 PM UTC, Boris Petrov  
wrote:
>Hi,
>
>I have two issues with the "default" Tomcat configuration (the only
>thing I've changed from it is that I've added an `UpgradeProtocol`
>directive and SSL certificates). Tomcat version is 9.0.24.
>
>The first one is the one I've written in the subject - for all 304
>responses Tomcat is adding a `Content-Length: 0` header. This happens
>only on HTTP/2. Any suggestions how to debug this are appreciated.

That looks like a Tomcat bug. The flow for HTTP/2 is different to HTTP/1.1 and 
it looks like we missed a check.

>The second issue is that Tomcat sets the same ETag header for a static
>file that changes between updates of my WAR. That is, I have a file
>called `git-revision.json` in which there is the build-date and the
>revision-number of the application. This file changes with every new
>release of our WAR. Note that the length of the file is always the
>same.
>And Tomcat *ALWAYS* puts the same ETag header for it -
>`W/"89-31820400"` (89 is the file length, not sure about the rest).

It is the last modified timestamp.

>Why is Tomcat not changing the ETag header? This breaks for clients
>which have already loaded it and don't get the new version because 304
>is returned.

If the file contents changes the expectation is that the timestamp changes too.

Mark

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



Tomcat sets `Content-Length: 0` for 304 responses on HTTP/2

2019-09-12 Thread Boris Petrov
Hi,

I have two issues with the "default" Tomcat configuration (the only
thing I've changed from it is that I've added an `UpgradeProtocol`
directive and SSL certificates). Tomcat version is 9.0.24.

The first one is the one I've written in the subject - for all 304
responses Tomcat is adding a `Content-Length: 0` header. This happens
only on HTTP/2. Any suggestions how to debug this are appreciated.

The second issue is that Tomcat sets the same ETag header for a static
file that changes between updates of my WAR. That is, I have a file
called `git-revision.json` in which there is the build-date and the
revision-number of the application. This file changes with every new
release of our WAR. Note that the length of the file is always the same.
And Tomcat *ALWAYS* puts the same ETag header for it -
`W/"89-31820400"` (89 is the file length, not sure about the rest).
Why is Tomcat not changing the ETag header? This breaks for clients
which have already loaded it and don't get the new version because 304
is returned.

Thanks in advance,

Boris Petrov


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



Embedded Tomcat server starts but unable to connect via browser on mobile phone.

2019-09-12 Thread LINUS FERNANDES
I have set up an embedded Tomcat server program on Arch Linux on Termux
using OpenJDK version 12.

However, I am unable to connect to the server using the browser. The same
WAR file with a web.xml works fine on Jetty.

Could you point me in the right direction?

The Java class is as follows:

package launch;

import java.text.MessageFormat;
import java.util.logging.Logger;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.WebResourceRoot;
import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.webresources.DirResourceSet;
import org.apache.catalina.webresources.StandardRoot;

@SuppressWarnings("PMD.ShortClassName")
public final class Main {
  private static final Logger LOGGER =
Logger.getLogger(Main.class.getName());
  private static final String WORKING_DIR =
  System.getProperty("java.io.tmpdir") + "/webapps";

  private Main() {
throw new IllegalStateException("Private constructor");
  }

  public static void main(String[] args) {
try {

  Tomcat tomcat = new Tomcat();

  // The port that we should run on can be set into an environment
variable
  // Look for that variable and default to 8080 if it isn't there.
  String webPort = System.getenv("PORT");
  if (webPort == null || webPort.isEmpty()) {
webPort = "8080";
  }
  System.out.println(webPort);
  tomcat.setSilent(false);
  tomcat.setPort(Integer.valueOf(webPort));
  tomcat.setBaseDir(WORKING_DIR);
  tomcat.getHost().setAppBase(WORKING_DIR);
  tomcat.getHost().setAutoDeploy(true);
  tomcat.getHost().setDeployOnStartup(true);


  System.out.println(System.getProperty("catalina.home"));
  System.out.println(System.getProperty("catalina.base"));

  String userDir = System.getProperty("user.dir");
  String webappDirLocation = userDir + "/dist/Webapps-2.0.0.war";


tomcat.getHost().getAppBaseFile().mkdir();
  // Ensure that the webapps directory exists

  Context appContext =
  tomcat.addWebapp(tomcat.getHost(), "/Webapp", webappDirLocation);
  appContext.setParentClassLoader(
  Thread.currentThread().getContextClassLoader());
  WebResourceRoot resources = new StandardRoot(appContext);
  resources.addPreResources(
  new DirResourceSet(resources, "/WEB-INF/classes", "", "/"));
  appContext.setResources(resources);
  tomcat.start();
  LOGGER.info(() -> {
return MessageFormat.format("Deployed {0} as {1}",
appContext.getBaseName(),
appContext.getBaseName());
  });
  tomcat.getServer().await();
} catch (LifecycleException lce) {
  System.err.println(lce);
}
  }
}

The web.xml is as follows. It's probably irrelevant.


http://java.sun.com/xml/ns/javaee "
 xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "
 xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd "
 version="3.0">
  
FirstServlet
servlets.FirstServlet
  
  
DbServlet
servlets.DbServlet
  
  
GetPreferences
servlets.GetPreferences
  
  
Checkout
servlets.Checkout
  
  
AdderServlet
servlets.AdderServlet
  
  
PersonalServlet
servlets.PersonalServlet
  
  
Selection
servlets.Selection
  
  
ShowSum
servlets.ShowSum
  
  
Weight
servlets.Weight
  
  
FirstServlet
/FirstServlet
  
  
Checkout
/Checkout
  
  
DbServlet
/DbServlet
  
  
PersonalServlet
/PersonalServlet
  
  
AdderServlet
/AdderServlet
  
  
GetPreferences
/GetPreferences
  
  
Selection
/Selection
  
  
ShowSum
/ShowSum
  
  
Weight
/Weight
  
  
index.html
  


The project is hosted at
https://github.com/Fernal73/LearnJava/tree/master/Webapps

Regards,
Linus Fernandes.