<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Problem with NotEligibleForDirectInvocationException
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/argonist">Manu Osten</a> in <i>EJB 3.0</i> - <a href="http://community.jboss.org/message/552602#552602">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>i want to test with JUnits the methods from session-bean, but the invoke to the methods is not working. I have no idea?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Session-Bean "AccountingBean":</p><pre class="jive-pre"><code class="jive-code jive-java">@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
&#160;&#160;&#160; @SuppressWarnings(<font color="red">"unchecked"</font>)
&#160;&#160;&#160; <font color="navy"><b>public</b></font> Collection&lt;InstitutionType&gt; getInstitutionTypeList() <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>final</b></font> Query query = manager.createQuery(<font color="red">"from InstitutionType"</font>);
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>return</b></font> (Collection&lt;InstitutionType&gt;) query.getResultList();
&#160;&#160;&#160; <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Testcase for getInstitutionTypeList()</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">@Test
&#160;&#160;&#160; <font color="navy"><b>public</b></font> <font color="navy"><b>void</b></font> testGetInstitutionTypeList() <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; 
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>if</b></font>(session == <font color="navy"><b>null</b></font>) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"session is Null"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> <font color="navy"><b>else</b></font> <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(<font color="red">"session is Not Null"</font>);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.out.println(session.toString());
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Collection&lt;InstitutionType&gt; typeList = <font color="navy"><b>null</b></font>;
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy"><b>try</b></font> <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; typeList = session.getInstitutionTypeList();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font> <font color="navy"><b>catch</b></font> (Exception e) <font color="navy">{</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; e.printStackTrace();
&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="navy">}</font>
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Assert.assertNotNull(typeList);
&#160;&#160;&#160;&#160;&#160;&#160;&#160; Assert.assertEquals(typeList.size(), 7);
&#160;&#160;&#160; <font color="navy">}</font>
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Error-Message:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><pre class="jive-pre"><code class="jive-code jive-java">DEBUG [main] (ProxyObjectFactory.java:98) - org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory servicing request <font color="navy"><b>for</b></font> PonteSeam-ear/AccountingBean/remote
DEBUG [main] (MicroSocketClientInvoker.java:253) - SocketClientInvoker[77ff92f5, socket:<font color="darkgreen">//localhost:3873] constructed</font>
DEBUG [main] (MicroRemoteClientInvoker.java:240) - SocketClientInvoker[77ff92f5, socket:<font color="darkgreen">//localhost:3873] connecting</font>
DEBUG [main] (MicroSocketClientInvoker.java:735) - Creating semaphore with size 50
DEBUG [main] (MicroRemoteClientInvoker.java:245) - SocketClientInvoker[77ff92f5, socket:<font color="darkgreen">//localhost:3873] connected</font>
DEBUG [main] (ClientSocketWrapper.java:169) - reset timeout: 0
DEBUG [main] (InvokerRegistry.java:595) - removed SocketClientInvoker[77ff92f5, socket:<font color="darkgreen">//localhost:3873] from registry</font>
DEBUG [main] (MicroSocketClientInvoker.java:286) - SocketClientInvoker[77ff92f5, socket:<font color="darkgreen">//localhost:3873] disconnecting ...</font>
DEBUG [main] (SocketWrapper.java:123) - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=45285].b8c3679] closing
DEBUG [main] (SessionProxyObjectFactory.java:130) - Created Proxy of type $Proxy14 <font color="navy"><b>for</b></font> EJB3 Business Interface: de.kirchedlau.ponteseam.sessions.AccountingInterface
lookup 
session is Not Null
Proxy to jboss.j2ee:ear=PonteSeam-ear.ear,jar=PonteSeam-ejb.jar,name=AccountingBean,service=EJB3 implementing [<font color="navy"><b>interface</b></font> de.kirchedlau.ponteseam.sessions.AccountingInterface]
DEBUG [main] (SessionProxyInvocationHandlerBase.java:187) - Couldn<font color="navy">'t handle invocation directly within org.jboss.ejb3.proxy.impl.handler.session.SessionRemoteProxyInvocationHandler@5421e554: Current invocation "public abstract java.util.Collection de.kirchedlau.ponteseam.sessions.AccountingInterface.getInstitutionTypeList()" is not eligible for direct handling by org.jboss.ejb3.proxy.impl.handler.session.SessionRemoteProxyInvocationHandler@5421e554</font>
DEBUG [main] (SecurityAssociation.java:147) - Using ThreadLocal: <font color="navy"><b>false</b></font>
DEBUG [main] (MicroSocketClientInvoker.java:253) - SocketClientInvoker[7e859a68, socket:<font color="darkgreen">//localhost:3873] constructed</font>
DEBUG [main] (MicroRemoteClientInvoker.java:240) - SocketClientInvoker[7e859a68, socket:<font color="darkgreen">//localhost:3873] connecting</font>
DEBUG [main] (MicroSocketClientInvoker.java:735) - Creating semaphore with size 50
DEBUG [main] (MicroRemoteClientInvoker.java:245) - SocketClientInvoker[7e859a68, socket:<font color="darkgreen">//localhost:3873] connected</font>
DEBUG [main] (ClientSocketWrapper.java:169) - reset timeout: 0
java.lang.NullPointerException
&#160;&#160;&#160; at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:379)
&#160;&#160;&#160; at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)
&#160;&#160;&#160; at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)
&#160;&#160;&#160; at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
&#160;&#160;&#160; at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
&#160;&#160;&#160; at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)
&#160;&#160;&#160; at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
&#160;&#160;&#160; at org.jboss.remoting.Client.invoke(Client.java:1634)
&#160;&#160;&#160; at org.jboss.remoting.Client.invoke(Client.java:548)
&#160;&#160;&#160; at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
&#160;&#160;&#160; at $Proxy16.invoke(Unknown Source)
&#160;&#160;&#160; at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
&#160;&#160;&#160; at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
&#160;&#160;&#160; at $Proxy15.getInstitutionTypeList(Unknown Source)
&#160;&#160;&#160; at de.kirchedlau.ponte.ejb.sessions.AccoutingBeanTest.testGetInstitutionTypeList(AccoutingBeanTest.java:46)
&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:597)
&#160;&#160;&#160; at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
&#160;&#160;&#160; at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
&#160;&#160;&#160; at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
&#160;&#160;&#160; at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
&#160;&#160;&#160; at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
&#160;&#160;&#160; at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
&#160;&#160;&#160; at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
&#160;&#160;&#160; at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
&#160;&#160;&#160; at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
&#160;&#160;&#160; at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
&#160;&#160;&#160; at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
&#160;&#160;&#160; at $Proxy16.invoke(Unknown Source)
&#160;&#160;&#160; at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)
&#160;&#160;&#160; at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)
&#160;&#160;&#160; at $Proxy15.getInstitutionTypeList(Unknown Source)
&#160;&#160;&#160; at de.kirchedlau.ponte.ejb.sessions.AccoutingBeanTest.testGetInstitutionTypeList(AccoutingBeanTest.java:46)
&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
&#160;&#160;&#160; at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
&#160;&#160;&#160; at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
&#160;&#160;&#160; at java.lang.reflect.Method.invoke(Method.java:597)
&#160;&#160;&#160; at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
&#160;&#160;&#160; at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
&#160;&#160;&#160; at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
&#160;&#160;&#160; at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
&#160;&#160;&#160; at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
&#160;&#160;&#160; at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
&#160;&#160;&#160; at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
&#160;&#160;&#160; at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
&#160;&#160;&#160; at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
&#160;&#160;&#160; at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
&#160;&#160;&#160; at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
DEBUG [main] (InvokerRegistry.java:595) - removed SocketClientInvoker[7e859a68, socket:<font color="darkgreen">//localhost:3873] from registry</font>
DEBUG [main] (MicroSocketClientInvoker.java:286) - SocketClientInvoker[7e859a68, socket:<font color="darkgreen">//localhost:3873] disconnecting ...</font>
DEBUG [main] (SocketWrapper.java:123) - ClientSocketWrapper[Socket[addr=/127.0.0.1,port=3873,localport=45286].37722456] closing
</code></pre><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>What is wrong?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Manu</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/552602#552602">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in EJB 3.0 at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>