See Thread at:
http://www.techienuggets.com/Detail?tx=59823 Posted on behalf of a User
I have the same problem, trying to find whats wrong. Now I think the problem is with
XDoclet.
In Response To:
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