Solved

how to enable external jar files for java classes on a web server

Posted on 2009-05-04
4
803 Views
Last Modified: 2013-11-21
Hey experts,

I am trying to use this itext-2.1.5.jar file to read a txt file on our server and produce a pdf file for printing.

This class works fine and compiles in eclipse which has this file included in its libraries but when uploaded on the server it says it cannot find the itext.jar file i'm guessing since it is in the wrong location and/or probably not referenced properly in my class as well.

Here is java console error:

java.lang.NoClassDefFoundError: com/lowagie/text/DocumentException
Caused by: java.io.IOException: open HTTP connection failed:http://mycompany.ca/data/DIR1/DIR2/Mobile/com/lowagie/text/DocumentException.class

mobile is the location of the java class and .txt file

I tried placing it in the same directory as the applet and txt file with no success and also found a lib directory where access was denied. If it helps i have found out that this is an Apache server but the staff at technical support don't really know how to go about this either.

Any ideas how this should be done? I am using eclipse to create the java class files and i noticed it also creates a policy file, should i be including this on the server as well perhaps?

Thanks,
-TristanTheHakSoar
0
Comment
Question by:TristanTheHakSoar
  • 2
4 Comments
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 24308322
Is this an applet or code which runs in the Web server?

If it's in the Web server, then the .jar file has to be here:

<tomcat webapp>/WEB-INF/lib/itext-2.1.5.jar

If you don't have permissions to put things there, then you have to get someone to do it for you.
0
 

Author Comment

by:TristanTheHakSoar
ID: 24309371
Hey mrcoffee,

So yeh this is an applet called by a Perl file using CGI script and printing out HTML which says:

print "<p align=\"center\">";
      print "<applet code=\"dailyPDF.class\" codebase = \"ourwebsite.ca/data/$id/$stat/Mobile\" width=\"860\" height=\"300\" name=\"dailyPDF\">";
    print "</applet>";
    print "</p>";

So i've been through all the directories available on FileZilla but the only one i can find that is a match is CGI-BIN which contains all our CGI scripts and Perl files and a directory called Plugins that contains the Java classes we ourselves write.

That's probably useless information but as for the permissions side of things i could always phone back the customer support guys but i don't want to do that until i know where this file needs to go.

Is there a typical spot for these files or somekind of a reference that could show me the average tree structure of an Apache server file system? I can't seem to find anything like that, not even on our host's website, fatbanana.ca, but another source suggests that maybe i need to do something about the class path?

thanks!

-TristanTheHakSoar
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 24309878
you need to specify the jar in the archive param of the applet tag
http://www.htmlcodetutorial.com/applets/_APPLET_ARCHIVE.html

0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 24309903
Yes, if it's an applet, then you need to identify the jar as "objects" mentioned above.  I like this documentation better:
http://java.sun.com/j2se/1.4.2/docs/guide/jar/jarGuide.html

That page mentions that the jar has to be relative to the page which invokes the applet.  So if your directory on the server for the page which has the applet HTML is in
ourwebsite.ca/data/$id/$stat/Mobile
then that would be a good place to put all the jars your applet needs.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet web applications   metadata-complete="true" or false 3 108
jboss wildfly 10.1 10 219
eclipse console opening separately 2 29
ejb entity bean example issue 2 16
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question