0 Replies Latest reply on Jan 23, 2014 3:26 PM by Nicolas Dordet

    How to make a local call to an ejb from a module?

    Nicolas Dordet Newbie

      Hi all,

       

      Maybe a strange way of doing things.. but I would like to know if it is possible to call an ejb from a jar deployed in a module?

       

      In fact, I can do it by telling jboss my module's jar is a client and then do a remote ejb call.

      But since my jar and the ejb are on the same server, I would like to make a local call and then I've got an "object is not an instance of declaring class" when trying to call the create methode of my ejb (wich is an ejb 2).

       

      I think module is not allowed to call classes from deployement. Is there a way to forcing that?

       

      Any ideas ?

       

      21:14:52,338 ERROR [stderr] (EJB default - 7) java.lang.IllegalArgumentException: object is not an instance of declaring class

      21:14:52,339 ERROR [stderr] (EJB default - 7)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      21:14:52,340 ERROR [stderr] (EJB default - 7)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      21:14:52,341 ERROR [stderr] (EJB default - 7)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      21:14:52,342 ERROR [stderr] (EJB default - 7)   at java.lang.reflect.Method.invoke(Method.java:601)

      21:14:52,343 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.reflect.SerializableClass.callReadResolve(SerializableClass.java:325)

      21:14:52,344 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:260)

      21:14:52,344 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      21:14:52,346 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.cloneFields(SerializingCloner.java:348)

      21:14:52,347 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:309)

      21:14:52,348 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:286)

      21:14:52,350 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:254)

      21:14:52,351 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      21:14:52,352 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner$StepObjectInput.doReadObject(SerializingCloner.java:738)

      21:14:52,354 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)

      21:14:52,355 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.SerializedEJBInvocationHandler.readExternal(SerializedEJBInvocationHandler.java:91)

      21:14:52,356 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:246)

      21:14:52,356 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:231)

      21:14:52,356 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      21:14:52,357 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:189)

      21:14:52,357 ERROR [stderr] (EJB default - 7)   at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:135)

      21:14:52,358 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:225)

      21:14:52,358 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.LocalEjbReceiver.clone(LocalEjbReceiver.java:216)

      21:14:52,359 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:188)

      21:14:52,359 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179)

      21:14:52,360 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43)

      21:14:52,360 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      21:14:52,361 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)

      21:14:52,361 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181)

      21:14:52,362 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136)

      21:14:52,362 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121)

      21:14:52,363 ERROR [stderr] (EJB default - 7)   at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104)

      ... part of my module's jar ...

      21:14:52,366 ERROR [stderr] (EJB default - 7)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      21:14:52,367 ERROR [stderr] (EJB default - 7)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      21:14:52,367 ERROR [stderr] (EJB default - 7)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      21:14:52,368 ERROR [stderr] (EJB default - 7)   at java.lang.reflect.Method.invoke(Method.java:601)

      21:14:52,369 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72)

      21:14:52,369 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,370 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53)

      21:14:52,370 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36)

      21:14:52,371 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,371 ERROR [stderr] (EJB default - 7)   at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)

      21:14:52,372 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,372 ERROR [stderr] (EJB default - 7)   at org.jboss.as.jpa.interceptor.SFSBInvocationInterceptor.processInvocation(SFSBInvocationInterceptor.java:58)

      21:14:52,373 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,373 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.tx.StatefulBMTInterceptor.handleInvocation(StatefulBMTInterceptor.java:102)

      21:14:52,374 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56)

      21:14:52,374 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,375 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.component.stateful.StatefulSessionSynchronizationInterceptor.processInvocation(StatefulSessionSynchronizationInterceptor.java:156)

      21:14:52,376 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,376 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)

      21:14:52,376 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,377 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      21:14:52,377 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53)

      21:14:52,378 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,378 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.component.stateful.StatefulComponentInstanceInterceptor.processInvocation(StatefulComponentInstanceInterceptor.java:66)

      21:14:52,379 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,380 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:80)

      21:14:52,380 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,381 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

      21:14:52,381 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,382 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59)

      21:14:52,382 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,383 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories$1.processInvocation(EjbExceptionTransformingInterceptorFactories.java:65)

      21:14:52,383 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,384 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)

      21:14:52,384 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,385 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43)

      21:14:52,385 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,385 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45)

      21:14:52,386 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288)

      21:14:52,386 ERROR [stderr] (EJB default - 7)   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

      21:14:52,387 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165)

      21:14:52,387 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:302)

      21:14:52,388 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$200(MethodInvocationMessageHandler.java:64)

      21:14:52,388 ERROR [stderr] (EJB default - 7)   at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:196)

      21:14:52,389 ERROR [stderr] (EJB default - 7)   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

      21:14:52,389 ERROR [stderr] (EJB default - 7)   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

      21:14:52,390 ERROR [stderr] (EJB default - 7)   at java.util.concurrent.FutureTask.run(FutureTask.java:166)

      21:14:52,390 ERROR [stderr] (EJB default - 7)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

      21:14:52,390 ERROR [stderr] (EJB default - 7)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

      21:14:52,391 ERROR [stderr] (EJB default - 7)   at java.lang.Thread.run(Thread.java:722)

      21:14:52,391 ERROR [stderr] (EJB default - 7)   at org.jboss.threads.JBossThread.run(JBossThread.java:122)