reflection use on home/proxy
sblanc Dec 12, 2002 5:19 PMHello !
I'm trying to perform some common code to invoke method on home computed with the reflection API (code without try/catch):
Object homeref = initial.lookup(compName);
Class xClass = homeref.getClass();
InvocationHandler invctHandler = Proxy.getInvocationHandler(homeref);
Method findByPrimaryKey = xClass.getMethod("findByPrimaryKey", new Class[] {scopedAidClass});
object = invctHandler.invoke(homeref, findByPrimaryKey, new Object[] {scopedAid});
at runtime I get the following exception:
15:32:52,378 INFO [STDOUT] homeref class is $Proxy134
15:32:52,388 INFO [STDOUT] Sucessfull xClass.getMethod findByPrimaryKey
15:32:52,408 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedBy:
javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public final com.alcatel.gem.ejb.tl1.Facility.interfaces.Ne_FacLocal $Proxy134.findByPrimaryKey(com.alcatel.gem.ejb.tl1.entity.interfaces.ScopedAid) throws javax.ejb.FinderException2
at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1112)
at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:206)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:90)
at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLocalContainerInvoker.java:230)
at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:110)
I have define correctly the ejb-external-ref to be able to use the bean on which I'm invoking the home.
I know somewhere the code has to be downloaded into the proxy. So I tried to narrow the homeref with the PRO though in local:
Object homestub = (Object)PortableRemoteObject.narrow(homeref, thisHomeClass);
without any effect, still getting the same proxy and getting the same exception at runtime.
Thank you for any help.
seb.