Solved

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

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

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 26

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

747 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

12 Experts available now in Live!

Get 1:1 Help Now