You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Mai,Nguyen Huu" <ma...@myvietnam.net> on 2003/11/26 07:54:01 UTC

Stranger error when I parse XML file

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: mai.nh@myVietnam.net
web site: www.myvietnam.net

Re: [configuration]Re: Stranger error when I parse XML file

Posted by "Mai,Nguyen Huu" <ma...@myvietnam.net>.
Hi Oliver
I knew the reason why I cannot parse XML file from web container.
Its error from Resin's parser. It has error
so I must use Resin 3.0.4 or use the standard XML parse from JDK.
I fixed this bug already.
Thanks for your comment

----- Original Message -----
From: "Oliver Heger" <Ol...@t-online.de>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, November 27, 2003 5:54 PM
Subject: Re: [configuration]Re: Stranger error when I parse XML file


> Okay,
>
> if the XML file is correct, then the only reason I can imagine is that
> there is a problem with the used XML parser. Which XML parser is used
> can depend on the classpath, as long as no specific properties are set.
> This would explain why your code runs from the command line and fails in
> a web container.
>
> There are some possibilities to select a certain parser. A source of
> information can be the API doc of dom4j
> (http://dom4j.org/apidocs/index.html), especially the documentation of
> the SAXReader class. This contains a description of the parser discovery
> mechanisms.
>
> In the FAQ section of the Sun XML page there is also a question that
> deals with using a specific parser
(http://java.sun.com/xml/jaxp/faq.html).
>
> Hope that helps!
> Oli
>
>
> Mai,Nguyen Huu wrote:
>
> >Hi Oliver
> >I made an hard-code of pathname, but it still doesn't work
> >Below is my error log
> >
> >org.dom4j.DocumentException: file:/c:/mvncore.xml:1: XML file has no
> >top-element.  All well-formed XML files have a single top-level element.
> >Nested exception: file:/c:/mvncore.xml:1: XML file has no top-element.
All
> >well-formed XML files have a single top-level element.
> >...
> >
> >Any idea ?
> >Thanks
> >
> >
> >
> >----- Original Message -----
> >From: "Oliver Heger" <Ol...@t-online.de>
> >To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> >Sent: Wednesday, November 26, 2003 7:46 PM
> >Subject: Re: [configuration]Re: Stranger error when I parse XML file
> >
> >
> >
> >
> >>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
> >>>
> >>>
> >>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]Re: Stranger error when I parse XML file

Posted by Oliver Heger <Ol...@t-online.de>.
Okay,

if the XML file is correct, then the only reason I can imagine is that 
there is a problem with the used XML parser. Which XML parser is used 
can depend on the classpath, as long as no specific properties are set. 
This would explain why your code runs from the command line and fails in 
a web container.

There are some possibilities to select a certain parser. A source of 
information can be the API doc of dom4j 
(http://dom4j.org/apidocs/index.html), especially the documentation of 
the SAXReader class. This contains a description of the parser discovery 
mechanisms.

In the FAQ section of the Sun XML page there is also a question that 
deals with using a specific parser (http://java.sun.com/xml/jaxp/faq.html).

Hope that helps!
Oli


Mai,Nguyen Huu wrote:

>Hi Oliver
>I made an hard-code of pathname, but it still doesn't work
>Below is my error log
>
>org.dom4j.DocumentException: file:/c:/mvncore.xml:1: XML file has no
>top-element.  All well-formed XML files have a single top-level element.
>Nested exception: file:/c:/mvncore.xml:1: XML file has no top-element.  All
>well-formed XML files have a single top-level element.
>...
>
>Any idea ?
>Thanks
>
>
>
>----- Original Message -----
>From: "Oliver Heger" <Ol...@t-online.de>
>To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
>Sent: Wednesday, November 26, 2003 7:46 PM
>Subject: Re: [configuration]Re: Stranger error when I parse XML file
>
>
>  
>
>>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
>>>
>>>      
>>>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]Re: Stranger error when I parse XML file

Posted by "Mai,Nguyen Huu" <ma...@myvietnam.net>.
Hi Oliver
I made an hard-code of pathname, but it still doesn't work
Below is my error log

org.dom4j.DocumentException: file:/c:/mvncore.xml:1: XML file has no
top-element.  All well-formed XML files have a single top-level element.
Nested exception: file:/c:/mvncore.xml:1: XML file has no top-element.  All
well-formed XML files have a single top-level element.
...

Any idea ?
Thanks



----- Original Message -----
From: "Oliver Heger" <Ol...@t-online.de>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Wednesday, November 26, 2003 7:46 PM
Subject: Re: [configuration]Re: Stranger error when I parse XML file


> 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:mai.nh@myvietnam.net]
> >>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" <Ol...@t-online.de>
> >>To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> >>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: mai.nh@myVietnam.net
> >>>>web site: www.myvietnam.net
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>
> >>
> >>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >>
> >>
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]Re: Stranger error when I parse XML file

Posted by Oliver Heger <Ol...@t-online.de>.
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:mai.nh@myvietnam.net]
>>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" <Ol...@t-online.de>
>>To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
>>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: mai.nh@myVietnam.net
>>>>web site: www.myvietnam.net
>>>>
>>>>
>>>>        
>>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>    
>>
>>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


RE: [configuration]Re: Stranger error when I parse XML file

Posted by Eric Pugh <ep...@upstate.com>.
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:mai.nh@myvietnam.net]
> 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" <Ol...@t-online.de>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> 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: mai.nh@myVietnam.net
> > >web site: www.myvietnam.net
> > >
> > >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [configuration]Re: Stranger error when I parse XML file

Posted by "Mai,Nguyen Huu" <ma...@myvietnam.net>.
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(DOM4JConfiguration.
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.setMVNForumHome(MVNForumConf
ig.java:121)
 at
net.myvietnam.mvnplugin.mvnforum.MVNForumConfig.<clinit>(MVNForumConfig.java
:409)
 at
net.myvietnam.mvnplugin.mvnforum.user.ForumUserServlet.init(ForumUserServlet
.java:75)
 at javax.servlet.GenericServlet.init(GenericServlet.java:82)
 at com.caucho.server.http.Application.createServlet(Application.java:3111)
 at com.caucho.server.http.Application.loadServlet(Application.java:3062)
 at
com.caucho.server.http.QServletConfig.loadServlet(QServletConfig.java:435)
 at
com.caucho.server.http.Application.getFilterChainServlet(Application.java:28
06)
 at
com.caucho.server.http.Application.buildFilterChain(Application.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(HttpRequest.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" <Ol...@t-online.de>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
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: mai.nh@myVietnam.net
> >web site: www.myvietnam.net
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[configuration]Re: Stranger error when I parse XML file

Posted by Oliver Heger <Ol...@t-online.de>.
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: mai.nh@myVietnam.net
>web site: www.myvietnam.net
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org