aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Jar in the build path of web and EJB application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Jar in the build path of web and EJB application" Watch "Jar in the build path of web and EJB application" New topic
Author

Jar in the build path of web and EJB application

Arun Kumar
Ranch Hand

Joined: Jan 21, 2005
Posts: 129

Hi All,

I have a strange problem,I am developing a web application which send a request to a third party system and we use message driven beans to receive the message

We have a jar file that needs to be in the classpath of both web application and the EJB application

We are using RAD 6.0 as IDE but when we add the jar file in the build path of both applications,I am getting a class defenition not found error,if the jsr is removed from the classpath of any one application the error dosent occur

but I need the jar file in both applications

any help would be greatly appretiated
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Hello Arun,

Do you use an ear file for your deployment?

[Excerpt from wikipedia]
Different artifacts can be embedded within an EAR file, artifacts which are deployed by the application server:

* A Web module has a .war extension. It is a deployable unit that consists of one or more web components, other resources, and a web application deployment descriptor. The web module is contained in a hierarchy of directories and files in a standard web application format.
* Arbitrary Java classes may be deployed in .jar files.
* An Enterprise Java Bean module has a .jar extension, and contains in its own META-INF directory descriptors describing the persistent classes deployed. When deployed, entity beans are visible to other components and (if remotely exported), remote clients. Message Beans and Session Beans are available for remote access.
* A Resource Adapter module has a .rar extension

Vendors may support extra artifacts, with their own extensions.


Shailesh Kini.
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
I know nothing about RAD, but I would expect your server's classloading to be centred on the concept of an application, which is normally packaged in an Enterprise Archive (EAR) file containing application classes. Everything within an EAR file is considered part of the same application.

Your problem arises because the same JAR files are being loaded by different classloaders and are therefore being regarded as different files. I therefore suggest that you rebuild to generate a single EAR file containing the Web and EJB files for your application. Typically, you would do something like this.

# Package the servlets and JSPs in a WAR file

# Package the enterprise beans in an EJB JAR file

# Package the WAR and JAR files in an EAR file

# Deploy the EAR file

This should solve your problem.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jar in the build path of web and EJB application
 
Similar Threads
What is the best practice to add the application property files to the classpath?
Error while running ejb client....
Install task cannot find file
Difference between *Applications* and *Web Applications* ??
Deserialization problem - InvalidClass w/ negative serialVersionUid for local class