From: Ian K. <spi...@gm...> - 2005-11-30 18:56:17
|
OK, thanks for the usage example with update, that helped. I have code now that runs and passes its tests. A peculiar thing seems evident from my experience with this, the dnsjava 2.0.0 classes appear to be sensitive to how the classes are loaded. I found this when the simplest thing worked in a command line class (in public static void main), worked from the command line invoked by a JUnit TestCase but failed with NullPointerExceptions when the same TestCase was run by the the maven (v1.0.2) build system I had. A typical stacktrace would look like this: [junit] java.lang.NullPointerException [junit] at org.xbill.DNS.Record.getTypedObject(Record.java:64) [junit] at org.xbill.DNS.Record.getEmptyRecord(Record.java:87) [junit] at org.xbill.DNS.Record.fromString(Record.java:503) [junit] at org.xbill.DNS.Record.fromString(Record.java:527) [junit] at org.xbill.DNS.Update.add(Update.java:136) [junit] at org.xbill.DNS.Update.replace(Update.java:253) Anway, I worked around it by throwing together an ant build system for my project and everything worked. Weird. -Ian On 11/29/05, Brian Wellington <bwe...@no...> wrote: > On Tue, 29 Nov 2005, Ian Kallen wrote: > > > I've been trying to use org.xbill.DNS.Update (using various > > permutations, with/without TSIG, TCP, etc) with 2.0.0 and I just get > > silent failure (I got NullPointerExceptions with 1.6.6, so maybe > > that's a a step up :). > > The BIND installation is the one that comes with Mac OS 10.4 (Tiger), > > I have a zone "rbl" that is configured to accept updates from > > localhost (also tried with a TSIG key). > > > > My test does a query (expecting there to be no record), does an update > > and then runs the query again. Running BIND with logging set to > > "dynamic", I get the following: > > Unfortunately, BIND's logging is verbose but not useful. > > > Any idea what the "request failed: end of file" means and how to deal > > with this? > > No clue. > > > The dynamic update example at > > http://www.xbill.org/dnsjava/examples.html didn't work. The > > update.java in the distribution... it's not clear how to use it and > > anyway, it's pretty complicated; I just need to send single short TTL > > updates to a BIND server. Any pointers to working code that uses > > org.xbill.DNS.Update would be appreciated. > > Other than a minor typo (should be args[0] instead of args[1]), the updat= e > example works for me, assuming the server is properly configured with the > zone and TSIG key in the program. > > I'm not sure what's confusing about the update program. It has pretty > complete help for all of the commands, and the usage to add a single > record would be something like: > > > server <ip address of server> > > zone <zone name> > > add <name> <ttl> <type> <data> > > send > > or, as an example: > > > server 127.0.0.1 > > zone example > > add foo 3600 A 1.2.3.4 > > send > > If you fix the one character typo in the example, it is working code. > > Brian > |