[jboss-user] [JBoss Seam] - Re: injection in tests ?

berkay do-not-reply at jboss.com
Mon Dec 31 10:20:11 EST 2007


Hi Pete,
It must be unit testing. Here is what I have tried with best of my knowledge. Here is my @BeforeClass method :
	@BeforeClass
  | 	public void init(){
  | 		try {
  | 			HibernateSessionFactory hsf=new HibernateSessionFactory();
  | 			hibernateSession=hsf.getSessionFactory().openSession();
  | 		} catch (HibernateException e) {
  | 			// TODO Auto-generated catch block
  | 			e.printStackTrace();
  | 		} catch (Exception e) {
  | 			// TODO Auto-generated catch block
  | 			e.printStackTrace();
  | 		}
  | 		
  | 	}
  | 

I get 

FAILED CONFIGURATION: @BeforeMethod begin
  | java.lang.IllegalStateException: Attempted to invoke a Seam component outside the an initialized application
  | 	at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
  | 	at org.jboss.seam.contexts.Lifecycle.beginSession(Lifecycle.java:173)
  | 	at org.jboss.seam.contexts.ServletLifecycle.beginSession(ServletLifecycle.java:124)
  | 	at org.jboss.seam.mock.BaseSeamTest.begin(BaseSeamTest.java:918)
  | 	at org.jboss.seam.mock.SeamTest.begin(SeamTest.java:28)
  | 

Happy new year

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116179#4116179

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116179



More information about the jboss-user mailing list