Meaningless Drivel is fun!
The moose likes Websphere and the fly likes WSAD and Web Projects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "WSAD and Web Projects" Watch "WSAD and Web Projects" New topic

WSAD and Web Projects

Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello All,
Is it true that a web project cannot depend on another web project. I have two web projects, lets call it WebProjA and WebProjB. There is a servlet in my WebProjB which extends from another servlet in WebProjA. It compiles fine, but when I access the WebProjB's servlet it tells me that it cannot find the servlet in WebProjA. I am using WSAD and I am not able to figure this out.
Is it true that a web project cannot depend on another web project. Both web projects reside in the same EAR or are associated with the same EAR.
Please help!
Steve Granton
Ranch Hand

Joined: Jan 13, 2002
Posts: 200
This is a classloader problem. As far as I'm aware, each WAR will have a separate classloader and consequently be unable to load classes in another WAR - even if it is in the same application (EAR). The way around this is to create a jar of 'common' classes that all the EJBs and WARs in an application use. As long as your scope (module visibility of the application server)is set to 'Application' the other modules should be able to see all files in the common jar. We've used this approach to share common classes between the EJB modules and a single WAR module - though I suspect that its the same principal if there are multiple WARs.
Its probably worth investigating how WAS loads classes - look in the WAS 4.0 Handbook from RedBooks.
Also, there is a recent article here that may shed some light on it:
I hope this helps.
[ May 29, 2002: Message edited by: Steve Granton ]
[ May 29, 2002: Message edited by: Steve Granton ]
I agree. Here's the link:
subject: WSAD and Web Projects
It's not a secret anymore!