Hi Kathric,
From looking at your stack trace I'd suspect this is not a dom4j
problem. Looks like you'd be using some kind of Java Virus scanner or
some other third-party product that causes the problem, as you can
see from the package name here:
> java.lang.NoSuchMethodError:
> com.trend.iwss.jscan.appscan.runtime.PolicyProps: method <init>()V
> not found
Cheers,
Richard
Am 10.01.2007 um 07:33 schrieb e x o d u s:
> Hi,
>
> I'm new to dom4j. I use Eclipse 3.2 and dom4j-1.5.2. The program
> compiles fine, but when i run it I get an error message that says
> "Fatal Exception Occured. Program will Exit".
> Any help on resolving this issue would be great.
>
> Regards
> Karthic
>
> The program is as follows.
> package mypackage;
>
> import java.io.FileWriter;
>
> import org.dom4j.Document;
>
> import org.dom4j.DocumentHelper;
>
> import org.dom4j.Element;
>
> import org.dom4j.io.OutputFormat;
>
> import org.dom4j.io.XMLWriter;
>
>
> public class XMLCreator {
>
> Document document ;
>
>
> public void createDocument() {
>
> document = DocumentHelper.createDocument();
>
> Element root = document .addElement( "root" );
>
>
> Element author1 = root.addElement( "author" )
>
> .addAttribute( "name" , "James" )
>
> .addAttribute( "location" , "UK" )
>
> .addText( "James Strachan" );
>
>
> Element author2 = root.addElement( "author" )
>
> .addAttribute( "name" , "Bob" )
>
> .addAttribute( "location" , "US" )
>
> .addText( "Bob McWhirter" );
>
> }
>
> public void write() {
>
> try {
>
> //lets write to a file
>
> XMLWriter writer = new XMLWriter( new FileWriter
> ( "output.xml" ));
>
> writer.write( document );
>
> writer.close();
>
>
> // Pretty print the document to System.out
>
> OutputFormat format = OutputFormat. createPrettyPrint();
>
> writer = new XMLWriter( System. out , format );
>
> writer.write( document );
>
>
> // Compact format to System.out
>
> format = OutputFormat.createCompactFormat ();
>
> writer = new XMLWriter( System. out , format );
>
> writer.write( document );
>
> }
>
> catch (Exception e) {
>
> e.printStackTrace();
>
> } }
>
> public static void main(String args[]) {
>
> XMLCreator xc = new XMLCreator();
>
> xc.createDocument();
>
> xc.write();
>
> } }
>
> The error is as follows.
>
> java.lang.NoSuchMethodError:
> com.trend.iwss.jscan.appscan.runtime.PolicyProps: method <init>()V
> not found
>
> at com.trend.iwss.jscan.appscan.runtime.Session.<init>
> ( Session.java:58 )
>
> at com.trend.iwss.jscan.appscan.runtime.Session.<clinit>
> ( Session.java:33 )
>
> at org.dom4j.DocumentFactory.<clinit>(DocumentFactory.java)
>
> at org.dom4j.DocumentHelper.createDocument
> ( DocumentHelper.java:34 )
>
> at mypackage.XMLCreator.createDocument( XMLCreator.java:17 )
>
> at mypackage.XMLCreator.main( XMLCreator.java:60 )
>
> Exception in thread "main"
>
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV________________________________
> _______________
> dom4j-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
dom4j-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dom4j-user