Solved

Classpath in for a web app deployed as .war file

Posted on 2004-04-14
6
841 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
  • 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 125 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

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

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
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 …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

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