Questions tagged [context.xml]

The context.xml file is a web application context descriptor used by the Apache Tomcat servlet container.

199 questions
173
votes
14 answers

How to set the context path of a web application in Tomcat 7.0

I know that I can rename my webapp (or it's WAR file) to ROOT but this is a terrible way to do it, IMHO. Now I checked out the tomcat doc & it says It is NOT recommended to place elements directly in the server.xml file So I tried doing it…
Chantz
  • 5,883
  • 10
  • 56
  • 79
78
votes
8 answers

How can I specify system properties in Tomcat configuration on startup?

I understand that I can specify system properties to Tomcat by passing arguments with the -D parameter, for example "-Dmy.prop=value". I am wondering if there is a cleaner way of doing this by specifying the property values in the context.xml file…
Markus
  • 1,203
  • 2
  • 16
  • 24
26
votes
5 answers

Migration to Tomcat 8: InstanceAlreadyExistsException datasource

I have a question about context config in Tomcat 8. I migrating project from Tomcat 7 to 8 and have unusual problem: if nothing change in config I caught an error: "2015-02-03 12:05:48,310 FIRST_ADMIN ERROR web.context.ContextLoader:331 ->…
Vadim R
  • 261
  • 1
  • 3
  • 5
23
votes
2 answers

How to store string values in context.xml

I'd like to store connection URLs in a JNDI binding for my Tomcat application. Since Tomcat uses context.xml for JNDI resource defining, I need to figure out the propert way to store a String (or multiple strings for multiple connections) in…
user1768830
21
votes
2 answers

Tomcat 8 - context.xml use Environment Variable in Datasource

I have a Tomcat 8 project that uses a datasource (see below)
thonnor
  • 1,206
  • 2
  • 14
  • 28
19
votes
3 answers

Which Tomcat 5 context file takes precedence?

Tomcat documentation says: The locations for Context Descriptors are; $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml $CATALINA_HOME/webapps/[webappname]/META-INF/context.xml On my server, I have at least 3 files floating around: 1…
jeph perro
  • 6,242
  • 26
  • 90
  • 124
14
votes
1 answer

What is the correct META-INF directory location for context.xml in Tomcat?

Should a "context.xml" file for deploying application-specific configuration to Tomcat be placed in: src/main/resources/META-INF/context.xml ...or... src/main/webapp/META-INF/context.xml ? Justification for asking: Have seen conflicting advice on…
Steve Chambers
  • 37,270
  • 24
  • 156
  • 208
13
votes
1 answer

Is there an XML schema for the Tomcat 6 context.xml?

NetBeans has great support for showing the nodes and attributes available in an XML, but it needs to load the schema. Is there one for Tomcat's context container XML?
user4903
12
votes
2 answers

How to get resource from the context.xml file in tomcat webapp?

This is my context.xml file: ...
Igor Popov
  • 9,795
  • 7
  • 55
  • 68
12
votes
3 answers

Replace spring bean in one context with mock version from another context

I'm writing an integration test where an application context xml is initialized during startup. There are several test methods in the test class which make use of a specific bean 'X'(already defined in the xml). My actual requirement is to mock bean…
Ram
  • 191
  • 1
  • 2
  • 12
11
votes
2 answers

javax.naming.NameNotFoundException: Name [jdbc/rhwebDB] is not bound in this Context. Unable to find [jdbc]

I know there's many questions regarding this exception, however, I believe I've tried everything for many days, without any luck yet. As this is a production server, I can only work on this after midnight :( I have a Tomcat app. Recently, I've…
Sergio
  • 658
  • 1
  • 9
  • 22
11
votes
2 answers

Deploying a servlet programmatically with Jetty

I've got a servlet that I wish to deploy programmatically using Jetty. The servlet uses Spring and it's web.xml points to the Spring context XML file as you'd expect. At the moment, I'm just trying the example code from the Jetty docs but with my…
DeadPassive
  • 877
  • 3
  • 8
  • 22
10
votes
3 answers

How do you create "Aliases" in Apache Tomcat?

I am working on a web application that allows users to upload attachments. These attachments are stored on a different drive than that of the web application. How can I create an alias (equivalent to Apache HTTP server's aliases) to this drive so…
Dan Polites
  • 6,750
  • 10
  • 50
  • 56
8
votes
1 answer

context.xml vs web.xml in web application

I am developing a small web application application. The objective is to create one welcome index.html page with Ajax + one servlet to handle ajax requests. Although I thought I would be fine with a web.xml only, I don't want to deploy to /, but to…
Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
7
votes
1 answer

tomcat 7 ignoring my context.xml

I hope this is something stupid. But I've been staring at it way too long. I am upgrading to Tomcat 7 (from 6) on Linux and it's ignoring my context.xml file. If I include the Context (datasource) in the server.xml, it work fine. But I would like to…
PrecisionPete
  • 3,139
  • 5
  • 33
  • 52
1
2 3
13 14