Hello list,

I'm running JBoss 3.2.1 with the 1.4.2 Sun JDK (I think it was compiled with 1.4.1) on a Mandrake Linux 9.1 box.

Some issues with common classes between our modules led to the necessity of using ear scoping in our ears. Now the problem is we run JUnitEJB tests with classes in the ear, and junitejb.jar and junit.jar are deployed separately (at least JUnitEJB needs to be redeployed each time the app gets redeployed, I don't know about Junit though). I start the JBoss server and deploy my application, but when I run it sometimes I'd get an error saying "test class not found". From what I know, ear scoping means using a different repository for the classes in the ear archive, does this mean that the EJBTestRunner will not be able to find the test class using the default class loader, which looks in the default class repository? What are the best solutions for this?

The junit.jar is a bit too large and I'm not too willing to put it in our ear files, so I tried to only put the junitejb.jar, but then I'd get the error message in the first attachment (a ClassCastException, which means I'm back in the classloader issues business! what a joy...). How should I package the classes? Before using ear scoping the junit and junitejb jar files were being deployed each time the application was deployed, because otherwise the EJBTestRunner session bean would run into classloader issues when redeploying the app (InvalidInvocation exceptions).

In the second attachment you have a stack trace (ant + junit stack trace) of the "test class not found" remote exception thrown back by the EJBTestRunner session bean to the test case I run.
ra-setup:
    [junit] .E
    [junit] Time: 1.305
    [junit] There was 1 error:
    [junit] 1) testSetUp(org.eupki.ra.test.RASetup)java.lang.ClassCastException
    [junit]     at org.eupki.ra.test.RASetup.testSetUp(RASetup.java:71)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at net.sourceforge.junitejb.EJBTestCase.runBare(EJBTestCase.java:133)
    [junit]     at 
net.sourceforge.junitejb.EJBTestRunnerBean.runTestCase(EJBTestRunnerBean.java:102)
    [junit]     at 
net.sourceforge.junitejb.EJBTestRunnerBean.run(EJBTestRunnerBean.java:44)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
    [junit]     at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
    [junit]     at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
    [junit]     at 
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
    [junit]     at 
org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
    [junit]     at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
    [junit]     at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
    [junit]     at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
    [junit]     at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    [junit]     at 
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
    [junit]     at org.jboss.ejb.Container.invoke(Container.java:674)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
    [junit]     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
    [junit]     at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
    [junit]     at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
    [junit]     at sun.rmi.transport.Transport$1.run(Transport.java:148)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    [junit]     at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    [junit]     at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    [junit]     at java.lang.Thread.run(Thread.java:534)
    [junit] FAILURES!!!
    [junit] Tests run: 1,  Failures: 0,  Errors: 1

ra-setup:
    [junit] .E
    [junit] Time: 0.961
    [junit] There was 1 error:
    [junit] 1) testSetUp(org.eupki.ra.test.RASetup)java.rmi.ServerException: 
RemoteException occurred in server thread; nested exception is:
    [junit]     java.rmi.ServerException: EJBException:; nested exception is:
    [junit]     javax.ejb.EJBException: Test class not found : 
org.eupki.ra.test.RASetup
    [junit]     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
    [junit]     at sun.rmi.transport.Transport$1.run(Transport.java:148)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    [junit]     at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    [junit]     at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    [junit]     at java.lang.Thread.run(Thread.java:534)
    [junit]     at 
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    [junit]     at 
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    [junit]     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
    [junit]     at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown 
Source)
    [junit]     at 
org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
    [junit]     at 
org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:87)
    [junit]     at 
org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
    [junit]     at 
org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
    [junit]     at 
org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
    [junit]     at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
    [junit]     at $Proxy1.run(Unknown Source)
    [junit]     at net.sourceforge.junitejb.EJBTestCase.runBare(EJBTestCase.java:110)
    [junit]     at net.sourceforge.junitejb.EJBTestCase.run(EJBTestCase.java:95)
    [junit] Caused by: java.rmi.ServerException: EJBException:; nested exception is:
    [junit]     javax.ejb.EJBException: Test class not found : 
org.eupki.ra.test.RASetup
    [junit]     at 
org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:346)
    [junit]     at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
    [junit]     at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
    [junit]     at 
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:322)
    [junit]     at org.jboss.ejb.Container.invoke(Container.java:674)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at 
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
    [junit]     at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
    [junit]     at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
    [junit]     at sun.rmi.transport.Transport$1.run(Transport.java:148)
    [junit]     at java.security.AccessController.doPrivileged(Native Method)
    [junit]     at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
    [junit]     at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
    [junit]     at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
    [junit]     at java.lang.Thread.run(Thread.java:534)
    [junit] Caused by: javax.ejb.EJBException: Test class not found : 
org.eupki.ra.test.RASetup
    [junit]     at 
net.sourceforge.junitejb.EJBTestRunnerBean.getTestInstance(EJBTestRunnerBean.java:167)
    [junit]     at 
net.sourceforge.junitejb.EJBTestRunnerBean.run(EJBTestRunnerBean.java:38)
    [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [junit]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    [junit]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    [junit]     at 
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:629)
    [junit]     at 
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
    [junit]     at 
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
    [junit]     at 
org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
    [junit]     at 
org.jboss.ejb.plugins.TxInterceptorBMT.invoke(TxInterceptorBMT.java:62)
    [junit]     at 
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
    [junit]     at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:117)
    [junit]     at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
    [junit]     ... 21 more
    [junit] FAILURES!!!
    [junit] Tests run: 1,  Failures: 0,  Errors: 1

Reply via email to