[jdom-interest] Please Help!

Ian Lea ian.lea at blackwell.co.uk
Thu Apr 5 03:02:31 PDT 2001


I created an XML file for your data, stuck it on my local file system,
hardcoded the full path into your source files, added a couple of
System.out.println() calls to display xmlUrl and passedId in
listData(), compiled your source and tried TestClass and the servlet
in Tomcat and after some messing around to get the right data in the
XML file it works. XML file attached.


A couple of suggestions as to why it isn't working for you:

  Are you sure the servlet and TestClass are using the same
  version of scheduler_config.xml?  I hard-coded the path
  as /tmp/scheduler_config.xml.

  In your source you refer to both ftp.la.viacom.com and
  ftp.dc.viacom.com.  I added both to the XML file.

  I'm using Tomcat on linux, you are using Allaire JRun on MSWin.



I don't think these are related to your problem but I might make a few
other suggestions too:

  . Lose the quotes and/or java.net.URLEncoder.encode() the
    data in your redirect URL query string.

  . Be consistent in naming - pollingfrequency or pollfreq or ???

  . listData seems to stick data in a Vector if is present in
    the XML file, and its caller then takes stuff out of the
    Vector by position.  Looks dodgy unless you can be 100%
    confident that the XML will always contain all elements.
    I might use a HashMap, or pass back the matching JDOM Element
    and extract the values directly.  Or something.


Good luck.



--
Ian Lea
ian.lea at blackwell.co.uk



"Molina, Alexis E" wrote:
> 
> Could someone perhaps recommend another list to post this question on as
> well?  I'm sorry, I'm just in a desperate situation to get this working, and
> need a response.  Are there other help lists with JDOM support out there?
> 
> Alexis Molina
> San Diego, CA
> 
> -----Original Message-----
> From: Molina, Alexis E [mailto:aemolina at kpmg.com]
> Sent: Tuesday, April 03, 2001 8:34 PM
> To: 'jdom-interest at jdom.org'
> Subject: [jdom-interest] Please Help!
> 
> Hello All:
>    I'm in a serious jam here, and I'm hoping someone can help.
> I have created a class (SchedulerJDOMHandler.class) that uses SaxBuilder to
> grab some data from an XML source, based on an ID I pass it.
> I have a servlet that invokes the getData() method of
> SchedulerJDOMHandler.class.  The getData method should retrieve a list of
> values from the xml file, then append them to a url string as parameters,
> and return the final url string to the servlet.
> To test it, I also created a little program called TestClass.class.  This
> program and servlet are virtually identical in their function.
> 
> The problem is, when I run TestClass, it returns the final string perfectly
> like so:
> C:\Program Files\Allaire\JRun\servers\default\cdnm\WEB-INF\classes>java
> TestClass
> ../scheduler/config_scheduler.jsp?id="ftp.dc.viacom.com"&zone="North
> America - East"&mantype="Cisco Content Switch"&format="MIB"&pollfreq="5"
> &ftpurl="ftp://ftp.dc.viacom.com"&userid="user2"&pass="pass2"
> 
> But, when I do the same thing from the servlet, it only returns what the url
> string was initialzed to (like: ../scheduler/config_scheduler.jsp?), but
> without the appended parameter values grabbed from the XML source.   For
> your convenience, I am pasting the code for the 3 classes below.  Could
> someone please explain why TestClass.class get's the correct data returned
> to it, but the servlet (GetSchedulerData.class) doesn't?  A serious thanks,
> in advance, to anyone that can possibly help!  If it would help to have the
> XML file, please let me know and I'll be glad to post it as well.
>>>> (chopped)
-------------- next part --------------
<?xml version="1.0"?>
<document>

<scheduler>
<id>ftp.dc.viacom.com</id>
<zone>North America - East</zone>
<manufacturertype>Cisco Content Switch</manufacturertype>
<format>MIB</format>
<pollingfrequency>5</pollingfrequency>
<ftpurl>ftp://ftp.dc.viacom.com</ftpurl>
<userid>user2</userid>
<password>pass2</password>
</scheduler>

<scheduler>
<id>ftp.la.viacom.com</id>
<zone>North America - East</zone>
<manufacturertype>Cisco Content Switch</manufacturertype>
<format>MIB</format>
<pollingfrequency>5</pollingfrequency>
<ftpurl>ftp://ftp.dc.viacom.com</ftpurl>
<userid>user2</userid>
<password>pass2</password>
</scheduler>

</document>


More information about the jdom-interest mailing list