Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying an application using Java Web Start

I recently developed a whole system in Java that connects to a database (using jtds.jdbc.Driver) and exports and imports the table content to an excel sheet using Apache POI. I used Swing for the user interface. The user will interact with it for authentication and file management.

Apparently the client wants it deployed so I started to deploy using Java Web Start on an Apache tomcat server.

I put in reference this interesting tutorial. Since I followed it

Launch file

<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
  <information>
    <title>Talisman</title>
    <vendor>CCT</vendor>
    <homepage href="http://localhost:8080/"/>
    <description>Testing Testing</description>
  </information>
  <resources>
    <j2se version="1.6+"/>
    <jar href="Talisman.jar"/>
  </resources>
  <application-desc main-class="cct.karim.karim"/>
</jnlp>

Run-time exception

java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/CellStyle
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    at java.lang.Class.getMethod0(Class.java:2685)
    at java.lang.Class.getMethod(Class.java:1620)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.CellStyle
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 9 more

What seems to be the problem?

like image 409
user1912404 Avatar asked Mar 18 '26 04:03

user1912404


1 Answers

You're not including your POI jar with your deployment. I suspect there'll be other jars that you need to deploy too. Everything your app needs has to be downloaded and installed on your client's host.

You'll need a line like:

   <jar href="apache-poi.x.y.jar"/>

for each jar file.

like image 68
Brian Agnew Avatar answered Mar 19 '26 17:03

Brian Agnew