0 Replies Latest reply on Jun 6, 2007 8:28 PM by Fumihiko Sugiyama

    java.lang.NoClassDefFoundError: net/sf/ehcache/CacheExceptio

    Fumihiko Sugiyama Newbie

      Hi

      In Seam Gen-generated project, I want to Unit Testing a stateful Seam component.
      I want to create EntityManager in Unit Testing Code for injecting it in the Seam component with SeamTest#setField().

      Running "ant test", java.lang.NoClassDefFoundError is thrown at this code.

      public class FooTest extends SeamTest {
       ... ...
       @Test
       public void testFind() {
       EntityManagerFactory emf = Persistence.createEntityManagerFactory("myproject");
       ... ...
       }
       ... ...
      }
      

      "myproject" is persistence unit name defined in "resources/META-INF/persistence-test.xml".

       [testng] FAILED: seam.sandbox.unittesting.FooTest.testFind()
       [testng] java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
       [testng] at java.lang.Class.getDeclaredConstructors0(Native Method)
       [testng] at java.lang.Class.privateGetDeclaredConstructors(Class.java:23
      7)
       [testng] at java.lang.Class.getConstructor0(Class.java:2671)
       [testng] at java.lang.Class.newInstance0(Class.java:321)
       [testng] at java.lang.Class.newInstance(Class.java:303)
       [testng] at org.hibernate.cfg.SettingsFactory.createCacheProvider(Settin
      sFactory.java:346)
       [testng] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFact
      ry.java:220)
       [testng] at org.hibernate.cfg.Configuration.buildSettings(Configuration.
      ava:1928)
       [testng] at org.hibernate.cfg.Configuration.buildSessionFactory(Configur
      tion.java:1211)
       [testng] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactor
      (Ejb3Configuration.java:631)
       [testng] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFacto
      y(Ejb3Configuration.java:760)
       [testng] at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Config
      ration.java:151)
       [testng] at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFacto
      y(Ejb3Configuration.java:205)
       [testng] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFa
      tory(HibernatePersistence.java:114)
       [testng] at javax.persistence.Persistence.createEntityManagerFactory(Per
      istence.java:37)
       [testng] at javax.persistence.Persistence.createEntityManagerFactory(Per
      istence.java:27)
       [testng] at seam.sandbox.unittesting.FooTest.testFind(FooTest.java:13)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       [testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
      sorImpl.java:39)
       [testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
      hodAccessorImpl.java:25)
       [testng] at java.lang.reflect.Method.invoke(Method.java:585)
       [testng] at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.j
      va:529)
       [testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:398)
       [testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:6
      5)
       [testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.ja
      a:88)
       [testng] at org.testng.TestRunner.privateRun(TestRunner.java:614)
       [testng] at org.testng.TestRunner.run(TestRunner.java:505)
       [testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:221)
       [testng] at org.testng.SuiteRunner.run(SuiteRunner.java:147)
       [testng] at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:576)
       [testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:539)
       [testng] at org.testng.TestNG.run(TestNG.java:316)
       [testng] at org.testng.TestNG.privateMain(TestNG.java:666)
       [testng] at org.testng.TestNG.main(TestNG.java:608)
      


      any Hints how to solve this problem?

      [environment]
      JBoss AS 4.2.0.GA
      JBoss Seam CVS
      (After reading Gavin's last message in http://www.jboss.com/index.html?module=bb&op=viewtopic&t=110304, I checkouted.)

      Thanks