0

I try to embed (use) Jetty into my JavaFX 2.2 applet (which runs in a browser).

My problem is that, to host servlets I need to include the servlet-api-3.0.jar also (for javax.servlet namespaces) besides jetty-server.jar, jetty-servlet.jar and jetty-util.jar.

enter image description here

If I include the servlet-api.jar, my project compiles, but when I run it inside the browser, the deployment fails with the "JavaFX application could not launch due to system configuration (show error details). See java.com/javafx for troubleshooting information." error message.

If I remove the servlet-api.jar (and remove the relevant source) it deploys again.

For the JavaFX project the Java Platform is set to "Default JavaFX Platform", and it would be good to keep it this way to reduce the minimum footprint required.

I'm not a java(fx) expert (I come from .NET world), so I'd appreciate any help!

Csabi
  • 807
  • 3
  • 8
  • 18
  • What are the error details? – Puce Jan 31 '13 at 16:39
  • I don't know how to get them, because if I click on the 'show error details' link then the JVM console appears which contains nothing. I don't know how to set this up properly to show errors :/ – Csabi Jan 31 '13 at 16:46
  • Does it work when running as "normal" application (not as an Applet)? – Puce Jan 31 '13 at 16:50
  • Yes it does run as a normal app :( If I switch it back to "Run in Browser" it fails again. – Csabi Jan 31 '13 at 16:59
  • Hm, can you check if the generated JNLP file contains all necessary JARs and that the location of the JARs is correct? – Puce Jan 31 '13 at 17:05
  • Yes, under there are all JARs with href="lib/.jar" size="..." and eager-loading attributes. – Csabi Jan 31 '13 at 17:09
  • I think you first have to get this error message. It should be in a tab or something on the error dialog, as far as I remember. – Puce Jan 31 '13 at 17:22
  • OK, I got the error: com.sun.deploy.net.JARSigningException: Could not verify signing in resource: file:/D:/Work/POC/NetBeansProjects/JavaFXApplication1/dist/lib/servlet-api-3.0.jar at com.sun.deploy.security.JarVerifier.getValidatedJarFile(Unknown Source) – Csabi Jan 31 '13 at 17:49
  • Are you trying to write some kind of bot? As I understand it you are trying to write an applet so when users go to your site you start a web server on their PC. I hope this could never work. – Andy Till Feb 01 '13 at 12:51
  • Andy: take it easy. My applet is a simple sound-Player app. It would download an encrypted sound-byte-array, decrypt it, open it from memory, because I mustn't save it locally. I want to use the javafx-MediaPlayer API, but that only supports urls as input. This is why a local 'webserver' is an approach to provide the in-memory decrypted sound as a local-url. – Csabi Feb 02 '13 at 10:52

2 Answers2

1

You have an issue with signing the JARs. I'm not very familiar with signing JARs for JavaFX but here is the documentation:

http://docs.oracle.com/javafx/2/deployment/packaging.htm#BABJGFBH

http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference001.htm#CIAFJGAB

Puce
  • 37,247
  • 13
  • 80
  • 152
0

servlet-api-3.0.jar is what's known as a provided dependency.

It is not needed to be included in your war file, as the web app container (in this case Jetty) provides it for you. In your build tool, just exclude the servlet-api.jar from being bundled in your war file.

Note: jetty-server-9.0.0.M5.jar is also a provided dependency and has the same rules.

Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • I guess you misunderstood me: I'm NOT hosting my JavaFX app inside Jetty! I'm hosting my JavaFX app in a static HTML, and I want to use Jetty inside/from the JavaFX app to open an HTTP-listener/servlet inside JavaFX. Or did I misunderstand you? :) – Csabi Jan 31 '13 at 14:29