[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Classpath in for a web app deployed as .war file

Posted on 2004-04-14
6
Medium Priority
?
853 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

656 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