[jboss-user] [EJB/JBoss] - MVC application with EJB 2.1
do-not-reply at jboss.com
Thu Sep 13 05:33:28 EDT 2007
I'm trying to build an MVC application using EJB to access a database. But I've met an unexpected problem: in my servlet (C-part of MVC) i want to use my EJB to get data through it. And that's why I must have EJB's interfaces imported into my servlet. Otherwise it won't compile. But then I'll get ClassCastException trying to do
| InitialContext init = new InitialContext();
| Object objref = init.lookup("TheNews");
| NewsHome home = (NewsHome)PortableRemoteObject.narrow(objref, NewsHome.class);
Because interface NewsHome and objref are loaded with different ClassLoaders.
How should I pack my ear-file and how to organize access to EJB functions: from servlet(how?) or somewhere else?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083834#4083834
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083834
More information about the jboss-user