Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5983251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:12:13+00:00 2026-05-22T22:12:13+00:00

I am making an jaxbcontext newInstance, passing DO as a class.My DO contains java.sql.clob

  • 0

I am making an jaxbcontext newInstance, passing DO as a class.My DO contains java.sql.clob as one of the fields.
This clob field is creating an issue while creating a new Instance. Giving error as
Exception occured While capturing clob

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3 counts of IllegalAnnotationExceptions
java.sql.Clob is an interface, and JAXB can't handle interfaces.
    this problem is related to the following location:
        at java.sql.Clob
        at public java.sql.Clob com.data.subscriber.SubscriberProvTransDO.getXmlString()
        at com.data.subscriber.SubscriberProvTransDO
The type of the getter is java.io.InputStream but that of the setter is long. They have to be the same.
    this problem is related to the following location:
        at public abstract java.io.InputStream java.sql.Clob.getAsciiStream() throws java.sql.SQLException
        at java.sql.Clob
        at public java.sql.Clob com.data.subscriber.SubscriberProvTransDO.getXmlString()
        at com.data.subscriber.SubscriberProvTransDO
    this problem is related to the following location:
        at public abstract java.io.OutputStream java.sql.Clob.setAsciiStream(long) throws java.sql.SQLException
        at java.sql.Clob
        at public java.sql.Clob com.data.subscriber.SubscriberProvTransDO.getXmlString()
        at com.data.subscriber.SubscriberProvTransDO
The type of the getter is java.io.Reader but that of the setter is long. They have to be the same.
    this problem is related to the following location:
        at public abstract java.io.Reader java.sql.Clob.getCharacterStream() throws java.sql.SQLException
        at java.sql.Clob
        at public java.sql.Clob com.data.subscriber.SubscriberProvTransDO.getXmlString()
        at com.data.subscriber.SubscriberProvTransDO
    this problem is related to the following location:
        at public abstract java.io.Writer java.sql.Clob.setCharacterStream(long) throws java.sql.SQLException
        at java.sql.Clob
        at public java.sql.Clob com.data.subscriber.SubscriberProvTransDO.getXmlString()
        at com.data.subscriber.SubscriberProvTransDO

    at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:389)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:236)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
    at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
    at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
    at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
    at com.business.system.handler.EventProcessorHandler.insertFailure(EventProcessorHandler.java:286)
    at com.business.system.handler.EventProcessorHandler.processRequest(EventProcessorHandler.java:184)
    at com.business.system.EventProcessorBean.onMessage(EventProcessorBean.java:51)
    at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:1086)
    at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:773)
    at $Proxy6.onMessage(Unknown Source)
    at com.ibm.ws.sib.api.jmsra.impl.JmsJcaEndpointInvokerImpl.invokeEndpoint(JmsJcaEndpointInvokerImpl.java:201)
    at com.ibm.ws.sib.ra.inbound.impl.SibRaDispatcher.dispatch(SibRaDispatcher.java:768)
    at com.ibm.ws.sib.ra.inbound.impl.SibRaSingleProcessListener$SibRaWork.run(SibRaSingleProcessListener.java:584)
    at com.ibm.ejs.j2c.work.WorkProxy.run(WorkProxy.java:419)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:12:14+00:00Added an answer on May 22, 2026 at 10:12 pm

    You could use an XmlAdapter for this use case. The XML adapter will convert the unmappable object java.sql.Clob to a mappable object such as String:

    ClobAdapter

    import java.sql.Clob;
    
    import javax.xml.bind.annotation.adapters.XmlAdapter;
    
    public class ClobAdapter extends XmlAdapter<String, Clob> {
    
        @Override
        public Clob unmarshal(String v) throws Exception {
            // Convert String to Clob
        }
    
        @Override
        public String marshal(Clob v) throws Exception {
            // Convert Clob to String
        }
    
    }
    

    Root

    The @XmlJavaTypeAdapter must be set on the Clob property. This annotation is how you link in the XmlAdapter:

    import java.sql.Clob;
    
    import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
    
    public class Root {
    
        private Clob clob;
    
        @XmlJavaTypeAdapter(ClobAdapter.class)
        public Clob getClob() {
            return clob;
        }
    
        public void setClob(Clob clob) {
            this.clob = clob;
        }
    
    }
    

    Demo

    import javax.xml.bind.JAXBContext;
    
    public class Demo {
    
        public static void main(String[] args) throws Exception {
            JAXBContext jc = JAXBContext.newInstance(Root.class);
        }
    }
    

    For More Information

    • http://bdoughan.blogspot.com/2010/07/xmladapter-jaxbs-secret-weapon.html
    • http://bdoughan.blogspot.com/2011/05/jaxb-and-joda-time-dates-and-times.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Making a very basic paint program for a class and one of the requirements
Making my first steps with NHibernate, I'm trying to have it creating my Tables
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
After making some changes in my models (eg. new field in a model and
I have Java classes with the following structure (the class names do not imply
Making .htaccess (mod_rewrite) work has been very difficult I already have this script for
Making this tutorial: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html I have ListActivity-derived class and onCreateContextMenu, onContextItemSelected overrides. I think
I have a legacy class, with a lot of public double fields. All double
Making a simple Java code for Blackjack and need some advice. OK I am
While making an edit to a class with a long history, I was stymied

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.