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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:07:53+00:00 2026-05-24T00:07:53+00:00

I want to move a long-running process in an Java EE application from synchronous

  • 0

I want to move a long-running process in an Java EE application from synchronous to asynchronous execution. The process should start automatically and then run every hour.
The project runs in Glassfish 3.1 with Java EE 6.

After some reading, I believe that I can start such services in Java EE 6 via @Singleton and @Startup.
So, I create a new class

@Startup
@Singleton
public class MyService {
}

and run the existing integration tests via maven.
To my surprise, the tests fail, down to the the most basic “page is there”-test. They don’t find the webpages any longer, instead getting error pages.

Experimenting, I remove the @Startup annotation, and run the tests once more. This time, they succeed.

Manually starting a server and navigating to the page yields the expected result: The page is there.
What’s more, in eclipse, the tests they succeed with both annotations in place. The only difference I can see is that it is eclipse that starts the server, not the Cargo Maven plugin.

What could possibly go wrong here?
What do I have to do to use @Startup correctly?

Update:
After switching back to IntelliJ IDEA from eclipse, I still have this problem.
However, I see some exceptions – maybe you can make something out of them:

[#|2011-07-25T10:22:51.529+0200|SEVERE|glassfish3.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=65;_ThreadName=Thread-1;|Exception while invoking class org.glassfish.ejb.startup.EjbApplication start method

javax.ejb.EJBException: javax.ejb.CreateException: Initialization failed for Singleton MailService
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:719)
at com.sun.ejb.containers.AbstractSingletonContainer.instantiateSingletonInstance(AbstractSingletonContainer.java:449)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:216)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.initializeSingleton(SingletonLifeCycleManager.java:177)
at org.glassfish.ejb.startup.SingletonLifeCycleManager.doStartup(SingletonLifeCycleManager.java:155)
at org.glassfish.ejb.startup.EjbApplication.start(EjbApplication.java:177)
…

Caused by: javax.ejb.CreateException: Initialization failed for Singleton MailService
at com.sun.ejb.containers.AbstractSingletonContainer.createSingletonEJB(AbstractSingletonContainer.java:545)
at com.sun.ejb.containers.AbstractSingletonContainer.access$100(AbstractSingletonContainer.java:79)
at com.sun.ejb.containers.AbstractSingletonContainer$SingletonContextFactory.create(AbstractSingletonContainer.java:717)
… 36 more

Caused by: java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:1209)
at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:144)
at org.glassfish.weld.services.JCDIServiceImpl._createJCDIInjectionContext(JCDIServiceImpl.java:144)

  • 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-24T00:07:54+00:00Added an answer on May 24, 2026 at 12:07 am

    The problem wasn’t with the annotations after all, it was a misplaced beans.xml. Putting it in META-INF, as required, helped me to get past this one.

    Switching to IntelliJ IDEA helped solve the problem: In it, the log file contained highly visible errors for creating the bean as a @Singleton as well as a @ApplicationScoped.

    Another thing that proved very helpful was to try the exact same application in JBoss. Here, it worked, so I was confident I had not misunderstood the basic concepts.

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

Sidebar

Related Questions

If you want to move your development process from Test-Driven Development to Behavior-Driven Development
I want to move about 800gb of data from an NTFS storage device to
I want to move the form title, icon and close, and help buttons from
We have an ages old Java applet that we want to move forward to
I have a long running process (40+ min) that I am debugging. I don't
I'm writing a Java application that will run for a long time (essentially, it
I want to move various parts of my app into simple scripts, to allow
I want to move a file with Ruby. How do I do that?
Upon page load I want to move the cursor to a particular field. No
Consider the following subversion directory structure /dir1/file.txt /dir2/file.txt I want to move the file.txt

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.