Solved

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

Posted on 2009-05-04
4
798 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

943 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now