Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty-11.0.11 embedded - WebAppContenxt class cannot parse file:jar references
  • From: Stefan Viljoen <viljoens@xxxxxxxxxxxxxxx>
  • Date: Tue, 6 Sep 2022 09:30:13 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=verishare.co.za; dmarc=pass action=none header.from=verishare.co.za; dkim=pass header.d=verishare.co.za; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Feqp5Yye1sFWX5JSzN6HVOVXciFw4+TpdsZicuS68r0=; b=Aff+dGoKOYm4uFv/3SKNVFWCs35C4qb0RryaP+yr01gjtbrMzadHJuWLUZMO5ihLEXBk5lLEA8lkw0mIVms95bMEk27xNdgnAR4NMnojyroHl/5iu8SqY11eQjtc30UvX6TpoQfgf9/8F6mpkCDfbkOc/alqbnYOqDDb9noPSkdeMemSgTjVR9QHt8OL/owmIOQScN5gW3bhniGTCbZmFj5E73CGsGgv617RFnPtHaaziSBdJZU2BVZPUaH5kk7Qe+6Zo6w2frMOsbWu+2QgJPDk9gTdBV9rLUrt8P+HL/nmZVWHdDtmXVGH40uuumGUHvOrtjQqi7vOkIT2PB42IQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M79lvWP1h1QDqCG45Cna5truzGApyt7MzjnBas3LfuEbDFmdhhjlCfLYJ+41YsqwlvGV2J/gauCuMiFUK619SIwAvBHTLPjjsSIIWYCgZFklRkW3m8ezXYx7pOyHlKRkV07787yLeUaSKhedegCJnLKDLWyj7r1EMLTwABd6qwWZYH/Iogb+25z4MLoX0j5I56WMWAflQaawo+PPGE223PluzKaRszugusxJhfvXFdHN+nPq9mZItUvllDOuxtqKHyhuSBvonq6PvI7AB1+tdfyBXujq02PubR1SuwAILadUUe+Nc87rV4KXgKE30XRoj5nddMcK1AMS+Hhjv3cjGw==
  • Delivered-to: jetty-users@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/jetty-users/>
  • List-help: <mailto:jetty-users-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/jetty-users>, <mailto:jetty-users-request@eclipse.org?subject=unsubscribe>
  • Thread-index: AQHYwdNE8JuLKka6PUKIoLKXGnxqJw==
  • Thread-topic: Jetty-11.0.11 embedded - WebAppContenxt class cannot parse file:jar references

Hi guys

 

Ok I’ve refined this down. See  my original question below.

 

The problem there is that if I do this to set up a Jetty WebAppContext:

 

--

.

.

.

String webDir = this.getClass().getClassLoader().getResource("static").toExternalForm();

 

WebAppContext waContext = new WebAppContext(webDir, "/"); 

.

.

.

--

 

I get for “webDir”

 

--

jar:file:/usr/src/verdi/verdi-12-JDK17-jar-with-dependencies.jar!/static

--

 

which is CORRECT  - there IS a folder “static” in the root  of the JAR Jetty is embedded in and running out of, and  that “static” folder contains  the .html, .js, etc. files I need Jetty to serve as a static website at x.x.x.x:80 to web-browser, using an instance of the Jetty WebAppContext class.

 

However, it appears Jetty’s WebAppContext class -CANNOT- parse jar:file references to web app -files-.

 

If I have a “webDir” of file:/// (e.g. just plain files outside the JAR) it works perfectly, and the Jetty WebAppContext class can serve out the site and does so perfectly to web-browsers visiting the server IP over HTTP.

 

How can one get Jetty’s WebAppContext class (for Jetty 11.0.11) to parse file:jar references so one can serve static HTML out of an embedded Jetty 11.0.11 instance from the same physical JAR file Jetty 11.0.11 is embedded in and running out of?

(This was working in Jetty 9, I recently upgraded and the WebAppContext class seems to have lost the capacity to  parse file:jar references?)

 

Thanks!

 

Description: signature

 

CONFIDENTIALITY NOTICE AND DISCLAIMER: This e-mail transmission contains confidential Information which is the property of the sender and which is subject to legal privilege and/or copyright and intended only for the above-mentioned addressee. If you are not the intended recipient, you are hereby notified that any unauthorized use, disclosure, copying or distribution of the content of the e-mail transmission or the taking of any action in reliance thereon or pursuant thereto, is strictly prohibited and may be unlawful and may lead to prosecution. Should you have received this e-mail in error, please immediately notify us. The views, policies and comments contained in this e-mail are those of the sender thereof and should not be construed as the views, policies and/or comments of the organization. We cannot assure that the integrity of this e-mail communication has been maintained nor that it is free of errors, interference or interception and will not accept any liability or responsibility in this regard. By opening our emails, you indemnify us of any liability.

 

From: Stefan Viljoen
Sent: Monday, September 5, 2022 10:53 AM
To: jetty-users@xxxxxxxxxxx
Subject: Jetty-11.0.11 embedded - 404 for all static html files or .jsp's in JAR under Linux JDK 17

 

Hi guys

 

Desperately looking for some help or pointers – been at this issue for two weeks solid now:

 

I have a Maven-based embedded Jetty-11.0.11 project in an “uber JAR” (jar-with-all-dependencies) in JDK17 that I  inherited from a dev that left the company.

 

I got it from him at Jetty-9 under JDK1.8, and have successfully upgraded it to Jetty-11.0.11 under JDK17 (at least, it works, but only -inside- Netbeans14…!) by changing the maven pom.xml to refer to newer versions of apache-jsp, apache-jstl, and jetty itself (for Maven.)

 

I have no web.xml or WEB-INF folder at all in the project.

 

The static content (.html, .css and .js files) for the webpages it contains, are hosted in the project .JAR at src\main\webapp\static

 

After upgrading to Jetty-11.0.11 and JDK17, I could run the project in Netbeans 14 debug mode in Windows 10 and visit the “Netbeans 14”-ed Jetty instance in a browser which rendered the static .html and .jsp content correctly.

 

If I copy the Jetty-11.0.11-using JAR to a Linux host and run it under JDK17 there, NONE of the static .html and .jsp content inside the JAR can be found anymore. When running in JDK17 under Linux in the embedded JAR, Jetty responds:

--

HTTP ERROR 404 Not Found

URI:

/

STATUS:

404

MESSAGE:

Not Found

SERVLET:

org.eclipse.jetty.servlet.ServletHandler$Default404Servlet-726a17c4

--

 

for any and all .html and .jsp files inside the JAR.

 

Where can I start to look to get Jetty-11.0-11 embedded in an uber-JAR to render .html and .jsp files inside the JAR when run in a Linux-based JDK 17 instance?

 

No exceptions or any errors is emitted by Jetty.

 

I run Jetty in Ubuntu 20.04-LTS with official Oracle JDK17 as

 

/usr/lib/jvm/jdk-17/bin/java -Djavax.net.ssl.trustStore=/usr/lib/jvm/jdk-17/lib/security/cacerts -cp /usr/src/verdi/verdi-12-JDK17-jar-with-dependencies.jar verishare.App

 

Anybody got ANY idea why Jetty-11.0.11 only works inside Netbeans 14 debug mode in Windows under Oracle JDK 17, but not in a Linux-based Oracle JDK 17 (where it WAS working in Linux with JDK 1.8 and Jetty-9)?

 

Where do I even start?

 

More than willing to provide more info such as the POM and the server setup code if anybody wants to help…

 

Thanks!

 

Kind regards,

 

Stefan

 

Description: signature

 

CONFIDENTIALITY NOTICE AND DISCLAIMER: This e-mail transmission contains confidential Information which is the property of the sender and which is subject to legal privilege and/or copyright and intended only for the above-mentioned addressee. If you are not the intended recipient, you are hereby notified that any unauthorized use, disclosure, copying or distribution of the content of the e-mail transmission or the taking of any action in reliance thereon or pursuant thereto, is strictly prohibited and may be unlawful and may lead to prosecution. Should you have received this e-mail in error, please immediately notify us. The views, policies and comments contained in this e-mail are those of the sender thereof and should not be construed as the views, policies and/or comments of the organization. We cannot assure that the integrity of this e-mail communication has been maintained nor that it is free of errors, interference or interception and will not accept any liability or responsibility in this regard. By opening our emails, you indemnify us of any liability.

 


Back to the top