If you don't need access to this file outside the WAR, you might move the init-params to the standard descriptor file web.xml.
... <servlet> <servlet-name>My Servlet</servlet-name> <servlet-class>com.controller.TestServlet</servlet-class> <init-param> <description>This is an init parameter example</description> <param-name>cfgFile</param-name> <param-value>config.txt</param-value> </init-param> </servlet>
More details found here.
If you need access outside the WAR, here a link to another thread for those who need a replacement to context.xml outside the WAR
Tomcat's ResourceLink links a global JNDI name to module (WAR) JNDI name. You won't be able to lookup global resources using local JNDI names inside your components unless you've made this mapping. So if it's ok for you to move it to the standard descriptor file web.xml, here's a snippet that might cut it for you:
<resource-ref> <res-ref-name>jdbc/srqa</res-ref-name> <res-type>javax.sql.DataSource</res-type> <lookup-name>java:global/jdbc/srqa</lookup-name> </resource-ref>
However, in your specific case you're trying to lookup a datasource and if you've configure it the "normal" way (using CLI or Web Console) and follow best practices, your datasource will be located in the jboss namespace in JNDI. So the lookup-name is more likely to be
In general, the JBoss jboss-web.xml is the replacement file for context.xml. But you should prefer to use the standard web.xml descriptor file whenever possible.