• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One spring bean initialized 2 times when start the jboss, but 1 time when just publish in STS

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using STS and JBoss.
Have a strange problem since this week Monday. It works fine before.
One spring service bean (@Service) will be autowired in another bean.

When start the jboss, find the bean is initialized 2 times.
When just publish, the bean is initialized 1 time only.

I have a transactional method in the bean with @Transactional.
After start the jboss, the transactional works.
But if publish, the transactional does not works.

Anyone has ever experience this? What's the possible reason?

Some questions can be raised.
In which situation or senario the bean could be initialized 2 times automatically?
Why Spring @Transactional dose not work?
 
Bartender
Posts: 1682
7
Android Mac OS X IntelliJ IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When start the jboss, find the bean is initialized 2 times.
When just publish, the bean is initialized 1 time only.



What do you mean by start and publish? Is start starting the server and publish right clicking the server in STS while it is running in debug and publishing changes to the server? If so what kind of changes are you publishing while its running? You cant make changes to annotations etc without restarting the server.

What do you mean by is initialized 2 times? Are you initializing the same XML twice in your web.xml? Are the beans defined multiple times in different web contexts? Do you have multiple component scanners scanning the same packages? Do you have @Configuration classes being picked up twice? In the end in most cases you will end up with a single spring bean but things like I have listed can cause multiple initializations.

That is about the most help I can give you without seeing more of your actual configuration. Also perhaps your start-up log showing the multiple initialization may help. Some times dropping the logging level down to debug for your Spring stuff can help you better debug whats happening on start-up.

Good Luck


 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic