It depends on your app. server but typically each deployed application will have its own class loader, so classes on the web apps classpath are not necessarily available to the ejb app, even if they are deployed together in an ear. Which app. server are you using?
when I try to call the class in the servlet context from the EJB , I am getting class not found exception.
Which is the right behavior. Usually the classloader architecture of most of the containers should allow servlets to load ejb classes but not the other way around. Think about, is no reason for your business logic to invoke any services of the web/presentation tier. Just for the argument sake imagine that an ejb would call a class packed within your war. If that class is a servlet than is nothing much to say: servlets cannot be invoked directly, they can only handle http requests. On the other hand if that class is a POJO then you can solve this problem packing your application in a different way. Hence you better extract all the common classes from your war and pack them in a common.jar library. You can pack all your modules in an ear and you can make the common.jar available to your ejbs probably editing the manifest file. Again you should check the jboss documentation about tips regarding packaging. Regards.
I think, therefore I exist -- Rene Descartes
Watchya got in that poodle gun? Anything for me? Or this tiny ad?