[jboss-user] [EJB/JBoss] - Local ejb access vs remote access
msecrist
do-not-reply at jboss.com
Fri Nov 7 11:07:48 EST 2008
I'm trying to figure out why remote access to my EJB works but local access doesn't seem to. If I create a test remote test client using the following code, everything seems to work fine.
| Hashtable env = new Hashtable();
| env.put(Context.INITIAL_CONTEXT_FACTORY,
| "org.jnp.interfaces.NamingContextFactory");
| env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
|
| try {
| LeagueFacade leagueFacade = LeagueFacadeUtil.getHome(env).create();
| League league = leagueFacade.findLeague(1);
|
If I use the following code in a jsp or servlet deployed as part of the same EAR into the Jboss container, I get an exception (failing on the call to LeagueFacadeUtil.getHome() ).
| LeagueFacadeHome h = LeagueFacadeUtil.getHome();
| LeagueFacade l = h.create();
| League league = l.findLeague(1);
| Iterator schedules = league.getSchedules()
| .iterator();
|
| java.lang.ClassCastException
| com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
| javax.rmi.PortableRemoteObject.narrow(Unknown Source)
| com.leagueplanet.ejb.LeagueFacadeUtil.lookupHome(LeagueFacadeUtil.java:25)
| com.leagueplanet.ejb.LeagueFacadeUtil.getHome(LeagueFacadeUtil.java:42)
| org.apache.jsp.schedule_jsp._jspService(schedule_jsp.java:78)
|
If I try to add an initial context environment as I did for the remote client, I get a different exception and it fails on the call to LeagueFacadeHome.create()
| root cause
|
| java.rmi.ServerException: EJBException:; nested exception is:
| javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract com.leagueplanet.ejb.LeagueFacade com.leagueplanet.ejb.LeagueFacadeHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
| org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
| org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:136)
| org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
| org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer
|
I'm obviously missing something but can't quite figure out what it is. BTW, this is the basic code from the WTP book, which was aimed at a JBoss 4.0 deployment.
Thanks,
mark
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4187765#4187765
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4187765
More information about the jboss-user
mailing list