• 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

Executing classes on server startup

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have some classes that do the initial setup for the application. I was using weblogic where I could set the names of the classes and the order in which they should execute in the server instance.

How do I do this with jBoss ?
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK.. so I figured that writing your own MBean service is one way to do it. I am taking all the classes as strings and in the service executing the methods by using reflection.

I dont know if there is any other way to do it. Comments welcome...
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, writing MBean(s) is the way to do this. See http://www.jboss.org/community/docs/DOC-9463
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Peter.
That was helpful. I was scouting around trying to figure how do I resolve all the dependencies for my service and wanted to deploy it after server has deployed everything else. the deploy.last subdirectory tip probably would do the trick. One thing though, I have some EJBs that I am deploying which depend on this service and I want them to get deployed after this service executes.
Can I put the ejb jar in the deploy.last ? but would still be not sure about the order of deployment between the service and the EJBs.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kaustubh Patil wrote:I have some EJBs that I am deploying which depend on this service and I want them to get deployed after this service executes.



You can add a <depends> tag in the jboss.xml for this EJB to depend on the service to be started.
 
Kaustubh Patil
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats right Jai. But I am trying to avoid adding <depends> tag for each and every EJB. I like have dozens of entity beans.
reply
    Bookmark Topic Watch Topic
  • New Topic