Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / August 2004

Tip: Looking for answers? Try searching our database.

Using Entity Beans with Struts

Thread view: 
Mike - 26 Jul 2004 21:29 GMT
Hi,
I'm a total EJB newbie. I've tried to use EJBs with Struts. After
deploying a simple entity bean (BMP) and struts app on JBoss 3.2.3
with Tomcat I get this error message:

java.lang.Error: Unresolved compilation problems:
MyEJBHome cannot be resolved or is not a type
MyEJBHome cannot be resolved or is not a type
MyEJBHome cannot be resolved or is not a type

My bean class/interfaces are

class: MyEJBBean
interfaces: MyEJBHome and MyEJB

I try to call the bean with:

InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("ejb/MyEJBBean");
MyEJBHome myEJB = (MyEJBHome)PortableRemoteObject.narrow(ref,MyEJBHome.class);

the jndi name is ok. Both apps has been deployd, they are in the
web-console listing.
Any ideas, why i can't resolve the class?

THX,
Mike
Murray - 27 Jul 2004 09:00 GMT
> Hi,
> I'm a total EJB newbie. I've tried to use EJBs with Struts. After
[quoted text clipped - 23 lines]
> THX,
> Mike

Probably a silly question, but you are import-ing your MyEJBHome class
aren't you? Otherwise, it sounds like a classpath issue
Craig Andrews - 05 Aug 2004 13:51 GMT
> Hi,
> I'm a total EJB newbie. I've tried to use EJBs with Struts. After
[quoted text clipped - 3 lines]
> web-console listing.
> Any ideas, why i can't resolve the class?

You have to deploy the interfaces to the EJB with the web application as
well as with the EJB itself. So, your .EAR file would contain:

mypackage.ejb.MyBean
mypackage.interfaces.MyBean
mypackage.interfaces.MyBeanHome

and your .WAR file would contain

mypackage.web.MyStrutsApp
mypackage.interfaces.MyBean
mypackage.interfaces.MyBeanHome

HTH

Signature

Craig Andrews <craig@simplyspiffing.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.