I looked at SeamTest and felt kind of silly for not putting any of the test 
logic in a script.  I changed it thusly:


  | public class GreeterTest extends SeamTest {
  | 
  |     @Test
  |     public void testGreeterHello() throws Exception {
  |             new Script() {
  |                     @Override
  |                     protected void invokeApplication() {
  |                             Greeter g = (Greeter) 
Component.getInstance("greeter");
  | 
  |                             assert "Hello, world!".equals(g.getHello());
  |                     }
  |             }.run();
  |     }
  | }
  | 

And at least I got a more familiar error.  



  | 
  | org.jboss.seam.InstantiationException: Could not instantiate Seam 
component: greeter
  |     at org.jboss.seam.Component.newInstance(Component.java:1440)
  |     at org.jboss.seam.Component.getInstance(Component.java:1350)
  |     at org.jboss.seam.Component.getInstance(Component.java:1324)
  |     at org.jboss.seam.Component.getInstance(Component.java:1318)
  |     at bizint.fiat.test.GreeterTest$1.invokeApplication(GreeterTest.java:18)
  |     at org.jboss.seam.mock.SeamTest$Script.run(SeamTest.java:242)
  |     at bizint.fiat.test.GreeterTest.testGreeterHello(GreeterTest.java:22)
  | Caused by: javax.naming.NoInitialContextException: Need to specify class 
name in environment or system property, or as an applet parameter, or in an 
application resource file:  java.naming.factory.initial
  |     at 
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
  |     at 
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
  |     at 
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
  |     at javax.naming.InitialContext.lookup(InitialContext.java:392)
  |     at org.jboss.seam.Component.instantiate(Component.java:809)
  |     at org.jboss.seam.Component.newInstance(Component.java:1436)
  |     ... 23 more
  | ... Removed 17 stack frames
  | 

I've always wondered at the generality of "could not instantiate Seam 
component".  Why not?  Was the underlying class not found?  Name not resolved?  
Bad Mood?  Stars not in alignment?   Doesn't seem to be name related, because 
when I try Component.getInstance("kwyjibo") I get the ubuquitous 
NullPointerException instead (Java seems to give me more of those than I ever 
got in C or C++)

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968493
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to