0

I am trying to get a standalone version of Undertow assembled, and I'm running into JAR dependency hell. I have finally arrived at the following list of JARs, but what I really want is a stand-alone bundle for Undertow with all dependencies included, which I cannot seem to find anywhere, despite its claims of being "lightweight" and "embeddable" and that "Undertow can be embedded in an application or run standalone with just a few lines of code." However, the true weight seems like a lot of code (about 6 MiB) after dependencies are included. And this is even excluding some obviously or documented optional packages like JBoss modules, and OSGI, etc.

Size aside, I have everything working with the listed JARs on classpath, but a bundle of the same JARs is not working; I get an error trying to start the server: XNIO001001: No XNIO provider found.

Can anybody point out something I'm overlooking? Or do I just have an old-fashioned definition for what's "lightweight" and "embeddable"?

JARs being bundled:

  • alpn-api-1.1.3.v20160715.jar
  • jboss-logging-3.3.1.Final.jar
  • jboss-logmanager-2.0.9.Final.jar
  • jboss-logging-annotations-2.1.0.Final.jar
  • jboss-threads-2.3.0.Final.jar
  • undertow-core-2.0.0.Beta1.jar
  • wildfly-client-config-1.0.0.Final.jar
  • wildfly-common-1.3.0.Final.jar
  • xnio-api-3.6.0.Final.jar
  • xnio-nio-3.6.0.Final.jar
Lawrence Dol
  • 63,018
  • 25
  • 139
  • 189
  • 1
    The `jboss-logging-annotations-2.1.0.Final.jar` is used at compile time only so that shouldn't be required. Also `jboss-logmanager-2.0.9.Final.jar` should be optional. JBoss Logging should work with any log manager. Also `alpn-api-1.1.3.v20160715.jar` *may* only be needed for HTTP/2. – James R. Perkins Feb 08 '18 at 18:37
  • @James: Yeah, that's what I thought, but ProGuard barfs if it can't resolve all referenced classes. But I will experiment some more with dropping those. WRT logging, I don't want any of it at all; the system in which its embedded just logs to the console and I'd like a simple logger that just does that. Might have to write one. – Lawrence Dol Feb 09 '18 at 04:51
  • jboss-logging is just a facade so it will write to any log manager. I guess ProGuard must check the source? That's the only reason I would jboss-logging-annotations would be required. The annotations aren't even available at runtime. – James R. Perkins Feb 09 '18 at 17:30
  • @James, actually PG works from the binaries in the JAR, not the source. The annotations must be present in the classes for it to know about them. – Lawrence Dol Feb 09 '18 at 17:41
  • The annotations are present in the XNIO JARs. – Lawrence Dol Feb 09 '18 at 17:42
  • Ah yeah. They are `RetentionPolicy.CLASS` so I guess they'd be in the binary, but they're not required at runtime. – James R. Perkins Feb 10 '18 at 18:18

1 Answers1

0

The above list of JARs does seem to work, but I had to configure ProGuard to retain the META-INF/services folders in them, while dropping other meta-information, like this:

# Combining JARs Only
-dontobfuscate
-dontshrink

-injars <DISTRO>/WebServer.internal.jar(!**/Z*)
-injars <DISTRO>/../lib/alpn-api-1.1.3.v20160715.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/jboss-logging-3.3.1.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/jboss-logging-annotations-2.1.0.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/jboss-logmanager-2.0.9.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/jboss-threads-2.3.0.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/undertow-core-1.4.22.Final.jar(META-INF/services/**,!META-INF/**,**)
-injars <DISTRO>/../lib/wildfly-client-config-1.0.0.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/wildfly-common-1.3.0.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/xnio-api-3.6.0.Final.jar(META-INF/services/**,!META-INF/**)
-injars <DISTRO>/../lib/xnio-nio-3.6.0.Final.jar(META-INF/services/**,!META-INF/**)

-outjars <DISTRO>/WebServer.jar

Still it seems excessive to me for a "lightweight" web server.

Lawrence Dol
  • 63,018
  • 25
  • 139
  • 189