Huwy Geschrieben 23. Juni 2009 Geschrieben 23. Juni 2009 Hallo zusammen, ich lerne zur Zeit Java und habe mir etwas Grundwissen angeeignet. Ich muss in meiner Ausbildung nun Testklassen über JUnit für ein Projekt schreiben. Das hat auch alles ganz gut geklappt - immerhin funktionieren 13 von 15 Tests positiv Nun habe ich mich auf die Fehlersuche bei einer Klasse begeben. Dabei bekomme ich einen "AssertionFailedError" beim Ausführen von 2 Methoden in dieser Klasse. junit.framework.AssertionFailedError at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.fail(Assert.java:53) at com.xxx.yyy.jmeter.performance.InventoryTest.test_IZ1(InventoryTest.java:276) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Aus der Konsole hab ich dann Folgendes entnommen. java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.ServerError: Unexpected Error:; nested exception is: java.lang.NoClassDefFoundError: com/xxx/mdutils/MasterDataServiceException at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) at java.lang.Thread.run(Thread.java:595) at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126) at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source) at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135) at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:163) at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:103) at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46) at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55) at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100) at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86) at $Proxy11.reconcilateProductInventory(Unknown Source) at com.xxx.fifostockvalueqatest.jmeter.performance.InventoryTest.test_IAandIZ1(InventoryTest.java:425) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) Caused by: java.rmi.ServerError: Unexpected Error:; nested exception is: java.lang.NoClassDefFoundError: com/xxx/mdutils/MasterDataServiceException at com.xxx.jboss.monitoring.ejb.LongRunningEjbLogInterceptor.handleException(LongRunningEjbLogInterceptor.java:282) at com.xxx.jboss.monitoring.ejb.LongRunningEjbLogInterceptor.invoke(LongRunningEjbLogInterceptor.java:115) at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331) at org.jboss.ejb.Container.invoke(Container.java:709) at sun.reflect.GeneratedMethodAccessor75.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:60) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:62) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:54) at org.jboss.mx.server.Invocation.invoke(Invocation.java:82) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:198) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:473) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:360) at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) at java.lang.Thread.run(Thread.java:595) Caused by: java.lang.NoClassDefFoundError: com/xxx/mdutils/MasterDataServiceException at com.xxx.fifostockvalue.inventorystockcorrectionrecord.appserver.InventoryBean.writeIZ(InventoryBean.java:1377) at com.xxx.fifostockvalue.inventorystockcorrectionrecord.appserver.InventoryBean._writeIA_IZ(InventoryBean.java:1120) at com.xxx.fifostockvalue.inventorystockcorrectionrecord.appserver.InventoryBean.writeIA_IZ(InventoryBean.java:886) at com.xxx.fifostockvalue.inventorystockcorrectionrecord.appserver.InventoryBean.doReconcilation(InventoryBean.java:766) at com.xxx.fifostockvalue.inventorystockcorrectionrecord.appserver.InventoryBean.reconcilateProductInventory(InventoryBean.java:640) at sun.reflect.GeneratedMethodAccessor390.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683) at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:317) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:150) at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:111) at com.xxx.jboss.monitoring.ejb.LongRunningEjbLogInterceptor.invoke(LongRunningEjbLogInterceptor.java:113) Das große Problem ist meiner Ansicht nach der "NoClassDefFoundError". Habe ein bißchen gegoogelt und herausgefunden, dass die "Definition der Klasse zur Laufzeit" fehlt. Also müsste es doch reichen, wenn ich die Klasse importiere!? Naja ... ich arbeite mit Eclipse und wenn ich "import com.media_saturn.mdutils.MasterDataServiceException;" eintippe gibt er mir die auch vor - unterringelt sie aber gelb. --> "The import is never used" Das verstehe ich nicht :confused: Wahrscheinlich ein Anfängerfehler - aber seid nicht zu hart zu mir :cool: Danke und viele Grüße Thomas
kingofbrain Geschrieben 23. Juni 2009 Geschrieben 23. Juni 2009 In der Exception ist die Rede von einer Klasse com/xxx/mdutils/MasterDataServiceException, nicht von com.media_saturn.mdutils.MasterDataServiceException. Hast Du das im Quellodeausschnitt verändert? Wenn ja, ein Import bringt Dir nichts, sondern die Bibliothek muss zur Laufzeit im Classpath sein. Das JAR, in dem die Klasse also liegt, muss dem Server (JBoss?) bekannt sein. Schöne Grüße nach Ingolstadt! Peter
Huwy Geschrieben 23. Juni 2009 Autor Geschrieben 23. Juni 2009 (bearbeitet) Ups ... da hat wohl alles suchen und ersetzen nix gebracht Also der import ist schon richtig. Hab da nur vergessen, zu ersetzen Ah okay. Ich dachte, wenn Eclipse mir das sogar vorschlägt, dass das dann auch vorhanden ist Und ja - JBoss .. dann muss ich morgen die Klasse noch auschecken .. danke Danke für die Grüße :cool: Bearbeitet 23. Juni 2009 von Huwy zu schnell gesendent ^^
kingofbrain Geschrieben 24. Juni 2009 Geschrieben 24. Juni 2009 Auschecken allein wird nicht reichen, Du musst sie auch im JBoss bekannt machen (Im EAR oder WAR, falls vorhanden, oder an einer anderen Stelle, die zum Classpath des Deployten Artefakts gehört). Peter
Huwy Geschrieben 24. Juni 2009 Autor Geschrieben 24. Juni 2009 Das bekomme ich schon hin. Irgendwann ist immer das erste Mal Mal abgesehen davon kann ich heute bei dem Projekt gar ned weiterarbeiten, weil der JBoss mal wieder rumspackt :floet:
perdian Geschrieben 25. Juni 2009 Geschrieben 25. Juni 2009 weil der JBoss mal wieder rumspacktHerrlich, es gibt ja nichts über Leute, die ihre Probleme gut in Worte fassen können :upps
Empfohlene Beiträge
Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren
Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können
Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!
Neues Benutzerkonto erstellenAnmelden
Du hast bereits ein Benutzerkonto? Melde Dich hier an.
Jetzt anmelden