You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Martin Grigorov <mg...@apache.org> on 2015/11/15 12:54:06 UTC

Issues when building Tomcat 9 + tcnative

Hi devs,

I'm trying to build 9.0.0.M1 from sources to test the HTTP2 functionalities.
I haven't built Tomcat + tcnative before so I may be doing something
wrong...

I run Ubuntu 15.10 here.

Running just 'ant' downloads tomcat-native.tar.gz (1.2.2) to base.path.
But this file is just copied in ./output/build/bin/, it is not untar-ed.

So I've checked in build.xml and saw that at line 1927 it copies the .dll
files, as part of "dist-static" target. Executing "ant dist-target" leads
to:

1) trydownload:
      [get] Getting:
http://www.apache.org/dist/tomcat/tomcat-connectors/native/1.2.2/binaries/tomcat-native-1.2.2-win32-bin.zip

and

testexist:
     [echo] Testing  for /tmp/tc9/commons-daemon-1.0.15/windows/prunmgr.exe

and

trydownload:
      [get] Getting:
http://www.apache.org/dist/commons/daemon/binaries/windows/commons-daemon-1.0.15-bin-windows-signed.zip
      [get] To: /tmp/tc9/download-530232362.zip

and the same for makensis.exe

Why win32 ?!
Later I see the Unix versions being downloaded too, so maybe it just
download everything and then decides which ones to actually use. Not a big
issue.


2) at step "extras-commons-logging" it fails with:

extras-commons-logging:
   [gunzip] Expanding
/tmp/tc9/commons-logging-1.1.3/commons-logging-1.1.3-src.tar.gz to
/tmp/tc9/apache-tomcat-9.0.0.M1-src/output/extras/logging/commons-logging-src.tar
    [untar] Expanding:
/tmp/tc9/apache-tomcat-9.0.0.M1-src/output/extras/logging/commons-logging-src.tar
into /tmp/tc9/apache-tomcat-9.0.0.M1-src/output/extras/logging

BUILD FAILED
/tmp/tc9/apache-tomcat-9.0.0.M1-src/build.xml:1651: Error while expanding
/tmp/tc9/apache-tomcat-9.0.0.M1-src/output/extras/logging/commons-logging-src.tar
java.io.IOException: Error detected parsing the header
at org.apache.tools.tar.TarInputStream.getNextEntry(TarInputStream.java:292)
at org.apache.tools.ant.taskdefs.Untar.expandStream(Untar.java:165)
at org.apache.tools.ant.taskdefs.Untar.expandFile(Untar.java:114)
at org.apache.tools.ant.taskdefs.Expand.execute(Expand.java:132)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.IllegalArgumentException: Invalid byte 32 at offset 7
in '       {NUL}' len=8
at org.apache.tools.tar.TarUtils.parseOctal(TarUtils.java:134)
at org.apache.tools.tar.TarUtils.parseOctalOrBinary(TarUtils.java:172)
at org.apache.tools.tar.TarEntry.parseTarHeader(TarEntry.java:912)
at org.apache.tools.tar.TarEntry.parseTarHeader(TarEntry.java:899)
at org.apache.tools.tar.TarEntry.<init>(TarEntry.java:323)
at org.apache.tools.tar.TarInputStream.getNextEntry(TarInputStream.java:290)
... 19 more


$ tar xvf commons-logging-src.tar
works just fine, but it seems the Java library used for untar-ing doesn't
like the content

I'll try with apache-tomcat-9.0.0.M1.tar.gz  +
http://tomcat.apache.org/native-doc/ (configure+make)


Cheers
Martin

Re: Issues when building Tomcat 9 + tcnative

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Nov 15, 2015 at 1:35 PM, Mark Thomas <ma...@apache.org> wrote:

> On 15/11/2015 11:54, Martin Grigorov wrote:
>
> <snip/>
>
> > Running just 'ant' downloads tomcat-native.tar.gz (1.2.2) to base.path.
> > But this file is just copied in ./output/build/bin/, it is not untar-ed.
>
> Correct. The source ships in that directory for the Tomcat .tar.gz
> distro. Users of that distro are expected to build tc-native themselves.
>
> > So I've checked in build.xml and saw that at line 1927 it copies the .dll
> > files, as part of "dist-static" target. Executing "ant dist-target" leads
> > to:
> <snip/>
> > Why win32 ?!
> > Later I see the Unix versions being downloaded too, so maybe it just
> > download everything and then decides which ones to actually use. Not a
> big
> > issue.
>
> Because the Tomcat binary distros for Windows ship with the pre-built
> tc-native binaries.
>
> > 2) at step "extras-commons-logging" it fails with:
>
> Looks like you are using a version of Ant with known issues.
>
> Mark
>

I was using Ant 1.9.4. Upgraded it to 1.9.6 and the problem is gone!

Thanks!


>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: Issues when building Tomcat 9 + tcnative

Posted by Mark Thomas <ma...@apache.org>.
On 15/11/2015 11:54, Martin Grigorov wrote:

<snip/>

> Running just 'ant' downloads tomcat-native.tar.gz (1.2.2) to base.path.
> But this file is just copied in ./output/build/bin/, it is not untar-ed.

Correct. The source ships in that directory for the Tomcat .tar.gz
distro. Users of that distro are expected to build tc-native themselves.

> So I've checked in build.xml and saw that at line 1927 it copies the .dll
> files, as part of "dist-static" target. Executing "ant dist-target" leads
> to:
<snip/>
> Why win32 ?!
> Later I see the Unix versions being downloaded too, so maybe it just
> download everything and then decides which ones to actually use. Not a big
> issue.

Because the Tomcat binary distros for Windows ship with the pre-built
tc-native binaries.

> 2) at step "extras-commons-logging" it fails with:

Looks like you are using a version of Ant with known issues.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Issues when building Tomcat 9 + tcnative

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Nov 15, 2015 at 3:10 PM, Rainer Jung <ra...@kippdata.de>
wrote:

> Am 15.11.2015 um 13:59 schrieb Martin Grigorov:
>
>> On Sun, Nov 15, 2015 at 1:35 PM, Martin Grigorov <mg...@apache.org>
>> wrote:
>>
>
> To setup HTTP2 I follow the steps done by Konstantin Kolinko at
>> https://bz.apache.org/bugzilla/show_bug.cgi?id=58605
>> But here it fails with:
>>
>> 15-Nov-2015 13:40:37.505 INFO [main]
>> org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR
>> based Apache Tomcat Native library 1.2.2 using APR version 1.5.2.
>> 15-Nov-2015 13:40:37.506 INFO [main]
>> org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR
>> capabilities: IPv6 [true], sendfile [true], accept filters [false], random
>> [true].
>> 15-Nov-2015 13:40:37.508 INFO [main]
>> org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL
>> successfully initialized (OpenSSL 1.0.2d 9 Jul 2015)
>> 15-Nov-2015 13:40:37.612 INFO [main]
>> org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
>> ["http-apr-8080"]
>> 15-Nov-2015 13:40:37.619 INFO [main]
>> org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol
>> The ["https-apr-8443"] connector has been configured to support
>> negotiation
>> to [h2] via ALPN
>> 15-Nov-2015 13:40:37.620 INFO [main]
>> org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
>> ["https-apr-8443"]
>> 15-Nov-2015 13:40:37.622 SEVERE [main]
>> org.apache.coyote.AbstractProtocol.init Failed to initialize end point
>> associated with ProtocolHandler ["https-apr-8443"]
>>   java.lang.Exception: Unable to load certificate key
>> /tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem (error:0906D06C:PEM
>> routines:PEM_read_bio:no start line)
>>          at org.apache.tomcat.jni.SSLContext.setCertificate(Native Method)
>>
> ...
>
> The connector config is:
>> <Connector port="8443"
>> protocol="org.apache.coyote.http11.Http11AprProtocol" maxThreads="150"
>> SSLEnabled="true" >
>>          <UpgradeProtocol
>> className="org.apache.coyote.http2.Http2Protocol"
>> />
>>          <SSLHostConfig honorCipherOrder="false" >
>>              <Certificate certificateKeyFile="conf/localhost-key.pem"
>>                           certificateFile="conf/localhost-cert.pem"
>>                           type="RSA" />
>>          </SSLHostConfig>
>>      </Connector>
>>
>> Ideas what could be wrong ?
>>
>
> Shooting from the hip:
>
> /tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem (error:0906D06C:PEM
> routines:PEM_read_bio:no start line)
>
> sounds like the key file is not in valid PEM format, ie. it doesn't start
> with a
>
> -----BEGIN RSA PRIVATE KEY-----
>

Thanks, Rainer!
Somehow I messed up my Tomcat SVN working dir here and both
localhost-cert.pem and localhost-key.pem had the same content!
svn revert + copy again the -key.pem file to conf/ fixed the issue!


> line. Could you check, what the format of that file is?
>
> You can also use the openssl command from the same openssl installation
> that was used to build your tcnative and read the key file contents using
> it:
>
> /path/to/openssl rsa -inform pem -in
> /tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem -text
>
> Finally, could it be, that your Tomcat runtime user can not read the file?
>
> Regards,
>
> Rainer



Overall everything looks good now!
Tomcat default apps run OK. Both Firefox and Google Chrome report H2.

It is just my own application that doesn't work in HTTP2 mode.
http://localhost:8080/wicket-websocket/ works fine
But https://localhost:8443/wicket-websocket/ redirects immediately with 302
to http://localhost/wicket-websocket/ (and Tomcat is not responsible for
port 80 here)
I've changed the name of the app (i.e. the .war) but it behaves the same
way. I'll try to debug it.



>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

Re: Issues when building Tomcat 9 + tcnative

Posted by Rainer Jung <ra...@kippdata.de>.
Am 15.11.2015 um 13:59 schrieb Martin Grigorov:
> On Sun, Nov 15, 2015 at 1:35 PM, Martin Grigorov <mg...@apache.org>
> wrote:

> To setup HTTP2 I follow the steps done by Konstantin Kolinko at
> https://bz.apache.org/bugzilla/show_bug.cgi?id=58605
> But here it fails with:
>
> 15-Nov-2015 13:40:37.505 INFO [main]
> org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR
> based Apache Tomcat Native library 1.2.2 using APR version 1.5.2.
> 15-Nov-2015 13:40:37.506 INFO [main]
> org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR
> capabilities: IPv6 [true], sendfile [true], accept filters [false], random
> [true].
> 15-Nov-2015 13:40:37.508 INFO [main]
> org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL
> successfully initialized (OpenSSL 1.0.2d 9 Jul 2015)
> 15-Nov-2015 13:40:37.612 INFO [main]
> org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
> ["http-apr-8080"]
> 15-Nov-2015 13:40:37.619 INFO [main]
> org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol
> The ["https-apr-8443"] connector has been configured to support negotiation
> to [h2] via ALPN
> 15-Nov-2015 13:40:37.620 INFO [main]
> org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
> ["https-apr-8443"]
> 15-Nov-2015 13:40:37.622 SEVERE [main]
> org.apache.coyote.AbstractProtocol.init Failed to initialize end point
> associated with ProtocolHandler ["https-apr-8443"]
>   java.lang.Exception: Unable to load certificate key
> /tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem (error:0906D06C:PEM
> routines:PEM_read_bio:no start line)
>          at org.apache.tomcat.jni.SSLContext.setCertificate(Native Method)
...

> The connector config is:
> <Connector port="8443"
> protocol="org.apache.coyote.http11.Http11AprProtocol" maxThreads="150"
> SSLEnabled="true" >
>          <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"
> />
>          <SSLHostConfig honorCipherOrder="false" >
>              <Certificate certificateKeyFile="conf/localhost-key.pem"
>                           certificateFile="conf/localhost-cert.pem"
>                           type="RSA" />
>          </SSLHostConfig>
>      </Connector>
>
> Ideas what could be wrong ?

Shooting from the hip:

/tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem 
(error:0906D06C:PEM routines:PEM_read_bio:no start line)

sounds like the key file is not in valid PEM format, ie. it doesn't 
start with a

-----BEGIN RSA PRIVATE KEY-----

line. Could you check, what the format of that file is?

You can also use the openssl command from the same openssl installation 
that was used to build your tcnative and read the key file contents 
using it:

/path/to/openssl rsa -inform pem -in 
/tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem -text

Finally, could it be, that your Tomcat runtime user can not read the file?

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: Issues when building Tomcat 9 + tcnative

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Nov 15, 2015 at 1:35 PM, Martin Grigorov <mg...@apache.org>
wrote:

>
> On Sun, Nov 15, 2015 at 12:54 PM, Martin Grigorov <mg...@apache.org>
> wrote:
>
>>
>> So I've checked in build.xml and saw that at line 1927 it copies the .dll
>> files, as part of "dist-static" target. Executing "ant dist-target" leads
>> to:
>>
>
> Uh. Of course ".dll" means that it will deal with Windows stuff...
>
>
> I have the natives properly set up! Now I'll test the HTTP2 connector.
>
>
To setup HTTP2 I follow the steps done by Konstantin Kolinko at
https://bz.apache.org/bugzilla/show_bug.cgi?id=58605
But here it fails with:

15-Nov-2015 13:40:37.505 INFO [main]
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent Loaded APR
based Apache Tomcat Native library 1.2.2 using APR version 1.5.2.
15-Nov-2015 13:40:37.506 INFO [main]
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent APR
capabilities: IPv6 [true], sendfile [true], accept filters [false], random
[true].
15-Nov-2015 13:40:37.508 INFO [main]
org.apache.catalina.core.AprLifecycleListener.initializeSSL OpenSSL
successfully initialized (OpenSSL 1.0.2d 9 Jul 2015)
15-Nov-2015 13:40:37.612 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
["http-apr-8080"]
15-Nov-2015 13:40:37.619 INFO [main]
org.apache.coyote.http11.AbstractHttp11Protocol.configureUpgradeProtocol
The ["https-apr-8443"] connector has been configured to support negotiation
to [h2] via ALPN
15-Nov-2015 13:40:37.620 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
["https-apr-8443"]
15-Nov-2015 13:40:37.622 SEVERE [main]
org.apache.coyote.AbstractProtocol.init Failed to initialize end point
associated with ProtocolHandler ["https-apr-8443"]
 java.lang.Exception: Unable to load certificate key
/tmp/tc9/apache-tomcat-9.0.0.M1/conf/localhost-key.pem (error:0906D06C:PEM
routines:PEM_read_bio:no start line)
        at org.apache.tomcat.jni.SSLContext.setCertificate(Native Method)
        at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:487)
        at
org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:790)
        at
org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:544)
        at
org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:67)
        at
org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
        at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        at
org.apache.catalina.core.StandardService.initInternal(StandardService.java:569)
        at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        at
org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851)
        at
org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:600)
        at org.apache.catalina.startup.Catalina.load(Catalina.java:623)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)

The connector config is:
<Connector port="8443"
protocol="org.apache.coyote.http11.Http11AprProtocol" maxThreads="150"
SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"
/>
        <SSLHostConfig honorCipherOrder="false" >
            <Certificate certificateKeyFile="conf/localhost-key.pem"
                         certificateFile="conf/localhost-cert.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>

Ideas what could be wrong ?

Martin

Re: Issues when building Tomcat 9 + tcnative

Posted by Martin Grigorov <mg...@apache.org>.
On Sun, Nov 15, 2015 at 12:54 PM, Martin Grigorov <mg...@apache.org>
wrote:

>
> So I've checked in build.xml and saw that at line 1927 it copies the .dll
> files, as part of "dist-static" target. Executing "ant dist-target" leads
> to:
>

Uh. Of course ".dll" means that it will deal with Windows stuff...


I have the natives properly set up! Now I'll test the HTTP2 connector.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov