• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Data Objects(DTO) in EJB

 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I created a EAR file which has one ejb JAR file and a WAR file. I have created a data object in web application (WAR file) which my servlet
uses to pass the data to my ejb. Then my ejb gets all the information from the data object and does some business logic.

When i deployed my EAR file the deployment failed because it failed to start the ejb service. ejb deployment failed because it couldn't find the
data object(NoClassDefFoundError). I think this error is because ejb JAR couldn't find the data object which is packed in WAR file.
How do i resolve this issue?

Thanks,
Srikanth.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35709
408
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Srikanth,
An EJB project should not access a Web project. You have two choices:
1) Create a new project/jar for the DTO and have both the EJB/web projects point to it.
2) Move the DTO to the EJB project and have the Web project refer to it.
 
Saathvik Reddy
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeanne Boyarsky:
Srikanth,
An EJB project should not access a Web project. You have two choices:
1) Create a new project/jar for the DTO and have both the EJB/web projects point to it.
2) Move the DTO to the EJB project and have the Web project refer to it.


Jeanne, I like your sugession of creating a seperate jar for DTO's and have both EJB and Web projects access it. If i put this jar file in the top-level directory inside the .ear file is it accessible by both the EJB and Web modules? If not where should i put the common jar in EAR file to be accessed by both EJB and Web modules?

Thanks in Advance,
Srikanth.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This depends on your application server and its classloading policy. There is no standard place for these common jar files. For example WebSphere requires common jar file are defined in a maifest. Have a read of your server's documentation, it should tell you.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!