Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.ClassCastException: .ElementNSImpl cannot be cast to...

arshadnoorDec 31 2009 — edited Jan 4 2010
I have a SOAP-based webservice created through Netbeans 6.7.1 and deployed on GF 2.1. Objects that are returned by the webservice are converted to XML documents on the server, and back to Java objects on the client, by JAXB. I control the JAXB conversion through the webservice implementation class, whose relevant snippet is shown below:
...
@WebService()
@XmlSeeAlso({
    ConfigurationDatabean.class,
    CronjobDatabean.class,
    DomainDatabean.class,
    UserDatabean.class
})
public class Console {
...
Three of the above-mentioned Databean classes work perfectly; the fourth - which is similar to the other three - throws the following exception during execution:

Caused by: java.lang.ClassCastException: com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to com.strongauth.strongkeylite.databeans.ConfigurationDatabean

The JAXB-relevant section of the "problem" Databean is shown below:
...
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ConfigurationDatabean", propOrder = {
    "did",
    "key",
    "value",
    "notes"
})

public class ConfigurationDatabean implements Serializable
...
A [related thread|http://forums.sun.com/thread.jspa?forumID=34&threadID=5331057] on this forum hints at the error; but since the IDE generates all the intermediate code (which works for 3 of the 4 classes), I do not have control over the generated XSD (other than through annotations in the web-service implementation class which appear to be correct).

I'm using Netbeans 6.7.1, with JDK6U17, Glassfish 2.1 on Linux (64-bit). Any hints on how I may overcome this problem? What should have been a trivial and repetitive coding task has now become a 24-hour debugging session. TIA for the help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2010
Added on Dec 31 2009
1 comment
4,842 views