Solved

Classpath in for a web app deployed as .war file

Posted on 2004-04-14
6
848 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 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
Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

-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 …
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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