?
Solved

Classpath in for a web app deployed as .war file

Posted on 2004-04-14
6
Medium Priority
?
852 Views
Last Modified: 2013-12-10
I'm deploying an application as a .ear file in weblogin 8.1. In the enclosed .war file I have the following structure:
root
 |-WEB-INF/classes
 |-jsps
 |-imgs
etc.

I'm storing my compiled servlets and helper classes in the WEB-INF/classes directory. I have access to the helper classes from those servlets. But I don't have access to them from my jsp pages kepted in my jsps directory. I thought that the WEB-INF/classes directory was automatically added to the classpath for the application. But that doesn't seem to be happening. Am I wrong?  I know it's probably better to jar up all those helper calsses and places them in the lib directory. What do you think all help is appreicated.

Thanks
David
0
Comment
Question by:NHBFighter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10829508
First off, you can definitely request the JSPs after deployment? For instance, a JSP with no Java code in it pulls up fine?

Second: (And sorry to ask the obvious) You have the right import statements in your JSPs?
0
 
LVL 4

Author Comment

by:NHBFighter
ID: 10829793
Thanks for the reply!

I can request my JSPS after deployment with or with out java code. The only issue is when I use a class in the classes directory. The class I'm talking about isn't in a package. Its just a lone class file in the WEB_INF/classes directory, so I thought I didn't have hany thing to add to the classpath. Is that wrong. And is it true that WEB_INF/classes is added to the apps classpath?

Thanks
David
0
 
LVL 4

Accepted Solution

by:
john-at-7fff earned 500 total points
ID: 10829810
That's the way it's supposed to work -- whatever's in WEB-INF (NOTE: That's a dash: I notice you use an underscore in your prev msg) /classes and the jars in WEB-INF/lib all are on your classpath.

What error are you getting? ClassNotFoundException?
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 4

Author Comment

by:NHBFighter
ID: 10829871
Yeah thats the exception I'm getting, but I found a quick way around it.

Well what I've done that seems to work is to make the class part of package helperClasses, and create a WEB-INF/classes/helperClasses folder and place the class there. Then of cource import the package helperClasses.

Thanks for the help!
David
0
 
LVL 4

Expert Comment

by:john-at-7fff
ID: 10829915
I'm glad to hear you found a workaround.

So before there was no package declaration, and you put them at the root of WEB-INF/classes ?

I am amazed that didn't work -- I'll have to see how JBoss, for instance, deals with a class in WEB-INF/classes w/o a package declaration.
0
 
LVL 4

Author Comment

by:NHBFighter
ID: 10830103
Yeah I just placed them in the WEB-INf/classes folder and there was no package declaration.  Please let me know how JBoss handles it.

0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

762 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