Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3958506
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:37:03+00:00 2026-05-20T02:37:03+00:00

I’ve got a project firstly written using EJB 2, then migrated to Spring and

  • 0

I’ve got a project firstly written using EJB 2, then migrated to Spring and after all migrated to JBoss Seam 2.2.0 (which is the situation I’m dealing with). It will run over Tomcat but for now it is executed over JBoss 4.2 (although I believe this fact is irrelevant). My task is to run all tests written before the last migration.

After a lot of googling, I wrote something like this:

public class CustomUserDAOTest extends SeamTest {
    @Test
    public void f() throws Exception {
        new ComponentTest() {
            @Override
            protected void testComponents() throws Exception {
                CustomUserDAO customUserDAO = (CustomUserDAO) Component.getInstance(CustomUserDAOBean.class);
                List<CustomUser> users = customUserDAO.getAll();
                assertNotNull(users);
            }
        }.run();
    }
}

That is good because I managed to get instances of CustomUserDAOBean and its dependencies, but when I run the test I get another problem:

java.lang.RuntimeException: exception invoking: getTransaction
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
    at org.jboss.seam.Component.callComponentMethod(Component.java:2249)
    at org.jboss.seam.Component.unwrap(Component.java:2275)
    at org.jboss.seam.Component.getInstance(Component.java:2041)
    [OMITTED]
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
    at br.com.visent.sicorp.server.dao.impl.CustomUserDAOBean_$$_javassist_seam_1.listAll(CustomUserDAOBean_$$_javassist_seam_1.java)
    at br.com.visent.sicorp.server.dao.test.CustomUserDAOTest$1.testComponents(CustomUserDAOTest.java:24)
    at org.jboss.seam.mock.AbstractSeamTest$ComponentTest.run(AbstractSeamTest.java:162)
    [OMITTED]
    at org.testng.TestNG.run(TestNG.java:856)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:110)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:174)
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)
    [OMITTED]
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
    ... 45 more

I found some comments about it on the Web but no solution. What should I do? Has someone any ideas?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:37:04+00:00Added an answer on May 20, 2026 at 2:37 am

    I’ve followed the suggestion of Shervin above and got a solution. Actually, when we create a project using seam-gen the src/test directory will contain a readme.txt with the following content:

    If you want to run tests using the Eclipse TestNG plugin, you'll need to add
    these jars to the top of your TestNG classpath. Using the Run Dialog, select the
    XML suite to run, and select these entries from the project tree:
    
    /lib/test/jboss-embedded-all.jar
    /lib/test/hibernate-all.jar
    /lib/test/thirdparty-all.jar
    /lib/jboss-embedded-api.jar
    /lib/jboss-deployers-client-spi.jar
    /lib/jboss-deployers-core-spi.jar
    
    You also need to add the Embedded JBoss bootstrap folder, which you can do by
    clicking on the Advanced... button.
    
    /bootstrap
    
    Seam uses JBoss Embedded in its unit and integration testing. This has an
    additional requirement when using JDK 6. Add the following VM argument to the VM
    args tab in the TestNG launch configuration for your suite.
    
    -Dsun.lang.ClassLoader.allowArraySyntax=true 
    
    Please be sure to use JDK 6 Update 4 or better (>= 1.6.0_04) if you are using
    JDK 6. The Update 4 release upgraded to JAXB 2.1 which removes a problem with
    earlier versions of Sun's JDK 6 which required overriding the JAXB libraries
    using the endorsed directory. 
    
    To add tests to your project create a TestNG xml descriptor called *Test.xml
    (e.g. FooTest.xml) next to your test classes and run ant test.
    

    I opened the “Run Configurations” of the test (which can be made through the button “Run” on the toolbar, clicking in the little black down arrow and selecting “Run Configurations”), added the jars listed above in the “Classpath” tab (except for jboss-deployers-client-spi.jar, which was problematic) and added -Dsun.lang.ClassLoader.allowArraySyntax=true to the “VM Arguments” in the “Arguments” tab because I am using Java 6.

    I still have some problems but this specific one is solved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.