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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:40:31+00:00 2026-05-31T14:40:31+00:00

While trying to move an axis2 web-app from glassfish3 to tomcat6, I can’t seem

  • 0

While trying to move an axis2 web-app from glassfish3 to tomcat6, I can’t seem to find a way to get a config parameter from a static context.

In glassfish3, a system property was defined in a far away place and read from the application using System.getProperty(String name). Not only does the web agree that this is not the way to go for a web application, this trick is just not feasible for tomcat (tomcat docs).

Reading parameters from the ServletContext is also not feasible as the app uses axis2 and I can’t seem to find a way to access any kind of servlet voodoo from the static context that initializes the app’s configuration.

services.xml (the file containing the service description for axis2) can contain <parameter> nodes, so that seems a nice place to configure the configuration location, but I can’t seem to find a way to read these parameters from the application.

So in short: any ideas on how to get a value configured outside the application’s code available from a static context?


(answer listed here as StackOverflow does not allow me to answer my own question…)

After scouring the Internet some more, a solution was found using an implementation of org.apache.axis2.engine.ServiceLifeCycle, which could read a parameter in the startUp-method as such:

Parameter param = service.getParameter("name");
if (param != null) {
    saveParamValue(param.getValue().toString());
} else {
    // log warning on falling back to System.getProperty()
}

The life cycle class is attached using class="fully.qualified.ClassName" on the <service> node of the services.xml file used by axis2.

This works, now the application just crashes on something else (but that has little to with this issue).

  • 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-31T14:40:32+00:00Added an answer on May 31, 2026 at 2:40 pm

    The parameters in services.xml can be accessed by getting the ServiceContext object for the service, then calling ServiceContext.getParameter(). If your service implementation class implements the Lifecycle interface, then Axis2 will call Lifecycle.init() every time it creates a new instance of the service class. The argument to Lifecycle.init() is the service’s ServiceContext. Your init() implementation could save the context object or look up the parameters that you’re interested in.

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

Sidebar

Related Questions

For a while I was stuck trying to get a visual basic 6 app
While trying to generate classes from a xsd, i got this error: java.lang.IllegalArgumentException: Illegal
I'm trying to move over some repositories from Perforce to Kiln (FogBugz's Mercurial-based companion
I am trying to move my code from Java to C, and I have
I'm trying to move from GLee to glew, because GLee doesn't work under VC2010
I'm trying to move bitmap picture from some point to point where I touched...
I'm trying to move from stdio to iostream, which is proving very difficult. I've
Im trying to move a system from using morbid to rabbitmq, but I cannot
*Hi, The Case: I am trying to move a database from one server to
I'm trying to move from django 1.0.2 to 1.1 and I am getting the

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.