aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Can a EJB module reference a WEB module? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can a EJB module reference a WEB module?" Watch "Can a EJB module reference a WEB module?" New topic
Author

Can a EJB module reference a WEB module?

Luciano Queiroz
Ranch Hand

Joined: Feb 04, 2002
Posts: 172
Hi folks!

Is it possible for a EJB module to reference a WEB module?
In the same EAR there is a EJB module (.jar) and a web module (.war).
The classes in the EJB module use classes in the WEB module.
But everytime I deploy the EAR and test the EJBs, 9iAS throws a ClassNotFoundException from the EJB.

I already tried to use a MANIFEST file in EJB.jar but I don't know which value I have to insert in the Class-Path attribute to reference classes in the web module.

Any help would be appreciated.


<b>Luciano Queiroz</b><br/>
 Brazil<br/>
 <i>SCJP 1.2, SCWCD, IBM 141, IBM 483, SCJP 1.4, IBM 484, IBM 287, SCBCD, SCEA, SCJP 5.0, SCJP 6.0, SCWCD 5</i>
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30973
    
159

Luciano,
This seems to me to be more of a design question (about ejb modules referencing web modules), so I'm moving it to:
J2EE

Why does your ejb module need to refer to a web module? Does the web module also refer to the ejb module? You want to avoid circular dependencies.

Without knowing more about your situation, it looks like a refactoring is in order. The classes that are used by both the ejb module and web module can be moved to a separate "common" project/jar file. That way the structure is clearer and you don't have the awkward dependency structure.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Navin Keswani
Greenhorn

Joined: Jun 08, 2004
Posts: 17
The problem has a very simple solution just make an entry into your manifest file of your jar file using the following syntax

Class-Path: some.jar somexyz.war

the jars or wars have to seperated by spaces.

I hope this solves your problem.

Regards,
Navin Keswani
Luciano Queiroz
Ranch Hand

Joined: Feb 04, 2002
Posts: 172
Very simple, but it didn't solve my problem.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by Luciano Queiroz:
Very simple, but it didn't solve my problem.


Did you try Jeanne suggestion of creating a common.jar of all the shared classes and putting it in the lib folder of the ear?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can a EJB module reference a WEB module?