File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes External jars problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "External jars problem" Watch "External jars problem" New topic
Author

External jars problem

jeff rusty
Ranch Hand

Joined: Nov 07, 2006
Posts: 109
Hi,
I am using eclipse 3.2 to add the external jars which i have in c:/libfolder/*.jar my project builds perfectly but at runtime i am getting Classnotfounderror . I am running my project using tomcat 5.5
can any one say where am i going wrong.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Tomcat has its own conventions for where it looks for Jars and classes, it ignores your system classpath.

The typical Tomcat installation has a file "class-loader-howto.html" in the tomcat-docs directory which explains where you should put needed jar and class files.

Bill
jeff rusty
Ranch Hand

Joined: Nov 07, 2006
Posts: 109
william,

I didnt get it you.. I am not getting the ClassNotFound error when i put the jar in my projects web-inf lib or tomcats shared lib.. I get it only when i add a jar which is out my project or out of the tomcat container.. Is there is any thing which i have to do to make use of a jar which is outside the project or tomcats's lib.. is there is any security issue..
I get a similar kind of problem when i give path of a html page which is in c:/common/html/some.html as the href for a anchor tag in my jsp page which is in my project. while clicking on the Link i didnt get a page not found and also no action takes place the page stays still.. what could be the issue
[ February 08, 2007: Message edited by: prem shakthi ]
prasad kulkarni
Ranch Hand

Joined: Mar 19, 2006
Posts: 66
prem
I am not getting your probelm exactly.
However let me clear out that "NoClassDefFound" error occurs only when the perticular class file needed is not present in the classpath.
Normally the web-servers & app-servers ignores the system environment varaibles. So make sure that the Tomcat is getting the class files ( jar file) at runtime.
If you put the jar file in web-inf, it will be automatically get copied in the war file, so in such case there will not be any problem.


scjp, scwcd
jeff rusty
Ranch Hand

Joined: Nov 07, 2006
Posts: 109
prasad,

i have a sample.jar which is in c:/common/sample.jar . i have included it in my class path.. but at runtime its not available..

the second issue is that i could access my local files from my Jsp.
eg: assuming c:/common/ has a file sample.html and in my jsp file i give the the href value as c:/common/sample.html(<a href="c:/common/sample.html">show</a>) when i click on the Hyper link nothing happens why
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
i have included it in my class path.. but at runtime its not available.


Guess I will have to repeat myself.

1. Tomcat IGNORES your system classpath
2. Tomcat has its own convention for finding jar and class files.
You MUST locate the sample.jar where the Tomcat convention calls for.

With regard to your second problem - the servlet API very strictly regulates where a servlet is allowed to look to serve a resource such as your sample.html. Just think about it - if a servlet was allowed to return any resource from anywhere in your file system it would be a huge security hole.

Bill
jeff rusty
Ranch Hand

Joined: Nov 07, 2006
Posts: 109
i got the first open thanks.. regarding the second one,from your reply i understand that its the security provided but is there is any way by which i can access the html pages outside my project by giving some permission..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: External jars problem
 
Similar Threads
Eclipse - deploying external jars - how to?
setting up hibernate in eclipse
Sharing the Eclipse .classpath File
adding external jars to a project in eclipse
hi, setting .jar file in eclipse