File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling class in a web module from EJB

 
praveen kanakarajan
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I need to modify and exisitng application which runs on a websphere.As per the new requirement i need to call a class in webmodule from EJB.Is it a correct to call a class from EJB jar.Also there's a possibility that this appplication can be deployed in a clustered environment.I learnt from sites that shared library option is there.if thats the solution then i need to state the reason why i need to move the class to share library.I would be greatful if someone could tell me the drawbacks of calling class in a webmodule from EJB.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Praveen,
Typically the web layer calls the ejb layer. Doing the opposite would introduce a circular dependency.

This is a common sign that you really have three units: the common code, the web module and the ejb module. If you refactor the common code into it's own module/jar, you can have the real web module (servlets, etc) and ejb module call it without a circular dependency.
 
magesh sripathy
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want your ejb to call the class in a webmodule,move those classes in the APP-INF directory of the application ,so that both your ejb module and your webmodule can able to access it now.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33694
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by magesh sripathy:
If you want your ejb to call the class in a webmodule,move those classes in the APP-INF directory of the application ,so that both your ejb module and your webmodule can able to access it now.

Is APP-INF a standard? I've seen it in WebLogic, but not JBoss or WebSphere. In other apps, I've just seen the jar files in the root of the EAR (or a lib directory under it.)
 
praveen kanakarajan
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solved it somehow.but i dont know whether its the correct method.I loaded both war and ejb jar with same class loader which websphere provides and then it was working.I would like to know the drawbacks of doing the said method.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic