0 Replies Latest reply on Oct 9, 2007 2:17 PM by rizqureshi2

    TestNG throws exception if @PersistenceContext is used in a

    rizqureshi2

      I get the following error when I have a bean with @PersistenceContext declaration:
      ("register" is the name of bean used)

      FAILED CONFIGURATION: @BeforeClass init
      java.lang.RuntimeException: Could not create Component: register
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:833)
      at org.jboss.seam.init.Initialization.addComponents(Initialization.java:715)
      at org.jboss.seam.init.Initialization.init(Initialization.java:478)
      at org.jboss.seam.mock.SeamTest.init(SeamTest.java:701)
      Caused by: java.lang.IllegalArgumentException: @PersistenceContext may only be used on session bean or message driven bean components: register
      at org.jboss.seam.Component.initMembers(Component.java:541)
      at org.jboss.seam.Component.(Component.java:250)
      at org.jboss.seam.Component.(Component.java:200)
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:823)
      ... 25 more
      ... Removed 22 stack frames

      -----------------------------------------------------------------------------
      I have been working on this problem for days and no success yet. Am I missing out something? Also note that the project deploys & runs fine on JBoss-As without any problem, so why should the TestNG case throw the above exception??