Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
17. Mar 2008, 17:55 CET | Link

Hi,

I wrote my first, simple TestNG test, extending SeamTest just like the examples. The test itself is empty and does nothing. When I run it, I get the following exception:

Caused by: java.lang.IllegalArgumentException: You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: userSearch at org.jboss.seam.Component.getJndiName(Component.java:438) at org.jboss.seam.Component.<init>(Component.java:243) at org.jboss.seam.Component.<init>(Component.java:217) at org.jboss.seam.init.Initialization.addComponent(Initialization.java:961) ... 27 more ... Removed 22 stack frames

Is this a classpath issue? I've added all sorts of jars to the classpath but still get the exception.

Environment: IBM RAD 6.1.

Thanks in advance for any help, Bill

5 Replies:
17. Mar 2008, 21:21 CET | Link

Anyone? I don't even know where to begin looking...

19. Mar 2008, 10:38 CET | Link

Hi,

I write here to know if you've found a solution to your problem, because I'm facing the same right now...

FAILED CONFIGURATION: @BeforeClass init
java.lang.RuntimeException: Could not create Component: myComponent
        at org.jboss.seam.init.Initialization.addComponent(Initialization.java:976)
        at org.jboss.seam.init.Initialization.installComponents(Initialization.java:898)
        at org.jboss.seam.init.Initialization.init(Initialization.java:576)
        at org.jboss.seam.mock.BaseSeamTest.startSeam(BaseSeamTest.java:939)
        at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:923)
        at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
Caused by: java.lang.IllegalArgumentException: You must specify org.jboss.seam.core.init.jndiPattern or use @JndiName: myComponent
        at org.jboss.seam.Component.getJndiName(Component.java:438)
        at org.jboss.seam.Component.<init>(Component.java:243)
        at org.jboss.seam.Component.<init>(Component.java:217)
        at org.jboss.seam.init.Initialization.addComponent(Initialization.java:961)
        ... 27 more
... Removed 22 stack frames

My components.xml for tests uses this jndi pattern

#{ejbName}/local

My classpath uses : jboss-embedded-all.jar hibernate-all.jar thirdparty-all.jar testng.jar bootstrap (a folder that I picked from Seam and imported without any modification... I would be glad to know if tests could work without this one)

Any clue to make this work ? Does someone know a resource that explain exactly how the Seam tests work with testng ?

Thanks

Dazzx

PS : I tried to create a project with seam-gen to see tests working, but It didn't work...

20. Mar 2008, 18:56 CET | Link

No, I haven't gotten it working. Instead, I thought I'd try to get out-of-the-box TestNG tests (from seam-gen) working with JBoss. I can't even get those to work, although the error is slightly different. See my new post here.

28. Aug 2008, 12:47 CET | Link

I had same issues - finally it was resolved by adding web-root folder into test-run class-path (how to do it - depends from IDE you are using - I used NetBeans and JUnit4 to run tests)

Since web-root is not added into class-path, test runner cannot find WEB-INF/components.xml during Seam initialization - and used default settings

 

With Best Regards,

Alexey Kakunin

EmForge Configuration Management

15. Oct 2008, 19:14 CET | Link
Same here... if you're testing a project that is a dependency and has no descriptors, just make sure your test-build/META-INF directory (assuming you're building in a seam-gen-friendly way) does contain components.xml (and persistence.xml if you're also testing DB access). In components.xml make sure you have the following:


`<core:init debug="true" jndi-pattern="#{ejbName}/local"/>`
  There is no ear named in this jndi pattern as you're outside any ear.

An alternative consists in putting this into your seam.properties:

org.jboss.seam.core.init.jndiPattern = #{ejbName}/local

Anyway, you need this bootstrap directory in your test classpath if you want any advanced feature while testing. For example, this is where you deploy your datasource descriptor (bootstrap/deploy).