TestNG @PersistenceContext Error
paper57 Apr 23, 2007 7:20 PMI'm trying to develop some testNG unit tests, following the model in the booking example. Any of my beans that use @PersistenceContext generate the following error as the tests try to start:
Caused by: java.lang.IllegalArgumentException: @PersistenceContext may only be used on session bean or message driven bean components: coverageClassFactory
I have also noticed that unlike the booking example, the JNDI Name does not show up as the classes are processed:
12:56:03,213 INFO [Component] Component: authenticator, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: org.jboss.seam.example.booking.AuthenticatorAction, JNDI: AuthenticatorAction/local
In the booking example, in mine I do not have the
JNDI: AuthenticatorAction/local
part.
Does anyone know what might cause this?
Full log
16:14:22,019 INFO [Scanner] scanning: /C:/Java/Seam/jboss-seam-1.2.1.GA/jboss-seam-remoting.jar 16:14:22,035 INFO [Scanner] scanning: /C:/Java/Seam/jboss-seam-1.2.1.GA/jboss-seam.jar 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/security, package: org.jboss.seam.security, prefix: org.jboss.seam.security 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/drools, package: org.jboss.seam.drools, prefix: org.jboss.seam.drools 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/mail, package: org.jboss.seam.mail, prefix: org.jboss.seam.mail 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/web, package: org.jboss.seam.web, prefix: org.jboss.seam.web 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/remoting, package: org.jboss.seam.remoting, prefix: org.jboss.seam.remoting 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/theme, package: org.jboss.seam.theme, prefix: org.jboss.seam.theme 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/core, package: org.jboss.seam.core, prefix: org.jboss.seam.core 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/jms, package: org.jboss.seam.jms, prefix: org.jboss.seam.jms 16:14:22,050 INFO [Initialization] Namespace: http://jboss.com/products/seam/framework, package: org.jboss.seam.framework, prefix: org.jboss.seam.core.framework 16:14:22,066 INFO [Scanner] scanning: C:\Documents and Settings\rpape\My Documents\Java Projects\DAPSettings\build\test 16:14:22,082 INFO [Initialization] reading /WEB-INF/components.xml 16:14:22,207 INFO [Initialization] reading jar:file:/C:/Java/Seam/jboss-seam-1.2.1.GA/jboss-seam-remoting.jar!/META-INF/components.xml 16:14:22,207 INFO [Initialization] reading jar:file:/C:/Java/Seam/jboss-seam-1.2.1.GA/jboss-seam.jar!/META-INF/components.xml 16:14:22,238 INFO [Initialization] reading properties from: /seam.properties 16:14:22,238 INFO [Initialization] reading properties from: /jndi.properties 16:14:22,238 INFO [Initialization] initializing Seam 16:14:22,269 INFO [Scanner] scanning: C:\Documents and Settings\rpape\My Documents\Java Projects\DAPSettings\build\test 16:14:22,535 INFO [Scanner] scanning: /C:/Java/Seam/jboss-seam-1.2.1.GA/jboss-seam-remoting.jar 16:14:22,660 INFO [Scanner] scanning: /C:/Java/Seam/jboss-seam-1.2.1.GA/jboss-seam.jar 16:14:23,957 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.persistence.persistenceProvider 16:14:23,972 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.security.identity 16:14:24,019 INFO [Component] Component: org.jboss.seam.core.init, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.Init 16:14:24,113 INFO [Initialization] Installing components... 16:14:24,144 INFO [Component] Component: Customer, scope: CONVERSATION, type: ENTITY_BEAN, class: com.foo.customer.Customer 16:14:24,160 INFO [Component] Component: CustomerDivision, scope: CONVERSATION, type: ENTITY_BEAN, class: com.foo.customer.CustomerDivision 16:14:24,160 WARN [Component] Component class should be serializable: catalogBean 16:14:24,160 INFO [Component] Component: catalogBean, scope: SESSION, type: JAVA_BEAN, class: com.foo.dap.catalog.DAPCatalogBean 16:14:24,222 INFO [Component] Component: coverageClassFactory, scope: EVENT, type: JAVA_BEAN, class: com.foo.dap.settings.labor.CoverageClassFactoryAction Failed to invoke @Configuration method org.jboss.seam.mock.SeamTest.init:Could not create Component: coverageClassFactory FAILED: init java.lang.RuntimeException: Could not create Component: coverageClassFactory at org.jboss.seam.init.Initialization.addComponent(Initialization.java:865) at org.jboss.seam.init.Initialization.installComponents(Initialization.java:796) at org.jboss.seam.init.Initialization.init(Initialization.java:503) 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: coverageClassFactory at org.jboss.seam.Component.initMembers(Component.java:663) at org.jboss.seam.Component.<init>(Component.java:253) at org.jboss.seam.Component.<init>(Component.java:203) at org.jboss.seam.init.Initialization.addComponent(Initialization.java:851) ... 25 more ... Removed 22 stack frames SKIPPED: begin SKIPPED: end SKIPPED: testSubmit SKIPPED: cleanup =============================================== Login Tests run: 5, Failures: 1, Skips: 4 ===============================================