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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:54:20+00:00 2026-05-13T12:54:20+00:00

I have a webservice running on tomcat (and working). I would like to extract

  • 0

I have a webservice running on tomcat (and working). I would like to extract the endpoint URL into a file outside the war, so that it can be changed without needing to redeploy the war. I am running locally with Tomcat 6 standalone on Windows XP.

My thought was to have it in the Context, either as a context param or as an Environment variable.

I wasn’t sure which was better, and since I can’t get the Context recognized, I have no idea which will work. So my first question, which of the entries below should I be using (if any)?

<Context path="/myapp" docBase="myapp">

<Environment name="webserviceURI" type="java.lang.String" override="true" value="endpointURLredacted"/>

<context-parameter>
<name>uri</name>
<value>endpointURLredacted</value>
</context-parameter>

</Context>

Assuming the Environment line is correct, my code to retrieve is:

InitialContext ic = new InitialContext();
endpoint = (String)ic.lookup("webserviceURI");

However….

I have tried adding this in a context.xml file to the META-INF folder, and I was under the impression that when I deploy the war, to quote an answer from another question on here, “When you deploy the WAR, the context fragment (META-INF/context.xml) is copied to conf/Catalina/[host] directory.” Well, that doesn’t happen. I don’t really want to do it that way, since I want the context to exist completely separately from the war, but it was a test to see if I could even get that far. Fail.

So I tried adding the context xml (renamed to myapp.xml) to that folder (had to create it first) manually, but I still don’t think the file is getting read.

When I run the app I get an error like “javax.naming.NameNotFoundException: Name webserviceURI is not bound in this Context”.

I have tried printing out the initial context’s environment:

Context:     {java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory,java.naming.factory.url.pkgs=org.apache.naming}

So I don’t think the context file is getting read, no matter where I put it.

This isn’t a servlet (which maybe it should be?) if that matters.

  • 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-13T12:54:20+00:00Added an answer on May 13, 2026 at 12:54 pm

    I deleted the docBase attribute from the context, used the Environment tag, and retrieved the value by using java:comp/env/webserviceURI, and voila! Success.

    Maybe that will help someone else!

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

Sidebar

Related Questions

Background: We have a Webservice that is running under axis2 on a Tomcat. We
I have an Axis (1.4) web service (running on Tomcat 6.0.20) that is working
I have a webservice running on tomcat, and want to execute some fileIO. File
So I have a client that needs to be running tomcat for various things
I have several times ran into the same problem, and I would like to
Currently I have webservice running on the Mono platform. When I call the service
I have a asp.net webservice running in windows server 2003, i want it read/write
I have a .NET Web Service running in VS2005 and a client that consumes
I have a web service that is running on IIS (6 or 7, doesn't
I have an ASP.NET web service running that accepts both HTTP POST and SOAP

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.