Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Tomcat Unable to Read JNDI xml file

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ! I am using Tomcat 8 and I have created a JNDI file for the spring boot application to read in the db info.



But I have this error during startup:

java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 53; Document root element "Context", must match DOCTYPE root "null".



I think there is something wrong with the DOCTYPE. How should I specify it?

Please help. Thanks.
 
Saloon Keeper
Posts: 24283
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That has nothing to do with JNDI. It's a Tomcat Context file, more formally known to JEE as a "server-dependent deployment descriptor" file. You would normally put it in the TOMCAT_HOME/conf/Catalina/localhost directory for stand-alone Tomcat or as the file /META-INF/context.xml in your application WAR.

If you're running Spring Boot with embedded Tomcat the rules are probably different and I'd have to refer you to our Spring Framework forum for more help. The file itself appears perfectly OK to me.
 
A Tham
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

Thank you for your reply. I am not running embedded Tomcat.

I have copied the war file into the webapps directory and tried to start Tomcat. I got this error which points to this file.

Yes, I have placed this file in the TOMCAT_HOME/conf/Catalina/localhost directory.

If I have done anything wrong, please enlighten me. Thanks.
 
Tim Holloway
Saloon Keeper
Posts: 24283
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try removing the "<?xml" processing instruction line (Line 1). I don't use it myself. It actually shouldn't make a difference, but maybe it does.
 
A Tham
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestion.

I have removed it and restarted Tomcat. Still the same error.
 
Marshal
Posts: 3648
516
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A Tham wrote:


Is debug a valid attribute for Context?
 
Tim Holloway
Saloon Keeper
Posts: 24283
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's acceptable, but I don't think it does anything. As of Tomcat 8, it wasn't a documented attribute.

Bear in mind that there is (and cannot be) an XML schema for Tomcat Context. So anything that's syntactically valid XML will be digested by the deployer even if no actual use can be found for it.

What bothers me here is that the expected root element of this context file is said to be null, not Context. I cannot think of any way that should be so. Unless Tomcat is damaged.

So perhaps the best thing would be to download and unzip a fresh copy of Tomcat and try using that.
 
I didn't say it. I'm just telling you what this tiny ad said.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic