This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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
[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.
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.