Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » WTP 3.2 and Tomcat 7 - webapp defined context.xml is broken (The server fails to startup when any Resource or ResourceLink is defined in the webapp's META-INF/context.xml)
WTP 3.2 and Tomcat 7 - webapp defined context.xml is broken [message #546672] Tue, 13 July 2010 17:37 Go to previous message
Nic Baker is currently offline Nic BakerFriend
Messages: 3
Registered: July 2010
Junior Member
I think I found a bug with the latest WTP (3.2) and Tomcat 7 that causes the server to fail to startup if you've defined a webapp-level META-INF/context.xml file that contains a <Resource> or <ResourceLink> element. I think the problem is in WTP because if I wrap up the project in a .war file and launch the server from outside Eclipse/WTP then it works fine.

I did some searching and couldn't find anyone else talking about this so I was hoping to get some confirmation here before filing a bug report.

Simple steps to reproduce:

  1. Create a Tomcat 7 server runtime environment if you don't already have one and add it to the Servers tab.
  2. Create a new Dynamic Web Project and make sure its target runtime is the Tomcat 7 server. I also set the dynamic web module version to 3.0 and Configuration to "Default Configuration for Apache Tomcat v7.0" but I don't know if it matters. I left the rest of the options on default.
  3. Create a context.xml file inside the project's META-INF folder and give it a <Resource> or <ResourceLink>. The simplest is to just link to the UserDatabase global resource provided by Tomcat 7's server.xml. Here's an example context.xml file that should reproduce the problem:
    <?xml version="1.0" encoding="UTF-8"?>
        <ResourceLink name="UserDatabase" global="UserDatabase" type="org.apache.catalina.UserDatabase"/>

  4. Add the project to the Tomcat 7 server and launch it via the Servers tab.

Assuming this is a real bug you should see the following stack trace during server startup and the server should fail to start:
Jul 13, 2010 10:30:04 AM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
	at org.apache.catalina.core.StandardContext.getObjectNameKeyProperties(
	at org.apache.catalina.core.StandardContext.setNamingResources(
	at org.apache.catalina.core.StandardContext.getNamingResources(
	at org.apache.catalina.startup.SetNextNamingRule.end(
	at org.apache.tomcat.util.digester.Digester.endElement(
	at org.apache.tomcat.util.digester.Digester.parse(
	at org.apache.catalina.startup.Catalina.load(
	at org.apache.catalina.startup.Catalina.load(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.apache.catalina.startup.Bootstrap.load(
	at org.apache.catalina.startup.Bootstrap.main(

If I follow the exact same steps but point it at a Tomcat 6 server then it works fine, and like I said before this problem does not occur if I bypass WTP by deploying directly via a .war file so I think the problem is somewhere in WTP.

Is this a known bug that I missed when digging around in bugzilla and the forums? If not, is anybody else able to reproduce the problem? Thanks for any help!
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:XML Templates not working
Next Topic:HTML encoding cp1252
Goto Forum:

Current Time: Mon Jan 18 02:01:52 GMT 2021

Powered by FUDForum. Page generated in 0.01433 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top