Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Joe Ess
  • salvin francis
  • fred rosenberger

Jar in the build path of web and EJB application

Ranch Hand
Posts: 136
Eclipse IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
My cellmate was this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!