Link to home
Start Free TrialLog in
Avatar of NHBFighter
NHBFighter

asked on

Classpath in for a web app deployed as .war file

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
Avatar of john-at-7fff
john-at-7fff

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?
Avatar of NHBFighter

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of john-at-7fff
john-at-7fff

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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.
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.