java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to org.w3c.dom.Element

3,469 views
Skip to first unread message

jlc488

unread,
Jan 11, 2010, 4:02:48 AM1/11/10
to JetS3t Users
public Distribution createPrivateDistribution(String originBucketName,
String callerReference, String[] CNAME, String comment,
boolean distributionTogle, LoggingStatus loggingStatus,
String originAccessIdentityId, boolean trustedSignerSelf,
String[] trustedSignerAwsAccountNumbers) {
Distribution distribution = null;

try {
distribution = cloudFrontService.createDistribution
(originBucketName, callerReference, CNAME, comment, distributionTogle,
loggingStatus, originAccessIdentityId, trustedSignerSelf,
trustedSignerAwsAccountNumbers);
} catch (CloudFrontServiceException e) {
e.printStackTrace();
}
log.debug("New Private Distribution: " + distribution);
return distribution ;
}


above is the simple code snippet and I am getting an exception where
the line of fetching createDistribution method.

I am sending originBucketName & originAccessIdentityId only, rest
variables are set to null.

And I am getting an exception as

java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to
org.w3c.dom.Element

any ideas or suggestions would be appreciated.

Thanks in advance.

jlc488

unread,
Jan 11, 2010, 7:52:50 PM1/11/10
to JetS3t Users
I don't know why though, but I've found out the solution to this
problem.

I've changed the library from java-xmlbuilder-0.3.jar(added by maven
setting) to java-xmlbuilder-2.jar(added by eclipse) and this exception
will be resolved.

Any ideas why?

Thanks guys

James Murty

unread,
Jan 11, 2010, 10:21:28 PM1/11/10
to jets3t...@googlegroups.com
Hmm, this is an odd problem.

The XmlBuilder library is actually another thing I wrote and I don't recall making any tangible change to the way that documents are built between versions 2 and 3. In my experience XML library issues are a frequent and frustrating problem with Java.

Do you happen to have a full stack trace for the java.lang.ClassCastException ?

In any event, you are better off using the newer version of this library so hopefully you won't see any more of these problems.

Regards,
James


--
You received this message because you are subscribed to the Google Groups "JetS3t Users" group.
To post to this group, send email to jets3t...@googlegroups.com.
To unsubscribe from this group, send email to jets3t-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jets3t-users?hl=en.




jlc488

unread,
Jan 12, 2010, 3:16:07 AM1/12/10
to JetS3t Users
Exception in thread "main" java.lang.ClassCastException:

com.sun.org.apache.xerces.internal.dom.DocumentImpl cannot be cast to
org.w3c.dom.Element
at com.jamesmurty.utils.XMLBuilder.up(XMLBuilder.java:592)
at com.jamesmurty.utils.XMLBuilder.up(XMLBuilder.java:603)
at
org.jets3t.service.CloudFrontService.buildDistributionConfigXmlDocument
(CloudFrontService.java:556)
at org.jets3t.service.CloudFrontService.createDistributionImpl
(CloudFrontService.java:611)
at org.jets3t.service.CloudFrontService.createDistribution
(CloudFrontService.java:683)
at com.dreamer.support.AMAZONSupport.createPrivateDistribution
(AMAZONSupport.java:111)
at com.dreamer.pcf.amazon.AWSCloudFront.getCDNInfo(AWSCloudFront.java:
35)
at com.dreamer.CDNFactory.getCDNURL(CDNFactory.java:23)
at com.dreamer.cdn.Test.main(Test.java:27)

This is the stack trace I am getting and below is the contents of
pom.xml file I have.

<repositories>
<repository>
<name>jets3t</name>
<id>jets3t</id>
<url>http://jets3t.s3.amazonaws.com/maven2</url>
</repository>
<repository>
<id>googlecode.java-xmlbuilder</id>
<url>http://java-xmlbuilder.googlecode.com/svn/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.java.dev.jets3t</groupId>
<artifactId>jets3t</artifactId>
<version>0.7.2</version>
</dependency>
<dependency>
<groupId>com.jamesmurty.utils</groupId>
<artifactId>java-xmlbuilder</artifactId>
<version>0.3</version>
</dependency>
</dependencies>

> > jets3t-users...@googlegroups.com<jets3t-users%2Bunsu...@googlegroups.com>

Reply all
Reply to author
Forward
0 new messages