Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My First EJB with Eclipse

 
Dave Elwood
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Eclipse I've got all components, interfaces and classes, written to make an EJB for my Tomcat.

However some classes and interfaces, such as EJBObject are not in the typical JDK 1.4.2 that I have so ...

from JBoss I found jboss-j2ee.jar, extracted the whole tree and imported it into my project.

Eclipse doesn't see that EJBObject is located right there under javax.ejb.* in the project directory. Only when I tow the one class into the same directory as my project's interfaces etc. is the EJBObject.class file visible.

I must be doing something really dumb. :roll:
 
John Ament
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a UserLibrary (right click on project, build path -> configure build path, libraries -> add library, user library, next, click the button "User Libraries..." new) with this jar file in it.

BTW, tomcat out of the box doesn't support EJBs. Are you maybe meaning JBoss as the app server?
 
Dave Elwood
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you John.
I haven't gotten far enough to say if Tomcat will do EJBs. I do have JBoss here lying about and as soon as I get the EJBs to at least compile then I'll try that.
[ July 10, 2007: Message edited by: Dave Elwood ]
 
Dave Elwood
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating a user library solved it John.
I see that the jboss-j2ee.jar is not physically duplicated in my project directory, as it was when I used import.
I wonder why it didn't see the classes when I used 'import'?
Was it because they didn't have any source code? And only the compiled *.class files?
[ July 10, 2007: Message edited by: Dave Elwood ]
 
John Ament
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. Your project should contain source code, your user libraries should contain dependencies (or you can use dependencies between projects).
[ July 10, 2007: Message edited by: John Ament ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic