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 3402044
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:05:23+00:00 2026-05-18T05:05:23+00:00

I have this simple class: public class LuceneUtil{ private final EntityManager entityManager; public LuceneUtil()

  • 0

I have this simple class:

    public class LuceneUtil{

    private final EntityManager entityManager;

public LuceneUtil() {
        entityManager = (EntityManager) Component.getInstance("entityManager");
    }

//other code
}

If i use this class “normally” (i mean with deploy and etc) all works well.
But, if i try to use it from my test classes, when it tries to load the entityManager, it gives:

java.lang.IllegalStateException: No application context active

Does anyone has any ideea: why?

Stacktrace:

java.lang.IllegalStateException: No application context active
    at org.jboss.seam.Component.forName(Component.java:1945)
    at org.jboss.seam.Component.getInstance(Component.java:2005)
    at org.jboss.seam.Component.getInstance(Component.java:1983)
    at org.jboss.seam.Component.getInstance(Component.java:1977)
    at org.jboss.seam.Component.getInstance(Component.java:1972)
    at com.unifiedpost.my.docstore.query.LucenePropertyUtil.<init>(LucenePropertyUtil.java:27)
    at com.unifiedpost.my.docstore.query.PropertyQuery.<init>(PropertyQuery.java:16)
    at com.unifiedpost.my.docstore.query.EqualsPropertyQuery.<init>(EqualsPropertyQuery.java:16)
    at com.unifiedpost.docstore.it.rest.queries.QueryBuilder.prepareEquals(QueryBuilder.java:21)
    at com.unifiedpost.docstore.it.DocumentImporterTest.reindex(DocumentImporterTest.java:134)
    at com.unifiedpost.docstore.it.DocumentImporterTest.importDocumentAndIndexIt(DocumentImporterTest.java:107)
    at com.unifiedpost.docstore.it.rest.queries.InboxIndexQueryResourceBeanTest.testPropertyQuery(InboxIndexQueryResourceBeanTest.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:517)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:669)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:956)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
    at org.testng.TestRunner.runWorkers(TestRunner.java:720)
    at org.testng.TestRunner.privateRun(TestRunner.java:590)
    at org.testng.TestRunner.run(TestRunner.java:484)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
    at org.testng.SuiteRunner.run(SuiteRunner.java:204)
    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:864)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:830)
    at org.testng.TestNG.run(TestNG.java:748)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
java.lang.IllegalStateException: No application context active
    at org.jboss.seam.Component.forName(Component.java:1945)
    at org.jboss.seam.Component.getInstance(Component.java:2005)
    at org.jboss.seam.Component.getInstance(Component.java:1983)
    at org.jboss.seam.Component.getInstance(Component.java:1977)
    at org.jboss.seam.Component.getInstance(Component.java:1972)
    at com.unifiedpost.my.docstore.query.LucenePropertyUtil.<init>(LucenePropertyUtil.java:27)
    at com.unifiedpost.my.docstore.query.PropertyQuery.<init>(PropertyQuery.java:16)
    at com.unifiedpost.my.docstore.query.EqualsPropertyQuery.<init>(EqualsPropertyQuery.java:16)
    at com.unifiedpost.docstore.it.rest.queries.QueryBuilder.prepareEquals(QueryBuilder.java:21)
    at com.unifiedpost.docstore.it.DocumentImporterTest.reindex(DocumentImporterTest.java:134)
    at com.unifiedpost.docstore.it.DocumentImporterTest.importDocumentAndIndexIt(DocumentImporterTest.java:107)
    at com.unifiedpost.docstore.it.rest.queries.InboxIndexQueryResourceBeanTest.testPropertyQuery(InboxIndexQueryResourceBeanTest.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:517)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:669)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:956)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
    at org.testng.TestRunner.runWorkers(TestRunner.java:720)
    at org.testng.TestRunner.privateRun(TestRunner.java:590)
    at org.testng.TestRunner.run(TestRunner.java:484)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:332)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:327)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:299)
    at org.testng.SuiteRunner.run(SuiteRunner.java:204)
    at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:864)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:830)
    at org.testng.TestNG.run(TestNG.java:748)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
  • 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-18T05:05:24+00:00Added an answer on May 18, 2026 at 5:05 am

    You cannot use Seam components inside test cases without having a proper Seam application context setup. That means, you have to simulate that the Seam framework is deployed. Normally, you can achieve that by using the test framework of Seam and having an embedded JBoss in your classpath while running your test suite. You get a working application context, if you use your components as follows:

    public class LuceneUtilTest extends SeamTest {
    
        @Test
        public void initComponentTest() throws Exception {
            new ComponentTest() {
                @Override
                protected void testComponents() throws Exception {
                    LuceneUtil luceneUtilInstance = (LuceneUtil) Component.getInstance(LuceneUtil.class);
                    // ...
                }
            }.run();
        }
    }
    

    Within a ComponentTest Seam takes care that you have a running application context during the execution of your test cases. For more information see Testing Seam applications.

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

Sidebar

Related Questions

I have this simple class: import spark.effects.GlowFilter; public class Letter extends Sprite { private
I have this simple interface/class: public abstract class Message {} public class Message1 extends
Say we have this hyper simple class hierchy: public class SomeMath { public int
I have this very simple C++ class: class Tree { public: Node *head; };
I have this simple test project just to test the IncludeExceptionDetailInFaults behavior. public class
I have this simple structure: 1 parent, and two different childs. public class Parent{}
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
I have this sample text, which is retrieved from the class name on an
I have this simple regex, [\d]{1,5} that matches any integer between 0 and 99999.

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.