I don't think this error is related to configuration either, it appears directly in dom4j when the XML file is loaded. Perhaps you could try to parse the file with dom4j directly.

And one other thing: The error message says "org.dom4j.DocumentException: file:/C:/resin-2.1.9:1". I would expect that here normally the full path to the parsed file would occur, but "C:/resin-2.1.9" is obviously no correct file name. Are you really sure that the path is correct?

Oli

Eric Pugh wrote:

It sounds like xml parser hell!  Try creating the simplest possible file
that will run..  You could also try and run the unit tests for
commons-configuration in your debugger/IDE to see if it is passing in
something odd...

ERic



-----Original Message-----
From: Mai,Nguyen Huu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 26, 2003 11:25 AM
To: Jakarta Commons Developers List
Subject: Re: [configuration]Re: Stranger error when I parse XML file


Hello Oli Below is my error trace

org.dom4j.DocumentException: file:/C:/resin-2.1.9:1: XML file has no
top-element.  All well-formed XML files have a single
top-level element.
Nested exception: file:/C:/resin-2.1.9:1: XML file has no
top-element.  All
well-formed XML files have a single top-level element.
at org.dom4j.io.SAXReader.read(SAXReader.java:342)
at org.dom4j.io.SAXReader.read(SAXReader.java:218)
at
org.apache.commons.configuration.DOM4JConfiguration.load(DOM4J
Configuration.
java:156)
at net.myvietnam.mvncore.db.DBOptions.<init>(DBOptions.java:83)
at net.myvietnam.mvncore.db.DBUtils.<clinit>(DBUtils.java:89)
at
net.myvietnam.mvncore.info.DatabaseInfo.<init>(DatabaseInfo.java:59)
at
net.myvietnam.mvnplugin.mvnforum.MVNForumConfig.setMVNForumHom
e(MVNForumConf
ig.java:121)
at
net.myvietnam.mvnplugin.mvnforum.MVNForumConfig.<clinit>(MVNFo
rumConfig.java
:409)
at
net.myvietnam.mvnplugin.mvnforum.user.ForumUserServlet.init(Fo
rumUserServlet
.java:75)
at javax.servlet.GenericServlet.init(GenericServlet.java:82)
at
com.caucho.server.http.Application.createServlet(Application.j
ava:3111)
at
com.caucho.server.http.Application.loadServlet(Application.java:3062)
at
com.caucho.server.http.QServletConfig.loadServlet(QServletConf
ig.java:435)
at
com.caucho.server.http.Application.getFilterChainServlet(Appli
cation.java:28
06)
at
com.caucho.server.http.Application.buildFilterChain(Applicatio
n.java:2762)
at com.caucho.server.http.Invocation.service(Invocation.java:313)
at
com.caucho.server.http.CacheInvocation.service(CacheInvocation
.java:135)
at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at
com.caucho.server.http.HttpRequest.handleConnection(HttpReques
t.java:163)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536)

I am using dom4j-1.4.jar
Really stranger, it works well if I run in console
Help me please.



----- Original Message -----
From: "Oliver Heger" <[EMAIL PROTECTED]>
To: "Jakarta Commons Developers List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 26, 2003 6:11 PM
Subject: [configuration]Re: Stranger error when I parse XML file




Hm, this is really a bit strange.

Could you perhaps provide a full stack trace with the exception that
occurs? It may be related to the class path of your servlet


container.


Is dom4j included?

Oli

Mai,Nguyen Huu wrote:



Hi folks
I am a new with configuration
Right now, I have problem when loading XML file,
Below this my code

String testProperties = new


File("webapps/mvnforum/Web-inf/classes/" +
OPTION_FILE_NAME).getAbsolutePath();


          DOM4JConfiguration conf = new DOM4JConfiguration();
          conf.setFileName(testProperties);
          conf.load();

If I run this code in console, it works well (I must


change the path to
XML file, of course)


but if I run this code in Servlet Container like Resin or


Tomcat, I will
receive an error


"XML file has no top-element. All well-formed XML files


have a single
top-level element. Nested exception: file:/C:/resin-2.1.9:1:
XML file has no
top-element. All well-formed XML files have a single
top-level element."


And I am sure I check the syntax of XML file carefully and


the path to
XML file is OK


Any body here get the same error like me.
Please help me.
Thanks iin advance

-----------------------------------------------
Nguyen Huu Mai
Software Developer
Email: [EMAIL PROTECTED]
web site: www.myvietnam.net








---------------------------------------------------------------------


To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to